summaryrefslogtreecommitdiff
path: root/release/src/Makefile
blob: f2fb8fd6dc56d9d32b7edae76969353e493f0135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#
# Toplevel Makefile for the BCM947xx Linux Router release
#
# Copyright 2005, Broadcom Corporation
# All Rights Reserved.
#
# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
#
# $Id: Makefile,v 1.53 2005/04/25 03:54:37 tallest Exp $
#

SRCBASE := $(shell pwd)
RELEASEDIR := $(shell (cd $(SRCBASE)/.. && pwd -P))
PATH := $(RELEASEDIR)/tools:$(PATH)

-include tomato_profile.mak

ifeq ($(TOMATO_PROFILE),)

all:
	$(MAKE) libc
	$(MAKE) g
	$(MAKE)

else

all:
	@echo ""
	@echo ""
	@echo "$(TOMATO_PROFILE_NAME) Profile"
	@btools/uversion.pl --gen
	@echo ""
	@echo ""
	
	@$(MAKE) -C router all
	@$(MAKE) -C router install
	@$(MAKE) -C btools

	@rm -rf image
	@mkdir image
ifeq ($(wildcard include/bcm20xx.h),)
	@btools/fpkg -i linux/linux/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -i router/mipsel-uclibc/target.image \
		-t image/tomato.trx \
		-l W54G,image/WRT54G_WRT54GL.bin \
		-l W54S,image/WRT54GS.bin \
		-l W54s,image/WRT54GSv4.bin \
		-l W54U,image/WRTSL54GS.bin \
		-m 0x10577050,image/WR850G.bin \
		| tee fpkg.log
else
	@btools/fpkg -i linux/linux/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz -i router/mipsel-uclibc/target.image \
		-t image/tomato-ND.trx
endif


	@echo ""
	@echo "-----------------"
	@echo `cat router/shared/tomato_version` " ready"
	@echo "-----------------"

ifneq ($(NOVERSION),1)	
	@cp router/shared/tomato_version router/shared/tomato_version_last
	@btools/uversion.pl --bump
endif


clean: cleanimage
	@$(MAKE) -C router $@
	@rm -f fpkg.log

cleanimage:
	@rm -rf image

cleantools:
	@$(MAKE) -C linux/linux/scripts/squashfs clean
	@$(MAKE) -C btools clean
	
cleankernel:
	@cd linux/linux && \
	mv .config save-config && \
	$(MAKE) distclean; \
	mv save-config .config

distclean: clean cleankernel cleantools cleanlibc
ifneq ($(INSIDE_MAK),1)
	@$(MAKE) -C router $@ INSIDE_MAK=1
endif
	@rm -f router/config_current
	@rm -f router/.config.cmd router/.config.old
	@rm -f router/libfoo_xref.txt
	@rm -f tomato_profile.mak router/shared/tomato_profile.h

prepk:
	$(MAKE) -C linux/linux oldconfig dep

what:
	@echo ""
	@echo "$(TOMATO_PROFILE_NAME) Profile"
	@echo ""

endif


g:
	@$(MAKE) setprofile U=G L=g N=G

setprofile:
	echo '#ifndef TOMATO_PROFILE' > router/shared/tomato_profile.h
	echo '#define TOMATO_$(U) 1' >> router/shared/tomato_profile.h
	echo '#define PROFILE_G 1' >> router/shared/tomato_profile.h
	echo '#define TOMATO_PROFILE PROFILE_$(U)' >> router/shared/tomato_profile.h
	echo '#define TOMATO_PROFILE_NAME "$(N)"' >> router/shared/tomato_profile.h
	echo '#endif' >> router/shared/tomato_profile.h

	echo 'TOMATO_$(U) = 1' > tomato_profile.mak
	echo 'PROFILE_G = 1' >> tomato_profile.mak
	echo 'TOMATO_PROFILE = $$(PROFILE_$(U))' >> tomato_profile.mak
	echo 'TOMATO_PROFILE_NAME = "$(N)"' >> tomato_profile.mak
	echo 'TOMATO_PROFILE_L = $(L)' >> tomato_profile.mak
	echo 'TOMATO_PROFILE_U = $(U)' >> tomato_profile.mak

	@cd router && \
		[ -s .config ] && cat .config > config_current; \
		rm -f config_current && \
		ln -s config_$(L) config_current && \
		cp config_$(L) .config
	@$(MAKE) -C router oldconfig

	@echo ""
	@echo "Using $(N) profile."
	@echo ""


cleanlibc:
	@$(MAKE) -C ../../tools-src/uClibc clean

libc: cleanlibc
	@$(MAKE) -C ../../tools-src/uClibc
	@$(MAKE) -C ../../tools-src/uClibc install

help:
	@echo "g            use G profile"
	@echo "clean        -C router clean"
	@echo "cleanimage   rm -rf image"
	@echo "cleantools   clean btools, mksquashfs"
	@echo "cleankernel  -C linux/linux distclean (but preserves .config)"
	@echo "prepk        -C linux/linux oldconfig dep"
	@echo "libc         -C uClibc clean, all, install"
	
.PHONY: all clean distclean cleanimage cleantools cleankernel prepk what setprofile libc help
.PHONY: g