Build: K26: do not include BCM "fast NAT"
[tomato.git] / release / src / Makefile
blob9efa9f6d53219ed598a9a837c03aa8a036235a38
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 sed -i "/CONFIG_TRUE/d" $(1); \
350 echo "# CONFIG_TRUE is not set" >>$(1); \
351 fi; \
352 if [ "$(IPV6SUPP)" = "y" ]; then \
353 sed -i "/CONFIG_FEATURE_IPV6/d" $(1); \
354 echo "CONFIG_FEATURE_IPV6=y" >>$(1); \
355 sed -i "/CONFIG_PING6/d" $(1); \
356 echo "CONFIG_PING6=y" >>$(1); \
357 sed -i "/CONFIG_TRACEROUTE6/d" $(1); \
358 echo "CONFIG_TRACEROUTE6=y" >>$(1); \
359 fi; \
360 if [ "$(SLIM)" = "y" ]; then \
361 sed -i "/CONFIG_FEATURE_MOUNT_LOOP/d" $(1); \
362 echo "# CONFIG_FEATURE_MOUNT_LOOP is not set" >>$(1); \
363 sed -i "/CONFIG_AWK/d" $(1); \
364 echo "# CONFIG_AWK is not set" >>$(1); \
365 sed -i "/CONFIG_BASENAME/d" $(1); \
366 echo "# CONFIG_BASENAME is not set" >>$(1); \
367 sed -i "/CONFIG_FEATURE_DEVFS/d" $(1); \
368 echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
369 sed -i "/CONFIG_BLKID/d" $(1); \
370 echo "# CONFIG_BLKID is not set" >>$(1); \
371 sed -i "/CONFIG_ARPING/d" $(1); \
372 echo "# CONFIG_ARPING is not set" >>$(1); \
373 fi; \
375 endef
377 define KernelConfig
378 @( \
379 if [ "$(CONFIG_LINUX26)" = "y" ] && [ "$(MIPS32)" = "r2" ]; then \
380 sed -i "/CONFIG_CPU_MIPS32_R1/d" $(1); \
381 echo "# CONFIG_CPU_MIPS32_R1 is not set" >>$(1); \
382 sed -i "/CONFIG_CPU_MIPS32_R2/d" $(1); \
383 echo "CONFIG_CPU_MIPS32_R2=y" >>$(1); \
384 sed -i "/CONFIG_CPU_MIPSR1/d" $(1); \
385 echo "CONFIG_CPU_MIPSR2=y" >>$(1); \
386 fi; \
387 if [ "$(IPV6SUPP)" = "y" ]; then \
388 sed -i "/CONFIG_IPV6 is not set/d" $(1); \
389 echo "CONFIG_IPV6=m" >>$(1); \
390 sed -i "/CONFIG_IP6_NF_IPTABLES/d" $(1); \
391 echo "CONFIG_IP6_NF_IPTABLES=m" >>$(1); \
392 sed -i "/CONFIG_IP6_NF_MATCH_RT/d" $(1); \
393 echo "CONFIG_IP6_NF_MATCH_RT=m" >>$(1); \
394 sed -i "/CONFIG_IP6_NF_FILTER/d" $(1); \
395 echo "CONFIG_IP6_NF_FILTER=m" >>$(1); \
396 sed -i "/CONFIG_IP6_NF_TARGET_LOG/d" $(1); \
397 echo "CONFIG_IP6_NF_TARGET_LOG=m" >>$(1); \
398 sed -i "/CONFIG_IP6_NF_TARGET_REJECT/d" $(1); \
399 echo "CONFIG_IP6_NF_TARGET_REJECT=m" >>$(1); \
400 sed -i "/CONFIG_IP6_NF_MANGLE/d" $(1); \
401 echo "CONFIG_IP6_NF_MANGLE=m" >>$(1); \
402 sed -i "/CONFIG_IP6_NF_TARGET_IMQ/d" $(1); \
403 echo "CONFIG_IP6_NF_TARGET_IMQ=m" >>$(1); \
404 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
405 sed -i "/CONFIG_NF_CONNTRACK_IPV6/d" $(1); \
406 echo "CONFIG_NF_CONNTRACK_IPV6=m" >>$(1); \
407 sed -i "/CONFIG_IPV6_ROUTER_PREF/d" $(1); \
408 echo "CONFIG_IPV6_ROUTER_PREF=y" >>$(1); \
409 sed -i "/CONFIG_IPV6_SIT/d" $(1); \
410 echo "CONFIG_IPV6_SIT=m" >>$(1); \
411 sed -i "/CONFIG_IPV6_MULTIPLE_TABLES/d" $(1); \
412 echo "CONFIG_IPV6_MULTIPLE_TABLES=y" >>$(1); \
413 sed -i "/CONFIG_IP6_NF_TARGET_ROUTE/d" $(1); \
414 echo "CONFIG_IP6_NF_TARGET_ROUTE=y" >>$(1); \
415 else \
416 sed -i "/CONFIG_IP6_NF_CONNTRACK/d" $(1); \
417 echo "CONFIG_IP6_NF_CONNTRACK=m" >>$(1); \
418 sed -i "/CONFIG_IP6_NF_FTP/d" $(1); \
419 echo "CONFIG_IP6_NF_FTP=m" >>$(1); \
420 sed -i "/CONFIG_IP6_NF_MATCH_LIMIT/d" $(1); \
421 echo "CONFIG_IP6_NF_MATCH_LIMIT=m" >>$(1); \
422 sed -i "/CONFIG_IP6_NF_MATCH_CONDITION/d" $(1); \
423 echo "CONFIG_IP6_NF_MATCH_CONDITION=m" >>$(1); \
424 sed -i "/CONFIG_IP6_NF_MATCH_MAC/d" $(1); \
425 echo "CONFIG_IP6_NF_MATCH_MAC=m" >>$(1); \
426 sed -i "/CONFIG_IP6_NF_MATCH_MULTIPORT/d" $(1); \
427 echo "CONFIG_IP6_NF_MATCH_MULTIPORT=m" >>$(1); \
428 sed -i "/CONFIG_IP6_NF_MATCH_MARK/d" $(1); \
429 echo "CONFIG_IP6_NF_MATCH_MARK=m" >>$(1); \
430 sed -i "/CONFIG_IP6_NF_MATCH_LENGTH/d" $(1); \
431 echo "CONFIG_IP6_NF_MATCH_LENGTH=m" >>$(1); \
432 sed -i "/CONFIG_IP6_NF_MATCH_STATE/d" $(1); \
433 echo "CONFIG_IP6_NF_MATCH_STATE=m" >>$(1); \
434 sed -i "/CONFIG_IP6_NF_TARGET_MARK/d" $(1); \
435 echo "CONFIG_IP6_NF_TARGET_MARK=m" >>$(1); \
436 sed -i "/CONFIG_IP6_NF_TARGET_TCPMSS/d" $(1); \
437 echo "CONFIG_IP6_NF_TARGET_TCPMSS=m" >>$(1); \
438 sed -i "/CONFIG_IP6_NF_TARGET_ROUTE/d" $(1); \
439 echo "CONFIG_IP6_NF_TARGET_ROUTE=m" >>$(1); \
440 fi; \
441 fi; \
442 if [ "$(CONFIG_LINUX26)" = "y" ] && [ "$(EBTABLES)" = "y" ]; then \
443 sed -i "/CONFIG_BRIDGE_NF_EBTABLES/d" $(1); \
444 echo "CONFIG_BRIDGE_NF_EBTABLES=m" >>$(1); \
445 fi; \
447 endef
450 bin:
451 ifeq ($(B),)
452 @echo $@" is not a valid target!"
453 @false
454 endif
455 @cp router/config_base router/config_$(lowercase_B)
456 @cp router/busybox/config_base router/busybox/config_$(lowercase_B)
457 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$(lowercase_B)
459 $(call RouterOptions, router/config_$(lowercase_B))
460 $(call KernelConfig, $(LINUXDIR)/config_$(lowercase_B))
461 $(call BusyboxOptions, router/busybox/config_$(lowercase_B))
463 @$(MAKE) setprofile N=$(TPROFILE) B=$(B) DESC="$(BUILD_DESC)" USB="$(USB)"
464 @$(MAKE) all
466 ## Make the "normal" build
468 @$(MAKE) bin B=A BUILD_DESC="Std" USB="USB"
470 ## Make the "normal but without SSH" build
472 @$(MAKE) bin NO_SSH=y B=B BUILD_DESC="No SSH" USB="USB"
474 ## Make the "normal but without CIFS" build
476 @$(MAKE) bin NO_CIFS=y B=C BUILD_DESC="No CIFS" USB="USB"
478 ## Make the "normal but without SAMBA" build
480 ifeq ($(CONFIG_LINUX26),y)
481 @$(MAKE) bin NO_SAMBA=y SLIM=y NO_CIFS=y NO_JFFS=y NO_ZEBRA=y B=D BUILD_DESC="Lite" USB="USB"
482 else
483 @$(MAKE) bin NO_SAMBA=y SLIM=y B=D BUILD_DESC="Lite" USB="USB"
484 endif
486 ## Make the "normal (with NTFS support) + VPN" build
488 ifeq ($(CONFIG_LINUX26),y)
489 @$(MAKE) bin OPENVPN=y NTFS=y BBEXTRAS=y USBEXTRAS=y EBTABLES=y NO_LIBOPT=y MEDIASRV=y B=E BUILD_DESC="$(VPN)" USB="USB"
490 else
491 @$(MAKE) bin OPENVPN=y NTFS=y B=E BUILD_DESC="$(VPN)" USB="USB"
492 endif
494 ## Make the "normal with Extras and NTFS" build
496 ifeq ($(CONFIG_LINUX26),y)
497 @$(MAKE) bin NTFS=y BBEXTRAS=y USBEXTRAS=y EBTABLES=y NO_LIBOPT=y MEDIASRV=y B=M BUILD_DESC="Ext" USB="USB"
498 else
499 @$(MAKE) bin NTFS=y BBEXTRAS=y USBEXTRAS=y B=M BUILD_DESC="Ext" USB="USB"
500 endif
502 ## Make the "No USB" build
504 ifeq ($(CONFIG_LINUX26),y)
505 @$(MAKE) bin BBEXTRAS=y NO_JFFS=y B=S BUILD_DESC="Std" USB=""
506 else
507 @$(MAKE) bin BBEXTRAS=y B=S BUILD_DESC="Std" USB=""
508 endif
510 ## Make the "Mini: no USB, no CIFS, no JFFS" build
512 @$(MAKE) bin NO_JFFS=y NO_CIFS=y SLIM=y B=F BUILD_DESC="Mini" USB=""
514 ## Make the "VPN witn no USB support" build
516 ifeq ($(CONFIG_LINUX26),y)
517 @$(MAKE) bin OPENVPN=y NO_JFFS=y B=V BUILD_DESC="$(VPN)" USB=""
518 else
519 @$(MAKE) bin OPENVPN=y BBEXTRAS=y B=V BUILD_DESC="$(VPN)" USB=""
520 endif
522 ## Make Mips32r2 Extras build (Asus RT-N16, Netgear WNR3500L)
523 r2m:
524 @$(MAKE) m MIPS32=r2
526 ## Make Mips32r2 USB+VPN build
527 r2e:
528 @$(MAKE) e MIPS32=r2
530 ## Make Mips32r2 "no USB" build (RT-N12, WRT160Nv3)
531 r2s:
532 @$(MAKE) s MIPS32=r2
534 ## Make Mips32r2 "no USB" VPN build
535 r2v:
536 @$(MAKE) v MIPS32=r2
538 setprofile:
539 echo '#ifndef TOMATO_PROFILE' > router/shared/tomato_profile.h
540 echo '#define TOMATO_$(N) 1' >> router/shared/tomato_profile.h
541 echo '#define PROFILE_G 1' >> router/shared/tomato_profile.h
542 echo '#define PROFILE_N 2' >> router/shared/tomato_profile.h
543 echo '#define TOMATO_PROFILE PROFILE_$(N)' >> router/shared/tomato_profile.h
544 echo '#define TOMATO_PROFILE_NAME "$(N)"' >> router/shared/tomato_profile.h
545 echo '#define TOMATO_BUILD_NAME "$(B)"' >> router/shared/tomato_profile.h
546 echo '#define TOMATO_BUILD_DESC "$(DESC)"' >> router/shared/tomato_profile.h
547 echo '#endif' >> router/shared/tomato_profile.h
549 echo 'TOMATO_$(N) = 1' > tomato_profile.mak
550 echo 'PROFILE_G = 1' >> tomato_profile.mak
551 echo 'PROFILE_N = 2' >> tomato_profile.mak
552 echo 'TOMATO_PROFILE = $$(PROFILE_$(N))' >> tomato_profile.mak
553 echo 'TOMATO_PROFILE_NAME = "$(N)"' >> tomato_profile.mak
554 echo 'TOMATO_BUILD = "$(B)"' >> tomato_profile.mak
555 echo 'TOMATO_BUILD_NAME = "$(B)"' >> tomato_profile.mak
556 echo 'TOMATO_BUILD_DESC = "$(DESC)"' >> tomato_profile.mak
557 echo 'TOMATO_PROFILE_L = $(lowercase_N)' >> tomato_profile.mak
558 echo 'TOMATO_PROFILE_U = $(uppercase_N)' >> tomato_profile.mak
559 echo 'TOMATO_BUILD_USB = "$(USB)"' >> tomato_profile.mak
562 # Note that changes to variables in tomato_profile.mak don't
563 # get propogated to this invocation of make!
564 @echo ""
565 @echo "Using $(N) profile, $(B) build config."
566 @echo ""
568 @cd $(LINUXDIR) ; \
569 rm -f config_current ; \
570 ln -s config_$(lowercase_B) config_current ; \
571 cp -f config_current .config
573 @cd router/busybox && \
574 rm -f config_current ; \
575 ln -s config_$(lowercase_B) config_current ; \
576 cp config_current .config
578 @cd router ; \
579 rm -f config_current ; \
580 ln -s config_$(lowercase_B) config_current ; \
581 cp config_current .config
583 @$(MAKE) -C router oldconfig
585 cleanlibc:
586 # @$(MAKE) -C ../../tools-src/uClibc clean
588 libc: cleanlibc
589 # @$(MAKE) -C ../../tools-src/uClibc
590 # @$(MAKE) -C ../../tools-src/uClibc install
592 help:
593 @echo "a A build (standard)"
594 @echo "b B build (standard minus SSH)"
595 @echo "c C build (standard minus CIFS)"
596 @echo "d D build (standard minus Samba server)"
597 @echo "m M build (standard plus extra utilities and NTFS support)"
598 ifeq ($(CONFIG_LINUX26),y)
599 @echo "e E build (standard plus VPN, extra utilities and NTFS support)"
600 else
601 @echo "e E build (standard plus VPN and NTFS support)"
602 endif
603 @echo "s S build (no USB support)"
604 @echo "f F build (no USB support minus JFFS and CIFS)"
605 @echo "v V build (VPN with no USB support)"
606 ifeq ($(CONFIG_LINUX26),y)
607 @echo "r2m MIPS Release 2 M build (standard plus extras)"
608 @echo "r2e MIPS Release 2 E build (standard plus VPN and extras)"
609 @echo "r2v MIPS Release 2 V build (VPN with no USB support)"
610 @echo "r2s MIPS Release 2 S build (no USB support)"
611 endif
612 @echo "..etc.. other build configs"
613 @echo "clean -C router clean"
614 @echo "cleanimage rm -rf image"
615 @echo "cleantools clean btools, mksquashfs"
616 @echo "cleankernel -C Linux distclean (but preserves .config)"
617 @echo "distclean distclean of Linux & busybox (but preserve .configs)"
618 @echo "prepk -C Linux oldconfig dep"
619 @echo "libc -C uClibc clean, all, install"
621 .PHONY: all clean distclean cleanimage cleantools cleankernel prepk what setprofile libc help
622 .PHONY: a b c d m Makefile allversions tomato_profile.mak