Build: top-level Makefile cosmetics and fixes, adjust Busybox config
[tomato.git] / release / src / Makefile
blobaebeebf43c0e928b817cac74142ff1cdb71c9b1d
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 tomato_ver:
63 @echo ""
64 @btools/uversion.pl --gen $(V1) $(V2) $(ND) $(current_BUILD_USB) $(current_BUILD_DESC)
66 ifeq ($(TOMATO_BUILD),)
68 all:
69 $(MAKE) libc
70 $(MAKE) a
72 else
74 all: tomato_ver
75 @echo ""
76 @echo "Building Tomato $(ND) $(current_BUILD_USB) $(current_TOMATO_VER).$(V1)$(V2) $(current_BUILD_DESC) $(current_BUILD_NAME) with $(TOMATO_PROFILE_NAME) Profile"
78 @echo ""
79 @echo ""
81 @-mkdir image
82 @$(MAKE) -C router all
83 @$(MAKE) -C router install
84 @$(MAKE) -C btools
86 @rm -f image/tomato-$(ND)$(current_BUILD_USB)-$(current_TOMATO_VER).$(V1)$(V2)-$(current_BUILD_DESC).trx
87 @echo "" >>fpkg.log
88 @echo "***********************" `date` "************************" >>fpkg.log
89 @cat router/shared/tomato_version >>fpkg.log
90 @echo "" >>fpkg.log
91 @cat router/target.info >>fpkg.log
92 ifeq ($(wildcard include/bcm20xx.h),)
93 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -i router/mipsel-uclibc/target.image \
94 -t image/tomato.trx \
95 -l W54G,image/WRT54G_WRT54GL.bin \
96 -l W54S,image/WRT54GS.bin \
97 -l W54s,image/WRT54GSv4.bin \
98 -l W54U,image/WRTSL54GS.bin \
99 -m 0x10577050,image/WR850G.bin \
100 | tee -a fpkg.log
101 else
102 @btools/fpkg -i lzma-loader/loader.gz -i $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -i router/mipsel-uclibc/target.image \
103 -t image/tomato-$(ND)$(current_BUILD_USB)-$(current_TOMATO_VER).$(V1)$(V2)-$(current_BUILD_DESC).trx | tee -a fpkg.log
104 endif
106 @cp fpkg.log image/fpkg-$(V1)$(V2).log
107 @echo ""
108 @echo "-----------------"
109 @echo `cat router/shared/tomato_version` " ready"
110 @echo "-----------------"
111 ifneq ($(NOVERSION),1)
112 @cp router/shared/tomato_version router/shared/tomato_version_last
113 @btools/uversion.pl --bump
114 endif
115 endif
119 clean:
120 @touch router/.config
121 @rm -f router/config_[a-z]
122 @rm -f router/busybox/config_[a-z]
123 @$(MAKE) -C router $@
124 @-rmdir router/mipsel-uclibc
126 cleanimage:
127 @rm -f fpkg.log
128 @rm -fr image/*
129 @rm -f router/.config
130 @touch router/.config
131 @-mkdir image
133 cleantools:
134 @$(MAKE) -C $(LINUXDIR)/scripts/squashfs clean
135 @$(MAKE) -C btools clean
137 cleankernel:
138 @cd $(LINUXDIR) && \
139 mv .config save-config && \
140 $(MAKE) distclean || true; \
141 cp -p save-config .config || true
143 distclean: clean cleanimage cleankernel cleantools cleanlibc
144 ifneq ($(INSIDE_MAK),1)
145 @$(MAKE) -C router $@ INSIDE_MAK=1
146 endif
147 mv router/busybox/.config busybox-saved-config || true
148 @$(MAKE) -C router/busybox distclean
149 @rm -f router/busybox/config_current
150 @cp -p busybox-saved-config router/busybox/.config || true
151 @cp -p router/busybox/.config router/busybox/config_current || true
152 @rm -f router/config_current
153 @rm -f router/.config.cmd router/.config.old router/.config
154 @rm -f router/libfoo_xref.txt
155 @rm -f tomato_profile.mak router/shared/tomato_profile.h
156 @touch tomato_profile.mak
157 @touch router/shared/tomato_profile.h
160 prepk:
161 @cd $(LINUXDIR) ; \
162 rm -f config_current ; \
163 ln -s config_base config_current ; \
164 cp -f config_current .config
165 $(MAKE) -C $(LINUXDIR) oldconfig dep
167 what:
168 @echo ""
169 @echo "$(current_BUILD_DESC)-$(current_BUILD_NAME)-$(TOMATO_PROFILE_NAME) Profile"
170 @echo ""
173 # The methodology for making the different builds is to
174 # copy the "base" config file to the "target" config file in
175 # the appropriate directory, and then edit it by removing and
176 # inserting the desired configuration lines.
177 # You can't just delete the "whatever=y" line, you must have
178 # a "...is not set" line, or the make oldconfig will stop and ask
179 # what to do.
181 # $(1) - router/config_$@
183 define RouterOptions
184 @( \
185 if [ "$(CONFIG_LINUX26)" = "y" ] || [ "$(SAMBA3)" = "y" ]; then \
186 sed -i "/TCONFIG_SAMBA3/d" $(1); \
187 echo "TCONFIG_SAMBA3=y" >>$(1); \
188 fi; \
189 if [ "$(NO_JFFS)" = "y" ]; then \
190 sed -i "/TCONFIG_JFFS2/d" $(1); \
191 echo "# TCONFIG_JFFS2 is not set" >>$(1); \
192 fi; \
193 if [ "$(NO_CIFS)" = "y" ]; then \
194 sed -i "/TCONFIG_CIFS/d" $(1); \
195 echo "# TCONFIG_CIFS is not set" >>$(1); \
196 fi; \
198 endef
200 # $(1) - router/busybox/config_$@
202 define BusyboxExtraOptions
203 @sed -i "/CONFIG_UNZIP/d" $(1)
204 @echo "CONFIG_UNZIP=y" >>$(1)
205 @sed -i "/CONFIG_FEATURE_LS_COLOR/d" $(1)
206 @echo "CONFIG_FEATURE_LS_COLOR=y" >>$(1)
207 @sed -i "/CONFIG_FEATURE_LS_COLOR_IS_DEFAULT/d" $(1)
208 @echo "CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y" >>$(1)
209 @sed -i "/CONFIG_FEATURE_SORT_BIG/d" $(1)
210 @echo "CONFIG_FEATURE_SORT_BIG=y" >>$(1)
211 @( \
212 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
213 sed -i "/CONFIG_FEATURE_WGET_STATUSBAR/d" $(1); \
214 echo "CONFIG_FEATURE_WGET_STATUSBAR=y" >>$(1); \
215 sed -i "/CONFIG_FEATURE_VERBOSE_USAGE/d" $(1); \
216 echo "CONFIG_FEATURE_VERBOSE_USAGE=y" >>$(1); \
217 sed -i "/CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE/d" $(1); \
218 echo "CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=512" >>$(1); \
219 fi; \
221 endef
223 define BusyboxExtraUSBOptions
224 @sed -i "/CONFIG_E2FSCK/d" $(1)
225 @echo "CONFIG_E2FSCK=y" >>$(1)
226 @sed -i "/CONFIG_MKE2FS/d" $(1)
227 @echo "CONFIG_MKE2FS=y" >>$(1)
228 @sed -i "/CONFIG_FDISK/d" $(1)
229 @echo "CONFIG_FDISK=y" >>$(1)
230 @sed -i "/CONFIG_FEATURE_FDISK_WRITABLE/d" $(1)
231 @echo "CONFIG_FEATURE_FDISK_WRITABLE=y" >>$(1)
232 @sed -i "/CONFIG_MKFS_VFAT/d" $(1)
233 @echo "CONFIG_MKFS_VFAT=y" >>$(1)
234 @sed -i "/CONFIG_MKSWAP/d" $(1)
235 @echo "CONFIG_MKSWAP=y" >>$(1)
236 @sed -i "/CONFIG_FLOCK/d" $(1)
237 @echo "CONFIG_FLOCK=y" >>$(1)
238 @( \
239 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
240 sed -i "/CONFIG_LSUSB/d" $(1); \
241 echo "CONFIG_LSUSB=y" >>$(1); \
242 fi; \
244 endef
246 define BusyboxNoUSBOptions
247 @sed -i "/CONFIG_FEATURE_MOUNT_LOOP/d" $(1)
248 @echo "# CONFIG_FEATURE_MOUNT_LOOP is not set" >>$(1)
249 @sed -i "/CONFIG_FEATURE_DEVFS/d" $(1)
250 @echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1)
251 @sed -i "/CONFIG_FEATURE_MOUNT_LABEL/d" $(1)
252 @echo "# CONFIG_FEATURE_MOUNT_LABEL is not set" >>$(1)
253 @sed -i "/CONFIG_FEATURE_MOUNT_FSTAB/d" $(1)
254 @echo "# CONFIG_FEATURE_MOUNT_FSTAB is not set" >>$(1)
255 @sed -i "/CONFIG_VOLUMEID/d" $(1)
256 @echo "# CONFIG_VOLUMEID is not set" >>$(1)
257 @sed -i "/CONFIG_BLKID/d" $(1)
258 @echo "# CONFIG_BLKID is not set" >>$(1)
259 @sed -i "/CONFIG_SWAPONOFF/d" $(1)
260 @echo "# CONFIG_SWAPONOFF is not set" >>$(1)
261 endef
263 define BusyboxOptions
264 @( \
265 if [ "$(CONFIG_LINUX26)" = "y" ]; then \
266 sed -i "/CONFIG_FEATURE_2_4_MODULES/d" $(1); \
267 echo "# CONFIG_FEATURE_2_4_MODULES is not set" >>$(1); \
268 sed -i "/CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT/d" $(1); \
269 echo "CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y" >>$(1); \
270 sed -i "/CONFIG_FEATURE_DEVFS/d" $(1); \
271 echo "# CONFIG_FEATURE_DEVFS is not set" >>$(1); \
272 sed -i "/CONFIG_MKNOD/d" $(1); \
273 echo "CONFIG_MKNOD=y" >>$(1); \
274 fi; \
275 if [ "$(NO_CIFS)" = "y" ]; then \
276 sed -i "/CONFIG_FEATURE_MOUNT_CIFS/d" $(1); \
277 echo "# CONFIG_FEATURE_MOUNT_CIFS is not set" >>$(1); \
278 fi; \
280 endef
282 # $(1) - linux/linux[-2.6]/config_$@
284 ifeq ($(CONFIG_LINUX26),y)
285 define KernelConfigMips
286 @( \
287 if [ "$(MIPS32)" = "r2" ]; then \
288 sed -i "/CONFIG_CPU_MIPS32_R1/d" $(1); \
289 echo "# CONFIG_CPU_MIPS32_R1 is not set" >>$(1); \
290 sed -i "/CONFIG_CPU_MIPS32_R2/d" $(1); \
291 echo "CONFIG_CPU_MIPS32_R2=y" >>$(1); \
292 sed -i "/CONFIG_CPU_MIPSR1/d" $(1); \
293 echo "CONFIG_CPU_MIPSR2=y" >>$(1); \
294 sed -i "/CONFIG_HIGHMEM=/d" $(1); \
295 echo "CONFIG_HIGHMEM=y" >>$(1); \
296 sed -i "/CONFIG_FLATMEM_MANUAL/d" $(1); \
297 echo "# CONFIG_FLATMEM_MANUAL is not set" >>$(1); \
298 sed -i "/CONFIG_SPARSEMEM_MANUAL/d" $(1); \
299 echo "CONFIG_SPARSEMEM_MANUAL=y" >>$(1); \
300 sed -i "/CONFIG_SPARSEMEM=/d" $(1); \
301 echo "CONFIG_SPARSEMEM=y" >>$(1); \
302 sed -i "/CONFIG_SPARSEMEM_EXTREME/d" $(1); \
303 echo "CONFIG_SPARSEMEM_EXTREME=y" >>$(1); \
304 sed -i "/CONFIG_FLATMEM=/d" $(1); \
305 echo "# CONFIG_FLATMEM is not set" >>$(1); \
306 sed -i "/CONFIG_FLAT_NODE_MEM_MAP/d" $(1); \
307 echo "# CONFIG_FLAT_NODE_MEM_MAP is not set" >>$(1); \
308 sed -i "/CONFIG_HAVE_MEMORY_PRESENT/d" $(1); \
309 echo "CONFIG_HAVE_MEMORY_PRESENT=y" >>$(1); \
310 else \
311 sed -i "/CONFIG_HIGHMEM=/d" $(1); \
312 echo "# CONFIG_HIGHMEM is not set" >>$(1); \
313 sed -i "/CONFIG_FLATMEM_MANUAL/d" $(1); \
314 echo "CONFIG_FLATMEM_MANUAL=y" >>$(1); \
315 sed -i "/CONFIG_SPARSEMEM=/d" $(1); \
316 echo "# CONFIG_SPARSEMEM is not set" >>$(1); \
317 sed -i "/CONFIG_SPARSEMEM_MANUAL/d" $(1); \
318 echo "# CONFIG_SPARSEMEM_MANUAL is not set" >>$(1); \
319 sed -i "/CONFIG_SPARSEMEM_EXTREME/d" $(1); \
320 echo "# CONFIG_SPARSEMEM_EXTREME is not set" >>$(1); \
321 sed -i "/CONFIG_FLATMEM=/d" $(1); \
322 echo "CONFIG_FLATMEM=y" >>$(1); \
323 sed -i "/CONFIG_FLAT_NODE_MEM_MAP/d" $(1); \
324 echo "CONFIG_FLAT_NODE_MEM_MAP=y" >>$(1); \
325 sed -i "/CONFIG_HAVE_MEMORY_PRESENT/d" $(1); \
326 echo "# CONFIG_HAVE_MEMORY_PRESENT is not set" >>$(1); \
327 fi; \
328 if [ "$(BCM57)" = "y" ]; then \
329 sed -i "/CONFIG_BCM57XX/d" $(1); \
330 echo "CONFIG_BCM57XX=m" >>$(1); \
331 fi; \
332 if [ "$(JFFSv1)" = "y" ]; then \
333 sed -i "/CONFIG_JFFS_FS/d" $(1); \
334 echo "CONFIG_JFFS_FS=m" >>$(1); \
335 sed -i "/CONFIG_JFFS_FS_VERBOSE/d" $(1); \
336 echo "CONFIG_JFFS_FS_VERBOSE=0" >>$(1); \
337 sed -i "/CONFIG_JFFS_PROC_FS/d" $(1); \
338 echo "# CONFIG_JFFS_PROC_FS is not set" >>$(1); \
339 sed -i "/CONFIG_JFFS2_FS/d" $(1); \
340 echo "# CONFIG_JFFS2_FS is not set" >>$(1); \
341 fi; \
343 endef
344 else
345 define KernelConfigMips
346 # nothing for kernel 2.4
347 endef
348 endif
350 ## Make the "normal" build
352 @cp router/config_base router/config_$@
353 @cp router/busybox/config_base router/busybox/config_$@
354 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
356 $(call RouterOptions, router/config_$@)
357 $(call KernelConfigMips, $(LINUXDIR)/config_$@)
358 $(call BusyboxOptions, router/busybox/config_$@)
360 @$(MAKE) setprofile N=$(TPROFILE) B=A DESC="Std" USB="USB"
361 @$(MAKE) all
363 ## Make the "normal but without SSH" build
365 @cp router/config_base router/config_$@
366 @cp router/busybox/config_base router/busybox/config_$@
367 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
369 @sed -i "/TCONFIG_SSH/d" router/config_$@
370 @echo "# TCONFIG_SSH is not set" >>router/config_$@
372 $(call RouterOptions, router/config_$@)
373 $(call KernelConfigMips, $(LINUXDIR)/config_$@)
374 $(call BusyboxOptions, router/busybox/config_$@)
376 @$(MAKE) setprofile N=$(TPROFILE) B=B DESC="No SSH" USB="USB"
377 @$(MAKE) all
379 ## Make the "normal but without CIFS" build
381 @cp router/config_base router/config_$@
382 @cp router/busybox/config_base router/busybox/config_$@
383 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
385 @sed -i "/TCONFIG_CIFS/d" router/config_$@
386 @echo "# TCONFIG_CIFS is not set" >>router/config_$@
388 $(call RouterOptions, router/config_$@)
389 $(call KernelConfigMips, $(LINUXDIR)/config_$@)
390 $(call BusyboxOptions, router/busybox/config_$@)
392 @sed -i "/CONFIG_FEATURE_MOUNT_CIFS/d" router/busybox/config_$@
393 @echo "# CONFIG_FEATURE_MOUNT_CIFS is not set" >>router/busybox/config_$@
395 @$(MAKE) setprofile N=$(TPROFILE) B=C DESC="No CIFS" USB="USB"
396 @$(MAKE) all
398 ## Make the "normal but without SAMBA" build
400 @cp router/config_base router/config_$@
401 @cp router/busybox/config_base router/busybox/config_$@
402 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
404 @sed -i "/TCONFIG_SAMBASRV/d" router/config_$@
405 @echo "# TCONFIG_SAMBASRV is not set" >>router/config_$@
406 ifeq ($(CONFIG_LINUX26),y)
407 @sed -i "/TCONFIG_CIFS/d" router/config_$@
408 @echo "# TCONFIG_CIFS is not set" >>router/config_$@
410 @sed -i "/CONFIG_FEATURE_MOUNT_CIFS/d" router/busybox/config_$@
411 @echo "# CONFIG_FEATURE_MOUNT_CIFS is not set" >>router/busybox/config_$@
413 @sed -i "/TCONFIG_JFFS2/d" router/config_$@
414 @echo "# TCONFIG_JFFS2 is not set" >>router/config_$@
415 @sed -i "/TCONFIG_ZEBRA/d" router/config_$@
416 @echo "# TCONFIG_ZEBRA is not set" >>router/config_$@
417 endif
419 $(call RouterOptions, router/config_$@)
420 $(call KernelConfigMips, $(LINUXDIR)/config_$@)
421 $(call BusyboxOptions, router/busybox/config_$@)
423 @sed -i "/CONFIG_FEATURE_MOUNT_LOOP/d" router/busybox/config_$@
424 @echo "# CONFIG_FEATURE_MOUNT_LOOP is not set" >>router/busybox/config_$@
425 @sed -i "/CONFIG_AWK/d" router/busybox/config_$@
426 @echo "# CONFIG_AWK is not set" >>router/busybox/config_$@
427 @sed -i "/CONFIG_FEATURE_DEVFS/d" router/busybox/config_$@
428 @echo "# CONFIG_FEATURE_DEVFS is not set" >>router/busybox/config_$@
429 @sed -i "/CONFIG_BLKID/d" router/busybox/config_$@
430 @echo "# CONFIG_BLKID is not set" >>router/busybox/config_$@
431 @sed -i "/CONFIG_ARPING/d" router/busybox/config_$@
432 @echo "# CONFIG_ARPING is not set" >>router/busybox/config_$@
434 @$(MAKE) setprofile N=$(TPROFILE) B=D DESC="Lite" USB="USB"
435 @$(MAKE) all
437 ## Make the "normal with Extras + VPN" build
439 @cp router/config_base router/config_$@
440 @cp router/busybox/config_base router/busybox/config_$@
441 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
443 @sed -i "/TCONFIG_LZO/d" router/config_$@
444 @sed -i "/TCONFIG_OPENVPN/d" router/config_$@
445 @echo "TCONFIG_LZO=y" >>router/config_$@
446 @echo "TCONFIG_OPENVPN=y" >>router/config_$@
447 @sed -i "/TCONFIG_USB_EXTRAS/d" router/config_$@
448 @echo "TCONFIG_USB_EXTRAS=y" >>router/config_$@
449 @sed -i "/TCONFIG_NTFS/d" router/config_$@
450 @echo "TCONFIG_NTFS=y" >>router/config_$@
452 $(call RouterOptions, router/config_$@)
453 $(call KernelConfigMips, $(LINUXDIR)/config_$@)
454 $(call BusyboxExtraOptions, router/busybox/config_$@)
455 $(call BusyboxExtraUSBOptions, router/busybox/config_$@)
456 $(call BusyboxOptions, router/busybox/config_$@)
458 @$(MAKE) setprofile N=$(TPROFILE) B=E DESC=$(VPN) USB="USB"
459 @$(MAKE) all
461 ## Make the "normal with Extras" build
463 @cp router/config_base router/config_$@
464 @cp router/busybox/config_base router/busybox/config_$@
465 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
467 @sed -i "/TCONFIG_USB_EXTRAS/d" router/config_$@
468 @echo "TCONFIG_USB_EXTRAS=y" >>router/config_$@
469 @sed -i "/TCONFIG_NTFS/d" router/config_$@
470 @echo "TCONFIG_NTFS=y" >>router/config_$@
472 $(call RouterOptions, router/config_$@)
473 $(call KernelConfigMips, $(LINUXDIR)/config_$@)
474 $(call BusyboxExtraOptions, router/busybox/config_$@)
475 $(call BusyboxExtraUSBOptions, router/busybox/config_$@)
476 $(call BusyboxOptions, router/busybox/config_$@)
478 @$(MAKE) setprofile N=$(TPROFILE) B=M DESC="Ext" USB="USB"
479 @$(MAKE) all
481 ## Make the "No USB" build
483 @cp router/config_base router/config_$@
484 @cp router/busybox/config_base router/busybox/config_$@
485 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
487 @sed -i "/TCONFIG_SAMBASRV/d" router/config_$@
488 @echo "# TCONFIG_SAMBASRV is not set" >>router/config_$@
489 @sed -i "/TCONFIG_FTP/d" router/config_$@
490 @echo "# TCONFIG_FTP is not set" >>router/config_$@
491 @sed -i "/TCONFIG_USB/d" router/config_$@
492 @echo "# TCONFIG_USB is not set" >>router/config_$@
494 $(call RouterOptions, router/config_$@)
495 $(call KernelConfigMips, $(LINUXDIR)/config_$@)
496 ifneq ($(CONFIG_LINUX26),y)
497 $(call BusyboxExtraOptions, router/busybox/config_$@)
498 endif
499 $(call BusyboxNoUSBOptions, router/busybox/config_$@)
500 $(call BusyboxOptions, router/busybox/config_$@)
502 @$(MAKE) setprofile N=$(TPROFILE) B=S DESC="Std" USB=""
503 @$(MAKE) all
505 ## Make the "VPN witn no USB support" build
507 @cp router/config_base router/config_$@
508 @cp router/busybox/config_base router/busybox/config_$@
509 @cp $(LINUXDIR)/config_base $(LINUXDIR)/config_$@
511 @sed -i "/TCONFIG_SAMBASRV/d" router/config_$@
512 @echo "# TCONFIG_SAMBASRV is not set" >>router/config_$@
513 @sed -i "/TCONFIG_FTP/d" router/config_$@
514 @echo "# TCONFIG_FTP is not set" >>router/config_$@
515 @sed -i "/TCONFIG_USB/d" router/config_$@
516 @echo "# TCONFIG_USB is not set" >>router/config_$@
517 @sed -i "/TCONFIG_LZO/d" router/config_$@
518 @sed -i "/TCONFIG_OPENVPN/d" router/config_$@
519 @echo "TCONFIG_LZO=y" >>router/config_$@
520 @echo "TCONFIG_OPENVPN=y" >>router/config_$@
522 $(call RouterOptions, router/config_$@)
523 $(call KernelConfigMips, $(LINUXDIR)/config_$@)
524 ifneq ($(CONFIG_LINUX26),y)
525 $(call BusyboxExtraOptions, router/busybox/config_$@)
526 endif
527 $(call BusyboxNoUSBOptions, router/busybox/config_$@)
528 $(call BusyboxOptions, router/busybox/config_$@)
530 @$(MAKE) setprofile N=$(TPROFILE) B=V DESC=$(VPN) USB=""
531 @$(MAKE) all
533 ## Make Mips32r2 Extras build (Asus RT-N16, Netgear WNR3500L)
534 r2m:
535 @$(MAKE) m MIPS32=r2 BCM57=y
537 ## Make Mips32r2 USB+VPN build
538 r2e:
539 @$(MAKE) e MIPS32=r2 BCM57=y
541 ## Make Mips32r2 "no USB" build (RT-N12, WRT160Nv3)
542 r2s:
543 @$(MAKE) s MIPS32=r2 NO_JFFS=y
545 ## Make Mips32r2 "no USB" VPN build
546 r2v:
547 @$(MAKE) v MIPS32=r2 NO_JFFS=y
549 setprofile:
550 echo '#ifndef TOMATO_PROFILE' > router/shared/tomato_profile.h
551 echo '#define TOMATO_$(N) 1' >> router/shared/tomato_profile.h
552 echo '#define PROFILE_G 1' >> router/shared/tomato_profile.h
553 echo '#define PROFILE_N 2' >> router/shared/tomato_profile.h
554 echo '#define TOMATO_PROFILE PROFILE_$(N)' >> router/shared/tomato_profile.h
555 echo '#define TOMATO_PROFILE_NAME "$(N)"' >> router/shared/tomato_profile.h
556 echo '#define TOMATO_BUILD_NAME "$(B)"' >> router/shared/tomato_profile.h
557 echo '#define TOMATO_BUILD_DESC "$(DESC)"' >> router/shared/tomato_profile.h
558 echo '#endif' >> router/shared/tomato_profile.h
560 echo 'TOMATO_$(N) = 1' > tomato_profile.mak
561 echo 'PROFILE_G = 1' >> tomato_profile.mak
562 echo 'PROFILE_N = 2' >> tomato_profile.mak
563 echo 'TOMATO_PROFILE = $$(PROFILE_$(N))' >> tomato_profile.mak
564 echo 'TOMATO_PROFILE_NAME = "$(N)"' >> tomato_profile.mak
565 echo 'TOMATO_BUILD = "$(B)"' >> tomato_profile.mak
566 echo 'TOMATO_BUILD_NAME = "$(B)"' >> tomato_profile.mak
567 echo 'TOMATO_BUILD_DESC = "$(DESC)"' >> tomato_profile.mak
568 echo 'TOMATO_PROFILE_L = $(lowercase_N)' >> tomato_profile.mak
569 echo 'TOMATO_PROFILE_U = $(uppercase_N)' >> tomato_profile.mak
570 echo 'TOMATO_BUILD_USB = "$(USB)"' >> tomato_profile.mak
573 # Note that changes to variables in tomato_profile.mak don't
574 # get propogated to this invocation of make!
575 @echo ""
576 @echo "Using $(N) profile, $(B) build config."
577 @echo ""
579 @cd $(LINUXDIR) ; \
580 rm -f config_current ; \
581 ln -s config_$(lowercase_B) config_current ; \
582 cp -f config_current .config
584 @cd router/busybox && \
585 rm -f config_current ; \
586 ln -s config_$(lowercase_B) config_current ; \
587 cp config_current .config
589 @cd router ; \
590 rm -f config_current ; \
591 ln -s config_$(lowercase_B) config_current ; \
592 cp config_current .config
594 @$(MAKE) -C router oldconfig
596 cleanlibc:
597 # @$(MAKE) -C ../../tools-src/uClibc clean
599 libc: cleanlibc
600 # @$(MAKE) -C ../../tools-src/uClibc
601 # @$(MAKE) -C ../../tools-src/uClibc install
603 help:
604 @echo "a A build (standard)"
605 @echo "b B build (standard minus SSH)"
606 @echo "c C build (standard minus CIFS)"
607 @echo "d D build (standard minus Samba server)"
608 @echo "m M build (standard plus extra utilities)"
609 @echo "e E build (standard plus VPN and extra utilities)"
610 @echo "s S build (no USB support)"
611 @echo "v V build (VPN with no USB support)"
612 ifeq ($(CONFIG_LINUX26),y)
613 @echo "r2m MIPS Release 2 M build (standard plus extras)"
614 @echo "r2e MIPS Release 2 E build (standard plus VPN and extras)"
615 @echo "r2v MIPS Release 2 V build (VPN with no USB support)"
616 @echo "r2s MIPS Release 2 S build (no USB support)"
617 endif
618 @echo "..etc.. other build configs"
619 @echo "clean -C router clean"
620 @echo "cleanimage rm -rf image"
621 @echo "cleantools clean btools, mksquashfs"
622 @echo "cleankernel -C Linux distclean (but preserves .config)"
623 @echo "distclean distclean of Linux & busybox (but preserve .configs)"
624 @echo "prepk -C Linux oldconfig dep"
625 @echo "libc -C uClibc clean, all, install"
627 .PHONY: all clean distclean cleanimage cleantools cleankernel prepk what setprofile libc help
628 .PHONY: a b c d m Makefile allversions tomato_profile.mak