Tomato 1.26 beta(1766)
[tomato.git] / release / src / Makefile
blobf2fb8fd6dc56d9d32b7edae76969353e493f0135
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"
102 @echo ""
104 endif
108 @$(MAKE) setprofile U=G L=g N=G
110 setprofile:
111 echo '#ifndef TOMATO_PROFILE' > router/shared/tomato_profile.h
112 echo '#define TOMATO_$(U) 1' >> router/shared/tomato_profile.h
113 echo '#define PROFILE_G 1' >> 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 'TOMATO_PROFILE = $$(PROFILE_$(U))' >> tomato_profile.mak
121 echo 'TOMATO_PROFILE_NAME = "$(N)"' >> tomato_profile.mak
122 echo 'TOMATO_PROFILE_L = $(L)' >> tomato_profile.mak
123 echo 'TOMATO_PROFILE_U = $(U)' >> tomato_profile.mak
125 @cd router && \
126 [ -s .config ] && cat .config > config_current; \
127 rm -f config_current && \
128 ln -s config_$(L) config_current && \
129 cp config_$(L) .config
130 @$(MAKE) -C router oldconfig
132 @echo ""
133 @echo "Using $(N) profile."
134 @echo ""
137 cleanlibc:
138 @$(MAKE) -C ../../tools-src/uClibc clean
140 libc: cleanlibc
141 @$(MAKE) -C ../../tools-src/uClibc
142 @$(MAKE) -C ../../tools-src/uClibc install
144 help:
145 @echo "g use G profile"
146 @echo "clean -C router clean"
147 @echo "cleanimage rm -rf image"
148 @echo "cleantools clean btools, mksquashfs"
149 @echo "cleankernel -C linux/linux distclean (but preserves .config)"
150 @echo "prepk -C linux/linux oldconfig dep"
151 @echo "libc -C uClibc clean, all, install"
153 .PHONY: all clean distclean cleanimage cleantools cleankernel prepk what setprofile libc help
154 .PHONY: g