Build: cosmetics, keep tun driver in Extras builds
[tomato.git] / release / src / Makefile
blobb55186c13bf32595692a19cee1827a0595649e1d
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 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
17 # To rebuild everything and all configurations:
18 # make distclean
19 # make libc (usually doesn't need to be done ???)
20 # make V1=whatever V2=sub-whatever VPN=vpn3.6 a b c d m
21 # The 1st "whatever" would be the build number, the sub-whatever would
22 # be the update to the version.
24 # Example:
25 # make V1=8516 V2="-jffs.1" a b c d m s
27 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
31 export SRCBASE := $(shell pwd)
32 RELEASEDIR := $(shell (cd $(SRCBASE)/.. && pwd -P))
33 PATH := $(RELEASEDIR)/tools:$(PATH)
35 include ./target.mak
37 # Normally you'd do something like "make V1=8516 V2=-sub-ver a b c d"
38 # But if you don't give anything for "V1", it'll get a default from tomato_version.
39 V1 ?= "--def"
40 VPN ?= "VPN"
41 ifeq ($(CONFIG_LINUX26),y)
42 ND = "K26"
43 else
44 ND = "ND"
45 endif
47 -include tomato_profile.mak
49 # This could be simpler by just using $(TOMATO_PROFILE_NAME) like it used to be,
50 # but that's fragile. If you make one certain innocuous change elsewhere in the
51 # makefile(s), the build will silently be wrong. This way it works properly every time.
52 current_BUILD_NAME = $(strip $(shell grep "^TOMATO_BUILD_NAME" tomato_profile.mak | cut -d"=" -f2))
53 current_BUILD_DESC = $(strip $(shell grep "^TOMATO_BUILD_DESC" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g"))
54 current_BUILD_USB = $(strip $(shell grep "^TOMATO_BUILD_USB" tomato_profile.mak | cut -d"=" -f2 | sed -e "s/ //g"))
55 current_TOMATO_VER = $(strip $(shell grep "TOMATO_MAJOR" router/shared/tomato_version.h | cut -d"\"" -f2)).$(strip $(shell grep "TOMATO_MINOR" router/shared/tomato_version.h | cut -d"\"" -f2))
57 uppercase_N = $(shell echo $(N) | tr a-z A-Z)
58 lowercase_N = $(shell echo $(N) | tr A-Z a-z)
59 uppercase_B = $(shell echo $(B) | tr a-z A-Z)
60 lowercase_B = $(shell echo $(B) | tr A-Z a-z)
62 ifeq ($(CONFIG_LINUX26),y)
63 mips_rev = $(if $(filter $(MIPS32),r2),MIPSR2,MIPSR1)
64 else
65 mips_rev =
66 endif
68 tomato_ver:
69 @echo ""
70 @btools/uversion.pl --gen $(V1) $(mips_rev)$(V2) $(ND) $(current_BUILD_USB) $(current_BUILD_DESC)
72 ifeq ($(TOMATO_BUILD),)
74 all:
75 $(MAKE) libc
76 $(MAKE) a
78 else
80 all: tomato_ver
81 @echo ""
82 @echo "Building Tomato $(ND) $(current_BUILD_USB) $(current_TOMATO_VER).$(V1)$(mips_rev)$(V2) $(current_BUILD_DESC) $(current_BUILD_NAME) with $(TOMATO_PROFILE_NAME) Profile"
84 @echo ""
85 @echo ""
87 @-mkdir image
88 @$(MAKE) -C router all
89 @$(MAKE) -C router install
90 @$(MAKE) -C btools
92 @rm -f image/tomato-$(ND)$(current_BUILD_USB)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(V2)-$(current_BUILD_DESC).trx
93 @echo "" >>fpkg.log
94 @echo "***********************" `date` "************************" >>fpkg.log
95 @cat router/shared/tomato_version >>fpkg.log
96 @echo "" >>fpkg.log
97 @cat router/target.info >>fpkg.log
98 ifeq ($(wildcard include/bcm20xx.h),)
99 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
100 -t image/tomato.trx \
101 -l W54G,image/WRT54G_WRT54GL.bin \
102 -l W54S,image/WRT54GS.bin \
103 -l W54s,image/WRT54GSv4.bin \
104 -l W54U,image/WRTSL54GS.bin \
105 -m 0x10577050,image/WR850G.bin \
106 | tee -a fpkg.log
107 else
108 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -a 1024 -i router/mipsel-uclibc/target.image \
109 -t image/tomato-$(ND)$(current_BUILD_USB)-$(current_TOMATO_VER).$(V1)$(mips_rev)$(V2)-$(current_BUILD_DESC).trx | tee -a fpkg.log
110 endif
112 @cp fpkg.log image/fpkg-$(V1)$(mips_rev)$(V2).log
113 @echo ""
114 @echo "-----------------"
115 @echo `cat router/shared/tomato_version` " ready"
116 @echo "-----------------"
117 ifneq ($(NOVERSION),1)
118 @cp router/shared/tomato_version router/shared/tomato_version_last
119 @btools/uversion.pl --bump
120 endif
121 endif
125 clean:
126 @touch router/.config
127 @rm -f router/config_[a-z]
128 @rm -f router/busybox/config_[a-z]
129 @$(MAKE) -C router $@
130 @-rmdir router/mipsel-uclibc
132 cleanimage:
133 @rm -f fpkg.log
134 @rm -fr image/*
135 @rm -f router/.config
136 @touch router/.config
137 @-mkdir image
139 cleantools:
140 @$(MAKE) -C $(LINUXDIR)/scripts/squashfs clean
141 @$(MAKE) -C btools clean
143 cleankernel:
144 @cd $(LINUXDIR) && \
145 mv .config save-config && \
146 $(MAKE) distclean || true; \
147 cp -p save-config .config || true
149 distclean: clean cleanimage cleankernel cleantools cleanlibc
150 ifneq ($(INSIDE_MAK),1)
151 @$(MAKE) -C router $@ INSIDE_MAK=1
152 endif
153 mv router/busybox/.config busybox-saved-config || true
154 @$(MAKE) -C router/busybox distclean
155 @rm -f router/busybox/config_current
156 @cp -p busybox-saved-config router/busybox/.config || true
157 @cp -p router/busybox/.config router/busybox/config_current || true
158 @rm -f router/config_current
159 @rm -f router/.config.cmd router/.config.old router/.config
160 @rm -f router/libfoo_xref.txt
161 @rm -f tomato_profile.mak router/shared/tomato_profile.h
162 @touch tomato_profile.mak
163 @touch router/shared/tomato_profile.h
166 prepk:
167 @cd $(LINUXDIR) ; \
168 rm -f config_current ; \
169 ln -s config_base config_current ; \
170 cp -f config_current .config
171 $(MAKE) -C $(LINUXDIR) oldconfig dep
173 what:
174 @echo ""
175 @echo "$(current_BUILD_DESC)-$(current_BUILD_NAME)-$(TOMATO_PROFILE_NAME) Profile"
176 @echo ""
179 # The methodology for making the different builds is to
180 # copy the "base" config file to the "target" config file in
181 # the appropriate directory, and then edit it by removing and
182 # inserting the desired configuration lines.
183 # You can't just delete the "whatever=y" line, you must have
184 # a "...is not set" line, or the make oldconfig will stop and ask
185 # what to do.
187 # Options for "make bin" :
188 # BUILD_DESC (Std|Lite|Ext|...)
189 # MIPS32 (r2|r1)
190 # USB ("USB"|"")
191 # JFFSv1 | NO_JFFS
192 # NO_CIFS, NO_SSH, NO_ZEBRA, NO_SAMBA, NO_LIBOPT
193 # SAMBA3, OPENVPN, IPV6SUPP, EBTABLES, NTFS, MEDIASRV, BBEXTRAS, USBEXTRAS, SLIM
195 define RouterOptions
196 @( \
197 if [ "$(CONFIG_LINUX26)" = "y" ] || [ "$(SAMBA3)" = "y" ]; then \
198 sed -i "/TCONFIG_SAMBA3/d" $(1); \
199 echo "TCONFIG_SAMBA3=y" >>$(1); \
200 fi; \
201 sed -i "/TCONFIG_JFFSV1/d" $(1); \
202 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
203 if [ "$(JFFSv1)" = "y" ]; then \
204 echo "TCONFIG_JFFSV1=y" >>$(1); \
205 else \
206 echo "# TCONFIG_JFFSV1 is not set" >>$(1); \
207 fi; \
208 else \
209 echo "TCONFIG_JFFSV1=y" >>$(1); \
210 fi; \
211 if [ "$(USB)" = "USB" ]; then \
212 if [ "$(USBEXTRAS)" = "y" ]; then \
213 sed -i "/TCONFIG_USB_EXTRAS/d" $(1); \
214 echo "TCONFIG_USB_EXTRAS=y" >>$(1); \
215 fi; \
216 if [ "$(NTFS)" = "y" ]; then \
217 sed -i "/TCONFIG_NTFS/d" $(1); \
218 echo "TCONFIG_NTFS=y" >>$(1); \
219 fi; \
220 if [ "$(MEDIASRV)" = "y" ]; then \
221 sed -i "/TCONFIG_MEDIA_SERVER/d" $(1); \
222 echo "TCONFIG_MEDIA_SERVER=y" >>$(1); \
223 fi; \
224 else \
225 sed -i "/TCONFIG_SAMBASRV/d" $(1); \
226 echo "# TCONFIG_SAMBASRV is not set" >>$(1); \
227 sed -i "/TCONFIG_FTP/d" $(1); \
228 echo "# TCONFIG_FTP is not set" >>$(1); \
229 sed -i "/TCONFIG_USB/d" $(1); \
230 echo "# TCONFIG_USB is not set" >>$(1); \
231 fi; \
232 if [ "$(NO_SAMBA)" = "y" ]; then \
233 sed -i "/TCONFIG_SAMBASRV/d" $(1); \
234 echo "# TCONFIG_SAMBASRV is not set" >>$(1); \
235 fi; \
236 if [ "$(NO_ZEBRA)" = "y" ]; then \
237 sed -i "/TCONFIG_ZEBRA/d" $(1); \
238 echo "# TCONFIG_ZEBRA is not set" >>$(1); \
239 fi; \
240 if [ "$(NO_JFFS)" = "y" ]; then \
241 sed -i "/TCONFIG_JFFS2/d" $(1); \
242 echo "# TCONFIG_JFFS2 is not set" >>$(1); \
243 sed -i "/TCONFIG_JFFSV1/d" $(1); \
244 echo "# TCONFIG_JFFSV1 is not set" >>$(1); \
245 fi; \
246 if [ "$(NO_CIFS)" = "y" ]; then \
247 sed -i "/TCONFIG_CIFS/d" $(1); \
248 echo "# TCONFIG_CIFS is not set" >>$(1); \
249 fi; \
250 if [ "$(NO_SSH)" = "y" ]; then \
251 sed -i "/TCONFIG_SSH/d" $(1); \
252 echo "# TCONFIG_SSH is not set" >>$(1); \
253 fi; \
254 if [ "$(NO_LIBOPT)" = "y" ]; then \
255 sed -i "/TCONFIG_OPTIMIZE_SHARED_LIBS/d" $(1); \
256 echo "# TCONFIG_OPTIMIZE_SHARED_LIBS is not set" >>$(1); \
257 fi; \
258 if [ "$(EBTABLES)" = "y" ]; then \
259 sed -i "/TCONFIG_EBTABLES/d" $(1); \
260 echo "TCONFIG_EBTABLES=y" >>$(1); \
261 fi; \
262 if [ "$(IPV6SUPP)" = "y" ]; then \
263 sed -i "/TCONFIG_IPV6/d" $(1); \
264 echo "TCONFIG_IPV6=y" >>$(1); \
265 fi; \
266 if [ "$(OPENVPN)" = "y" ]; then \
267 sed -i "/TCONFIG_LZO/d" $(1); \
268 echo "TCONFIG_LZO=y" >>$(1); \
269 sed -i "/TCONFIG_OPENVPN/d" $(1); \
270 echo "TCONFIG_OPENVPN=y" >>$(1); \
271 fi; \
273 endef
275 define BusyboxOptions
276 @( \
277 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
278 sed -i "/CONFIG_FEATURE_2_4_MODULES/d" $(1); \
279 echo "# CONFIG_FEATURE_2_4_MODULES is not set" >>$(1); \
280 sed -i "/CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT/d" $(1); \
281 echo "CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y" >>$(1); \
282 sed -i "/CONFIG_FEATURE_DEVFS/d" $(1); \
283 echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
284 sed -i "/CONFIG_MKNOD/d" $(1); \
285 echo "CONFIG_MKNOD=y" >>$(1); \
286 fi; \
287 if [ "$(NO_CIFS)" = "y" ]; then \
288 sed -i "/CONFIG_FEATURE_MOUNT_CIFS/d" $(1); \
289 echo "# CONFIG_FEATURE_MOUNT_CIFS is not set" >>$(1); \
290 fi; \
291 if [ "$(BBEXTRAS)" = "y" ]; then \
292 sed -i "/CONFIG_SENDMAIL/d" $(1); \
293 echo "CONFIG_SENDMAIL=y" >>$(1); \
294 sed -i "/CONFIG_FEATURE_LS_COLOR/d" $(1); \
295 echo "CONFIG_FEATURE_LS_COLOR=y" >>$(1); \
296 sed -i "/CONFIG_FEATURE_LS_COLOR_IS_DEFAULT/d" $(1); \
297 echo "CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y" >>$(1); \
298 sed -i "/CONFIG_FEATURE_SORT_BIG/d" $(1); \
299 echo "CONFIG_FEATURE_SORT_BIG=y" >>$(1); \
300 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
301 sed -i "/CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE/d" $(1); \
302 echo "CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=512" >>$(1); \
303 fi; \
304 fi; \
305 if [ "$(USB)" = "USB" ]; then \
306 if [ "$(USBEXTRAS)" = "y" ]; then \
307 sed -i "/CONFIG_E2FSCK/d" $(1); \
308 echo "CONFIG_E2FSCK=y" >>$(1); \
309 sed -i "/CONFIG_MKE2FS/d" $(1); \
310 echo "CONFIG_MKE2FS=y" >>$(1); \
311 sed -i "/CONFIG_FDISK/d" $(1); \
312 echo "CONFIG_FDISK=y" >>$(1); \
313 sed -i "/CONFIG_FEATURE_FDISK_WRITABLE/d" $(1); \
314 echo "CONFIG_FEATURE_FDISK_WRITABLE=y" >>$(1); \
315 sed -i "/CONFIG_MKFS_VFAT/d" $(1); \
316 echo "CONFIG_MKFS_VFAT=y" >>$(1); \
317 sed -i "/CONFIG_MKSWAP/d" $(1); \
318 echo "CONFIG_MKSWAP=y" >>$(1); \
319 sed -i "/CONFIG_FLOCK/d" $(1); \
320 echo "CONFIG_FLOCK=y" >>$(1); \
321 sed -i "/CONFIG_FSYNC/d" $(1); \
322 echo "CONFIG_FSYNC=y" >>$(1); \
323 sed -i "/CONFIG_UNZIP/d" $(1); \
324 echo "CONFIG_UNZIP=y" >>$(1); \
325 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
326 sed -i "/CONFIG_LSUSB/d" $(1); \
327 echo "CONFIG_LSUSB=y" >>$(1); \
328 sed -i "/CONFIG_FEATURE_WGET_STATUSBAR/d" $(1); \
329 echo "CONFIG_FEATURE_WGET_STATUSBAR=y" >>$(1); \
330 sed -i "/CONFIG_FEATURE_VERBOSE_USAGE/d" $(1); \
331 echo "CONFIG_FEATURE_VERBOSE_USAGE=y" >>$(1); \
332 fi; \
333 fi; \
334 else \
335 sed -i "/CONFIG_FEATURE_MOUNT_LOOP/d" $(1); \
336 echo "# CONFIG_FEATURE_MOUNT_LOOP is not set" >>$(1); \
337 sed -i "/CONFIG_FEATURE_DEVFS/d" $(1); \
338 echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
339 sed -i "/CONFIG_FEATURE_MOUNT_LABEL/d" $(1); \
340 echo "# CONFIG_FEATURE_MOUNT_LABEL is not set" >>$(1); \
341 sed -i "/CONFIG_FEATURE_MOUNT_FSTAB/d" $(1); \
342 echo "# CONFIG_FEATURE_MOUNT_FSTAB is not set" >>$(1); \
343 sed -i "/CONFIG_VOLUMEID/d" $(1); \
344 echo "# CONFIG_VOLUMEID is not set" >>$(1); \
345 sed -i "/CONFIG_BLKID/d" $(1); \
346 echo "# CONFIG_BLKID is not set" >>$(1); \
347 sed -i "/CONFIG_SWAPONOFF/d" $(1); \
348 echo "# CONFIG_SWAPONOFF is not set" >>$(1); \
349 fi; \
350 if [ "$(IPV6SUPP)" = "y" ]; then \
351 sed -i "/CONFIG_FEATURE_IPV6/d" $(1); \
352 echo "CONFIG_FEATURE_IPV6=y" >>$(1); \
353 sed -i "/CONFIG_PING6/d" $(1); \
354 echo "CONFIG_PING6=y" >>$(1); \
355 sed -i "/CONFIG_TRACEROUTE6/d" $(1); \
356 echo "CONFIG_TRACEROUTE6=y" >>$(1); \
357 fi; \
358 if [ "$(SLIM)" = "y" ]; then \
359 sed -i "/CONFIG_FEATURE_MOUNT_LOOP/d" $(1); \
360 echo "# CONFIG_FEATURE_MOUNT_LOOP is not set" >>$(1); \
361 sed -i "/CONFIG_AWK/d" $(1); \
362 echo "# CONFIG_AWK is not set" >>$(1); \
363 sed -i "/CONFIG_BASENAME/d" $(1); \
364 echo "# CONFIG_BASENAME is not set" >>$(1); \
365 sed -i "/CONFIG_FEATURE_DEVFS/d" $(1); \
366 echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
367 sed -i "/CONFIG_BLKID/d" $(1); \
368 echo "# CONFIG_BLKID is not set" >>$(1); \
369 sed -i "/CONFIG_ARPING/d" $(1); \
370 echo "# CONFIG_ARPING is not set" >>$(1); \
371 fi; \
373 endef
375 define KernelConfig
376 @( \
377 if [ "$(CONFIG_LINUX26)" = "y" ] && [ "$(MIPS32)" = "r2" ]; then \
378 sed -i "/CONFIG_CPU_MIPS32_R1/d" $(1); \
379 echo "# CONFIG_CPU_MIPS32_R1 is not set" >>$(1); \
380 sed -i "/CONFIG_CPU_MIPS32_R2/d" $(1); \
381 echo "CONFIG_CPU_MIPS32_R2=y" >>$(1); \
382 sed -i "/CONFIG_CPU_MIPSR1/d" $(1); \
383 echo "CONFIG_CPU_MIPSR2=y" >>$(1); \
384 fi; \
385 if [ "$(IPV6SUPP)" = "y" ]; then \
386 sed -i "/CONFIG_IPV6 is not set/d" $(1); \
387 echo "CONFIG_IPV6=m" >>$(1); \
388 sed -i "/CONFIG_IP6_NF_IPTABLES/d" $(1); \
389 echo "CONFIG_IP6_NF_IPTABLES=m" >>$(1); \
390 sed -i "/CONFIG_IP6_NF_MATCH_RT/d" $(1); \
391 echo "CONFIG_IP6_NF_MATCH_RT=m" >>$(1); \
392 sed -i "/CONFIG_IP6_NF_FILTER/d" $(1); \
393 echo "CONFIG_IP6_NF_FILTER=m" >>$(1); \
394 sed -i "/CONFIG_IP6_NF_TARGET_LOG/d" $(1); \
395 echo "CONFIG_IP6_NF_TARGET_LOG=m" >>$(1); \
396 sed -i "/CONFIG_IP6_NF_TARGET_REJECT/d" $(1); \
397 echo "CONFIG_IP6_NF_TARGET_REJECT=m" >>$(1); \
398 sed -i "/CONFIG_IP6_NF_MANGLE/d" $(1); \
399 echo "CONFIG_IP6_NF_MANGLE=m" >>$(1); \
400 sed -i "/CONFIG_IP6_NF_TARGET_IMQ/d" $(1); \
401 echo "CONFIG_IP6_NF_TARGET_IMQ=m" >>$(1); \
402 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
403 sed -i "/CONFIG_NF_CONNTRACK_IPV6/d" $(1); \
404 echo "CONFIG_NF_CONNTRACK_IPV6=m" >>$(1); \
405 sed -i "/CONFIG_IPV6_ROUTER_PREF/d" $(1); \
406 echo "CONFIG_IPV6_ROUTER_PREF=y" >>$(1); \
407 sed -i "/CONFIG_IPV6_SIT/d" $(1); \
408 echo "CONFIG_IPV6_SIT=m" >>$(1); \
409 sed -i "/CONFIG_IPV6_MULTIPLE_TABLES/d" $(1); \
410 echo "CONFIG_IPV6_MULTIPLE_TABLES=y" >>$(1); \
411 sed -i "/CONFIG_IP6_NF_TARGET_ROUTE/d" $(1); \
412 echo "CONFIG_IP6_NF_TARGET_ROUTE=y" >>$(1); \
413 else \
414 sed -i "/CONFIG_IP6_NF_CONNTRACK/d" $(1); \
415 echo "CONFIG_IP6_NF_CONNTRACK=m" >>$(1); \
416 sed -i "/CONFIG_IP6_NF_FTP/d" $(1); \
417 echo "CONFIG_IP6_NF_FTP=m" >>$(1); \
418 sed -i "/CONFIG_IP6_NF_MATCH_LIMIT/d" $(1); \
419 echo "CONFIG_IP6_NF_MATCH_LIMIT=m" >>$(1); \
420 sed -i "/CONFIG_IP6_NF_MATCH_CONDITION/d" $(1); \
421 echo "CONFIG_IP6_NF_MATCH_CONDITION=m" >>$(1); \
422 sed -i "/CONFIG_IP6_NF_MATCH_MAC/d" $(1); \
423 echo "CONFIG_IP6_NF_MATCH_MAC=m" >>$(1); \
424 sed -i "/CONFIG_IP6_NF_MATCH_MULTIPORT/d" $(1); \
425 echo "CONFIG_IP6_NF_MATCH_MULTIPORT=m" >>$(1); \
426 sed -i "/CONFIG_IP6_NF_MATCH_MARK/d" $(1); \
427 echo "CONFIG_IP6_NF_MATCH_MARK=m" >>$(1); \
428 sed -i "/CONFIG_IP6_NF_MATCH_LENGTH/d" $(1); \
429 echo "CONFIG_IP6_NF_MATCH_LENGTH=m" >>$(1); \
430 sed -i "/CONFIG_IP6_NF_MATCH_STATE/d" $(1); \
431 echo "CONFIG_IP6_NF_MATCH_STATE=m" >>$(1); \
432 sed -i "/CONFIG_IP6_NF_TARGET_MARK/d" $(1); \
433 echo "CONFIG_IP6_NF_TARGET_MARK=m" >>$(1); \
434 sed -i "/CONFIG_IP6_NF_TARGET_TCPMSS/d" $(1); \
435 echo "CONFIG_IP6_NF_TARGET_TCPMSS=m" >>$(1); \
436 sed -i "/CONFIG_IP6_NF_TARGET_ROUTE/d" $(1); \
437 echo "CONFIG_IP6_NF_TARGET_ROUTE=m" >>$(1); \
438 fi; \
439 fi; \
440 if [ "$(CONFIG_LINUX26)" = "y" ] && [ "$(EBTABLES)" = "y" ]; then \
441 sed -i "/CONFIG_BRIDGE_NF_EBTABLES/d" $(1); \
442 echo "CONFIG_BRIDGE_NF_EBTABLES=m" >>$(1); \
443 fi; \
445 endef
448 bin:
449 ifeq ($(B),)
450 @echo $@" is not a valid target!"
451 @false
452 endif
453 @cp router/config_base router/config_$(lowercase_B)
454 @cp router/busybox/config_base router/busybox/config_$(lowercase_B)
455 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$(lowercase_B)
457 $(call RouterOptions, router/config_$(lowercase_B))
458 $(call KernelConfig, $(LINUXDIR)/config_$(lowercase_B))
459 $(call BusyboxOptions, router/busybox/config_$(lowercase_B))
461 @$(MAKE) setprofile N=$(TPROFILE) B=$(B) DESC="$(BUILD_DESC)" USB="$(USB)"
462 @$(MAKE) all
464 ## Make the "normal" build
466 @$(MAKE) bin B=A BUILD_DESC="Std" USB="USB"
468 ## Make the "normal but without SSH" build
470 @$(MAKE) bin NO_SSH=y B=B BUILD_DESC="No SSH" USB="USB"
472 ## Make the "normal but without CIFS" build
474 @$(MAKE) bin NO_CIFS=y B=C BUILD_DESC="No CIFS" USB="USB"
476 ## Make the "normal but without SAMBA" build
478 ifeq ($(CONFIG_LINUX26),y)
479 @$(MAKE) bin NO_SAMBA=y SLIM=y NO_CIFS=y NO_JFFS=y NO_ZEBRA=y B=D BUILD_DESC="Lite" USB="USB"
480 else
481 @$(MAKE) bin NO_SAMBA=y SLIM=y B=D BUILD_DESC="Lite" USB="USB"
482 endif
484 ## Make the "normal (with NTFS support) + VPN" build
486 ifeq ($(CONFIG_LINUX26),y)
487 @$(MAKE) bin OPENVPN=y NTFS=y BBEXTRAS=y USBEXTRAS=y EBTABLES=y NO_LIBOPT=y MEDIASRV=y B=E BUILD_DESC="$(VPN)" USB="USB"
488 else
489 @$(MAKE) bin OPENVPN=y NTFS=y B=E BUILD_DESC="$(VPN)" USB="USB"
490 endif
492 ## Make the "normal with Extras and NTFS" build
494 ifeq ($(CONFIG_LINUX26),y)
495 @$(MAKE) bin NTFS=y BBEXTRAS=y USBEXTRAS=y EBTABLES=y NO_LIBOPT=y MEDIASRV=y B=M BUILD_DESC="Ext" USB="USB"
496 else
497 @$(MAKE) bin NTFS=y BBEXTRAS=y USBEXTRAS=y B=M BUILD_DESC="Ext" USB="USB"
498 endif
500 ## Make the "No USB" build
502 ifeq ($(CONFIG_LINUX26),y)
503 @$(MAKE) bin BBEXTRAS=y NO_JFFS=y B=S BUILD_DESC="Std" USB=""
504 else
505 @$(MAKE) bin BBEXTRAS=y B=S BUILD_DESC="Std" USB=""
506 endif
508 ## Make the "Mini: no USB, no CIFS, no JFFS" build
510 @$(MAKE) bin NO_JFFS=y NO_CIFS=y SLIM=y B=F BUILD_DESC="Mini" USB=""
512 ## Make the "VPN witn no USB support" build
514 ifeq ($(CONFIG_LINUX26),y)
515 @$(MAKE) bin OPENVPN=y NO_JFFS=y B=V BUILD_DESC="$(VPN)" USB=""
516 else
517 @$(MAKE) bin OPENVPN=y BBEXTRAS=y B=V BUILD_DESC="$(VPN)" USB=""
518 endif
520 ## Make Mips32r2 Extras build (Asus RT-N16, Netgear WNR3500L)
521 r2m:
522 @$(MAKE) m MIPS32=r2
524 ## Make Mips32r2 USB+VPN build
525 r2e:
526 @$(MAKE) e MIPS32=r2
528 ## Make Mips32r2 "no USB" build (RT-N12, WRT160Nv3)
529 r2s:
530 @$(MAKE) s MIPS32=r2
532 ## Make Mips32r2 "no USB" VPN build
533 r2v:
534 @$(MAKE) v MIPS32=r2
536 setprofile:
537 echo '#ifndef TOMATO_PROFILE' > router/shared/tomato_profile.h
538 echo '#define TOMATO_$(N) 1' >> router/shared/tomato_profile.h
539 echo '#define PROFILE_G 1' >> router/shared/tomato_profile.h
540 echo '#define PROFILE_N 2' >> router/shared/tomato_profile.h
541 echo '#define TOMATO_PROFILE PROFILE_$(N)' >> router/shared/tomato_profile.h
542 echo '#define TOMATO_PROFILE_NAME "$(N)"' >> router/shared/tomato_profile.h
543 echo '#define TOMATO_BUILD_NAME "$(B)"' >> router/shared/tomato_profile.h
544 echo '#define TOMATO_BUILD_DESC "$(DESC)"' >> router/shared/tomato_profile.h
545 echo '#endif' >> router/shared/tomato_profile.h
547 echo 'TOMATO_$(N) = 1' > tomato_profile.mak
548 echo 'PROFILE_G = 1' >> tomato_profile.mak
549 echo 'PROFILE_N = 2' >> tomato_profile.mak
550 echo 'TOMATO_PROFILE = $$(PROFILE_$(N))' >> tomato_profile.mak
551 echo 'TOMATO_PROFILE_NAME = "$(N)"' >> tomato_profile.mak
552 echo 'TOMATO_BUILD = "$(B)"' >> tomato_profile.mak
553 echo 'TOMATO_BUILD_NAME = "$(B)"' >> tomato_profile.mak
554 echo 'TOMATO_BUILD_DESC = "$(DESC)"' >> tomato_profile.mak
555 echo 'TOMATO_PROFILE_L = $(lowercase_N)' >> tomato_profile.mak
556 echo 'TOMATO_PROFILE_U = $(uppercase_N)' >> tomato_profile.mak
557 echo 'TOMATO_BUILD_USB = "$(USB)"' >> tomato_profile.mak
560 # Note that changes to variables in tomato_profile.mak don't
561 # get propogated to this invocation of make!
562 @echo ""
563 @echo "Using $(N) profile, $(B) build config."
564 @echo ""
566 @cd $(LINUXDIR) ; \
567 rm -f config_current ; \
568 ln -s config_$(lowercase_B) config_current ; \
569 cp -f config_current .config
571 @cd router/busybox && \
572 rm -f config_current ; \
573 ln -s config_$(lowercase_B) config_current ; \
574 cp config_current .config
576 @cd router ; \
577 rm -f config_current ; \
578 ln -s config_$(lowercase_B) config_current ; \
579 cp config_current .config
581 @$(MAKE) -C router oldconfig
583 cleanlibc:
584 # @$(MAKE) -C ../../tools-src/uClibc clean
586 libc: cleanlibc
587 # @$(MAKE) -C ../../tools-src/uClibc
588 # @$(MAKE) -C ../../tools-src/uClibc install
590 help:
591 @echo "a A build (standard)"
592 @echo "b B build (standard minus SSH)"
593 @echo "c C build (standard minus CIFS)"
594 @echo "d D build (standard minus Samba server)"
595 @echo "m M build (standard plus extra utilities and NTFS support)"
596 ifeq ($(CONFIG_LINUX26),y)
597 @echo "e E build (standard plus VPN, extra utilities and NTFS support)"
598 else
599 @echo "e E build (standard plus VPN and NTFS support)"
600 endif
601 @echo "s S build (no USB support)"
602 @echo "f F build (no USB support minus JFFS and CIFS)"
603 @echo "v V build (VPN with no USB support)"
604 ifeq ($(CONFIG_LINUX26),y)
605 @echo "r2m MIPS Release 2 M build (standard plus extras)"
606 @echo "r2e MIPS Release 2 E build (standard plus VPN and extras)"
607 @echo "r2v MIPS Release 2 V build (VPN with no USB support)"
608 @echo "r2s MIPS Release 2 S build (no USB support)"
609 endif
610 @echo "..etc.. other build configs"
611 @echo "clean -C router clean"
612 @echo "cleanimage rm -rf image"
613 @echo "cleantools clean btools, mksquashfs"
614 @echo "cleankernel -C Linux distclean (but preserves .config)"
615 @echo "distclean distclean of Linux & busybox (but preserve .configs)"
616 @echo "prepk -C Linux oldconfig dep"
617 @echo "libc -C uClibc clean, all, install"
619 .PHONY: all clean distclean cleanimage cleantools cleankernel prepk what setprofile libc help
620 .PHONY: a b c d m Makefile allversions tomato_profile.mak