TomatoVPN 1.27vpn3.6 release
[tomato.git] / release / src / Makefile
blobd76c2d0deb5e478c9faba4d267d6a2ff518ea078
2 # Toplevel Makefile for the BCM947xx Linux Router release
4 # Copyright 2005, Broadcom Corporation
5 # All Rights Reserved.
7 # THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 # KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 # SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 # FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
12 # $Id: Makefile,v 1.53 2005/04/25 03:54:37 tallest Exp $
15 SRCBASE := $(shell pwd)
16 RELEASEDIR := $(shell (cd $(SRCBASE)/.. && pwd -P))
17 PATH := $(RELEASEDIR)/tools:$(PATH)
19 -include tomato_profile.mak
21 ifeq ($(TOMATO_PROFILE),)
23 all:
24 $(MAKE) libc
25 $(MAKE) g
26 $(MAKE)
28 else
30 all:
31 @echo ""
32 @echo ""
33 @echo "$(TOMATO_PROFILE_NAME) Profile"
34 @btools/uversion.pl --gen
35 @echo ""
36 @echo ""
38 @$(MAKE) -C router all
39 @$(MAKE) -C router install
40 @$(MAKE) -C btools
42 @rm -rf image
43 @mkdir image
44 ifeq ($(wildcard include/bcm20xx.h),)
45 @btools/fpkg -i linux/linux/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -i router/mipsel-uclibc/target.image \
46 -t image/tomato.trx \
47 -l W54G,image/WRT54G_WRT54GL.bin \
48 -l W54S,image/WRT54GS.bin \
49 -l W54s,image/WRT54GSv4.bin \
50 -l W54U,image/WRTSL54GS.bin \
51 -m 0x10577050,image/WR850G.bin \
52 | tee fpkg.log
53 else
54 @btools/fpkg -i linux/linux/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -i router/mipsel-uclibc/target.image \
55 -t image/tomato-ND.trx
56 endif
59 @echo ""
60 @echo "-----------------"
61 @echo `cat build_version` " ready"
62 @echo "-----------------"
65 clean: cleanimage
66 @$(MAKE) -C router $@
67 @rm -f fpkg.log
69 cleanimage:
70 @rm -rf image
72 cleantools:
73 @$(MAKE) -C linux/linux/scripts/squashfs clean
74 @$(MAKE) -C btools clean
76 cleankernel:
77 @cd linux/linux && \
78 mv .config save-config && \
79 $(MAKE) distclean; \
80 mv save-config .config
82 distclean: clean cleankernel cleantools cleanlibc
83 ifneq ($(INSIDE_MAK),1)
84 @$(MAKE) -C router $@ INSIDE_MAK=1
85 endif
86 @rm -f router/config_current
87 @rm -f router/.config.cmd router/.config.old
88 @rm -f router/libfoo_xref.txt
89 @rm -f tomato_profile.mak router/shared/tomato_profile.h
91 prepk:
92 $(MAKE) -C linux/linux oldconfig dep
94 what:
95 @echo ""
96 @echo "$(TOMATO_PROFILE_NAME) Profile"
97 @echo ""
99 endif
103 @$(MAKE) setprofile U=G L=g N=G
105 setprofile:
106 echo '#ifndef TOMATO_PROFILE' > router/shared/tomato_profile.h
107 echo '#define TOMATO_$(U) 1' >> router/shared/tomato_profile.h
108 echo '#define PROFILE_G 1' >> router/shared/tomato_profile.h
109 echo '#define TOMATO_PROFILE PROFILE_$(U)' >> router/shared/tomato_profile.h
110 echo '#define TOMATO_PROFILE_NAME "$(N)"' >> router/shared/tomato_profile.h
111 echo '#endif' >> router/shared/tomato_profile.h
113 echo 'TOMATO_$(U) = 1' > tomato_profile.mak
114 echo 'PROFILE_G = 1' >> tomato_profile.mak
115 echo 'TOMATO_PROFILE = $$(PROFILE_$(U))' >> tomato_profile.mak
116 echo 'TOMATO_PROFILE_NAME = "$(N)"' >> tomato_profile.mak
117 echo 'TOMATO_PROFILE_L = $(L)' >> tomato_profile.mak
118 echo 'TOMATO_PROFILE_U = $(U)' >> tomato_profile.mak
120 @cd router && \
121 [ -s .config ] && cat .config > config_current; \
122 rm -f config_current && \
123 ln -s config_$(L) config_current && \
124 cp config_$(L) .config
125 @$(MAKE) -C router oldconfig
127 @echo ""
128 @echo "Using $(N) profile."
129 @echo ""
132 cleanlibc:
133 @$(MAKE) -C ../../tools-src/uClibc clean
135 libc: cleanlibc
136 @$(MAKE) -C ../../tools-src/uClibc
137 @$(MAKE) -C ../../tools-src/uClibc install
139 help:
140 @echo "g use G profile"
141 @echo "clean -C router clean"
142 @echo "cleanimage rm -rf image"
143 @echo "cleantools clean btools, mksquashfs"
144 @echo "cleankernel -C linux/linux distclean (but preserves .config)"
145 @echo "prepk -C linux/linux oldconfig dep"
146 @echo "libc -C uClibc clean, all, install"
148 .PHONY: all clean distclean cleanimage cleantools cleankernel prepk what setprofile libc help
149 .PHONY: g