Build process echo fix
[tomato.git] / release / src / Makefile
blob682c6a2aa4ff3f8b1420c5d9bed16ac6e98fcb5e
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 router/shared/tomato_version` " ready"
62 @echo "-----------------"
64 ifneq ($(NOVERSION),1)
65 @cp router/shared/tomato_version router/shared/tomato_version_last
66 @btools/uversion.pl --bump
67 endif
70 clean: cleanimage
71 @$(MAKE) -C router $@
72 @rm -f fpkg.log
74 cleanimage:
75 @rm -rf image
77 cleantools:
78 @$(MAKE) -C linux/linux/scripts/squashfs clean
79 @$(MAKE) -C btools clean
81 cleankernel:
82 @cd linux/linux && \
83 mv .config save-config && \
84 $(MAKE) distclean; \
85 mv save-config .config
87 distclean: clean cleankernel cleantools cleanlibc
88 ifneq ($(INSIDE_MAK),1)
89 @$(MAKE) -C router $@ INSIDE_MAK=1
90 endif
91 @rm -f router/config_current
92 @rm -f router/.config.cmd router/.config.old
93 @rm -f router/libfoo_xref.txt
94 @rm -f tomato_profile.mak router/shared/tomato_profile.h
96 prepk:
97 $(MAKE) -C linux/linux oldconfig dep
99 what:
100 @echo ""
101 @echo "$(TOMATO_PROFILE_NAME) Profile\n"
103 endif
107 @$(MAKE) setprofile U=G L=g N=G
109 setprofile:
110 @echo "#ifndef TOMATO_PROFILE" > router/shared/tomato_profile.h
111 @echo "#define TOMATO_$(U) 1" >> router/shared/tomato_profile.h
112 @echo "#define PROFILE_G 1" >> router/shared/tomato_profile.h
113 @echo "#define PROFILE_N 2" >> router/shared/tomato_profile.h
114 @echo "#define TOMATO_PROFILE PROFILE_$(U)" >> router/shared/tomato_profile.h
115 @echo "#define TOMATO_PROFILE_NAME \"$(N)\"" >> router/shared/tomato_profile.h
116 @echo "#endif" >> router/shared/tomato_profile.h
118 @echo "TOMATO_$(U) = 1" > tomato_profile.mak
119 @echo "PROFILE_G = 1" >> tomato_profile.mak
120 @echo "PROFILE_N = 2" >> tomato_profile.mak
121 @echo "TOMATO_PROFILE = \$$(PROFILE_$(U))" >> tomato_profile.mak
122 @echo "TOMATO_PROFILE_NAME = \"$(N)\"" >> tomato_profile.mak
123 @echo "TOMATO_PROFILE_L = $(L)" >> tomato_profile.mak
124 @echo "TOMATO_PROFILE_U = $(U)" >> tomato_profile.mak
126 @cd router && \
127 [ -s .config ] && cat .config > config_current; \
128 rm -f config_current && \
129 ln -s config_$(L) config_current && \
130 cp config_$(L) .config
131 @$(MAKE) -C router oldconfig
133 @echo ""
134 @echo "Using $(N) profile."
135 @echo ""
138 cleanlibc:
139 @$(MAKE) -C ../../tools-src/uClibc clean
141 libc: cleanlibc
142 @$(MAKE) -C ../../tools-src/uClibc
143 @$(MAKE) -C ../../tools-src/uClibc install
145 echotest:
146 @( echo -e foo | grep "\-e foo" ) && echo bar || echo foo
148 help:
149 @echo "g use G profile"
150 @echo "clean -C router clean"
151 @echo "cleanimage rm -rf image"
152 @echo "cleantools clean btools, mksquashfs"
153 @echo "cleankernel -C linux/linux distclean (but preserves .config)"
154 @echo "prepk -C linux/linux oldconfig dep"
155 @echo "libc -C uClibc clean, all, install"
157 .PHONY: all clean distclean cleanimage cleantools cleankernel prepk what setprofile libc help
158 .PHONY: g