Tomato-ND 1.21
[tomato.git] / release / src / Makefile
blob6175b61bb97aa32023c63c046c0eb402ef7b90e4
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 -e "\n\n$(TOMATO_PROFILE_NAME) Profile"
32 @btools/uversion.pl --gen
33 @echo -e "\n\n"
35 @$(MAKE) -C router all
36 @$(MAKE) -C router install
37 @$(MAKE) -C btools
39 @rm -rf image
40 @mkdir image
41 ifeq ($(wildcard include/bcm20xx.h),)
42 @btools/fpkg -i linux/linux/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -i router/mipsel-uclibc/target.image \
43 -t image/tomato.trx \
44 -l W54G,image/WRT54G_WRT54GL.bin \
45 -l W54S,image/WRT54GS.bin \
46 -l W54s,image/WRT54GSv4.bin \
47 -l W54U,image/WRTSL54GS.bin \
48 -m 0x10577050,image/WR850G.bin \
49 | tee fpkg.log
50 else
51 @btools/fpkg -i linux/linux/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -i router/mipsel-uclibc/target.image \
52 -t image/tomato-ND.trx
53 # -l WR41,image/WRH54G.bin
54 endif
57 @echo -e "\n-----------------\n" `cat router/shared/tomato_version` " ready\n-----------------"
59 ifneq ($(NOVERSION),1)
60 @cp router/shared/tomato_version router/shared/tomato_version_last
61 @btools/uversion.pl --bump
62 endif
65 clean: cleanimage
66 @$(MAKE) -C router $@
67 @rm -f fpkg.log
69 cleanimage:
70 @rm -rf image
72 cleantools:
73 @$(MAKE) -C linux/linux/scripts/squashfs clean
74 @$(MAKE) -C btools clean
76 cleankernel:
77 @cd linux/linux && \
78 mv .config save-config && \
79 $(MAKE) distclean; \
80 mv save-config .config
82 distclean: clean cleankernel cleantools cleanlibc
83 ifneq ($(INSIDE_MAK),1)
84 @$(MAKE) -C router $@ INSIDE_MAK=1
85 endif
86 @$(MAKE) -C router/busybox distclean
87 @rm -f router/busybox/config_current
88 @rm -f router/config_current
89 @rm -f router/.config.cmd router/.config.old
90 @rm -f router/libfoo_xref.txt
91 @rm -f tomato_profile.mak router/shared/tomato_profile.h
93 prepk:
94 $(MAKE) -C linux/linux oldconfig dep
96 what:
97 @echo -e "\n$(TOMATO_PROFILE_NAME) Profile\n"
99 endif
103 @$(MAKE) setprofile U=G L=g N=G
105 setprofile:
106 @echo -e "\
107 #ifndef TOMATO_PROFILE\n\
108 #define TOMATO_$(U) 1\n\
109 #define PROFILE_G 1\n\
110 #define PROFILE_N 2\n\
111 #define TOMATO_PROFILE PROFILE_$(U)\n\
112 #define TOMATO_PROFILE_NAME \"$(N)\"\n\
113 #endif\n" > router/shared/tomato_profile.h
115 @echo -e "\
116 TOMATO_$(U) = 1\n\
117 PROFILE_G = 1\n\
118 PROFILE_N = 2\n\
119 TOMATO_PROFILE = \$$(PROFILE_$(U))\n\
120 TOMATO_PROFILE_NAME = \"$(N)\"\n\
121 TOMATO_PROFILE_L = $(L)\n\
122 TOMATO_PROFILE_U = $(U)\n" > tomato_profile.mak
124 @cd router && \
125 [ -s .config ] && cat .config > config_current; \
126 rm -f config_current && \
127 ln -s config_$(L) config_current && \
128 cp config_$(L) .config
129 @$(MAKE) -C router oldconfig
131 @cd router/busybox && \
132 [ -s .config ] && cat .config > config_current; \
133 rm -f config_current && \
134 ln -s config_$(L) config_current && \
135 cp config_$(L) .config
136 @$(MAKE) -C router/busybox oldconfig
138 @echo -e "\nUsing $(N) profile.\n"
141 cleanlibc:
142 @$(MAKE) -C ../../tools-src/uClibc clean
144 libc: cleanlibc
145 @$(MAKE) -C ../../tools-src/uClibc
146 @$(MAKE) -C ../../tools-src/uClibc install
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