2 # Broadcom Linux Router Makefile
4 # Copyright 2005, Broadcom Corporation
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.
21 SEP
=echo
"\033[41;1m $@ \033[0m"
53 # configurable packages
55 obj-
$(TCONFIG_L2TP
) += rp-l2tp
56 obj-
$(TCONFIG_PPTP
) += pptp-client
57 obj-
$(TCONFIG_HTTPS
) += openssl
58 obj-
$(TCONFIG_HTTPS
) += matrixssl
59 obj-
$(TCONFIG_SSH
) += dropbear
60 obj-
$(TCONFIG_ZEBRA
) += zebra
61 # obj-$(TCONFIG_IPP2P) += ipp2p
63 ifeq ($(TCONFIG_L2TP
),y
)
66 ifeq ($(TCONFIG_PPTP
),y
)
69 obj-
$(NEED_PPPD
) += pppd
72 obj-clean
:= $(foreach obj
,$(obj-y
) $(obj-n
),$(obj
)-clean)
73 obj-install
:= $(foreach obj
,$(obj-y
),$(obj
)-install)
81 all: clean-build
$(obj-y
) kernel
84 kernel
: $(LINUXDIR
)/.config
87 @if
! grep
-q
"CONFIG_EMBEDDED_RAMDISK=y" $(LINUXDIR
)/.config
; then \
88 $(MAKE
) -C
$(LINUXDIR
) zImage
; \
90 if grep
-q
"CONFIG_MODULES=y" $(LINUXDIR
)/.config
; then \
91 $(MAKE
) -C
$(LINUXDIR
) modules
; \
96 $(MAKE
) -C
$(LINUXDIR
) modules
99 cd
$(TARGETDIR
)/lib
/modules
/2.4.20 && find
-name
"*.o" -exec mv
-i
{} . \
; || true
100 cd
$(TARGETDIR
)/lib
/modules
/2.4.20 && find
-type d
-delete || true
102 install package
: $(obj-install
) $(LINUXDIR
)/.config
105 install -d
$(TARGETDIR
)
109 $(MAKE
) -C
$(LINUXDIR
) modules_install DEPMOD
=/bin
/true INSTALL_MOD_PATH
=$(TARGETDIR
)
110 find
$(TARGETDIR
)/lib
/modules
-name
*.o
-exec mipsel-linux-strip
--strip-unneeded
{} \
;
112 -cd
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/drivers
/net
&& mv diag
/* .
&& rm -rf diag
115 -cd
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/drivers
/net
&& mv et
.4702/* .
&& rm -rf et
.4702 || true
116 cd
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/drivers
/net
&& mv et
/* .
&& rm -rf et
117 cd
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/drivers
/net
&& mv wl
/* .
&& rm -rf wl
118 cd
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/fs
&& mv cifs
/* .
&& rm -rf cifs
119 cd
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/fs
&& mv jffs2
/* .
&& rm -rf jffs2
120 cd
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/lib
&& mv zlib_inflate
/* .
&& rm -rf zlib_inflate
121 cd
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/lib
&& mv zlib_deflate
/* .
&& rm -rf zlib_deflate
122 rm -rf
$(TARGETDIR
)/lib
/modules
/2.4.20/pcmcia
125 for
dir in
$(wildcard $(patsubst %,$(INSTALLDIR
)/%,$(obj-y
))) ; do \
126 (cd
$${dir} && tar cpf
- .
) |
(cd
$(TARGETDIR
) && tar xpf
-) \
129 ifneq ($(TCONFIG_JFFS2
),y
)
130 rm -f
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/fs
/jffs2.o
131 rm -rf
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/lib
/zlib_
*
134 ifneq ($(TCONFIG_CIFS
),y
)
135 rm -f
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/fs
/cifs.o
138 ifneq ($(TCONFIG_L7
),y
)
139 rm -f
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/net
/ipv4
/netfilter
/ipt_layer7.o
140 rm -f
$(TARGETDIR
)/usr
/lib
/iptables
/libipt_layer7.so
143 # separated extra stuff
144 @
rm -rf
$(PLATFORMDIR
)/extras
145 @mkdir
$(PLATFORMDIR
)/extras
146 @mv
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/net
/ipv4
/ip_gre.o
$(PLATFORMDIR
)/extras
/
147 @mv
$(TARGETDIR
)/lib
/modules
/2.4.20/kernel
/drivers
/net
/tun.o
$(PLATFORMDIR
)/extras
/
150 install $(LIBDIR
)/ld-uClibc.so
.0 $(TARGETDIR
)/lib
/
151 install $(LIBDIR
)/libcrypt.so
.0 $(TARGETDIR
)/lib
/
152 install $(LIBDIR
)/libc.so
.0 $(TARGETDIR
)/lib
/
153 install $(LIBDIR
)/libdl.so
.0 $(TARGETDIR
)/lib
/
154 install $(LIBDIR
)/libm.so
.0 $(TARGETDIR
)/lib
/
155 install $(LIBDIR
)/libnsl.so
.0 $(TARGETDIR
)/lib
/
156 ifeq ($(TCONFIG_SSH
),y
)
157 install $(LIBDIR
)/libutil.so
.0 $(TARGETDIR
)/lib
/
160 @cd
$(TARGETDIR
) && $(TOP
)/others
/rootprep.sh
163 busybox
/examples
/depmod.pl
-k
$(LINUXDIR
)/vmlinux
-b
$(TARGETDIR
)/lib
/modules
/2.4.20/
166 @
rm -f
$(TARGETDIR
)/lib
/modules
/2.4.20/build
169 @chmod
0555 $(TARGETDIR
)/lib
/*.so
*
172 @mkdir
-p
$(TARGETDIR
)/rom
/etc
/l7-protocols
173 ifeq ($(TCONFIG_L7PAT
),y
)
174 @cd layer7
&& .
/squish.sh
175 cp layer7
/squished
/*.pat
$(TARGETDIR
)/rom
/etc
/l7-protocols
178 @
$(MAKE
) -C
$(SRCBASE
)/linux
/linux
/scripts
/squashfs mksquashfs-lzma
179 @
$(SRCBASE
)/linux
/linux
/scripts
/squashfs
/mksquashfs-lzma
$(TARGETDIR
) $(PLATFORMDIR
)/target.image
181 # Package kernel and filesystem
182 # if grep -q "CONFIG_EMBEDDED_RAMDISK=y" $(LINUXDIR)/.config ; then \
183 # cp $(PLATFORMDIR)/target.image $(LINUXDIR)/arch/mips/ramdisk/$${CONFIG_EMBEDDED_RAMDISK_IMAGE} ; \
184 # $(MAKE) -C $(LINUXDIR) zImage ; \
186 # cp $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz $(PLATFORMDIR)/ ; \
187 # trx -o $(PLATFORMDIR)/linux.trx $(PLATFORMDIR)/vmlinuz $(PLATFORMDIR)/target.image ; \
190 # Pad self-booting Linux to a 64 KB boundary
191 # cp $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/zImage $(PLATFORMDIR)/
192 # dd conv=sync bs=64k < $(PLATFORMDIR)/zImage > $(PLATFORMDIR)/linux.bin
193 # Append filesystem to self-booting Linux
194 # cat $(PLATFORMDIR)/target.image >> $(PLATFORMDIR)/linux.bin
202 clean: clean-build
$(obj-clean
)
203 rm -rf layer7
/squished
208 rm -f
$(PLATFORMDIR
)/linux.trx
$(PLATFORMDIR
)/vmlinuz
$(PLATFORMDIR
)/target.image
209 rm -rf
$(PLATFORMDIR
)/extras
212 ifneq ($(INSIDE_MAK
),1)
213 $(MAKE
) -C ..
$@ INSIDE_MAK
=1
220 CONFIG_IN
:= config
/config.in
222 config
/conf config
/mconf
:
226 @config
/conf
$(CONFIG_IN
)
229 @config
/mconf
$(CONFIG_IN
)
231 roldconf
: config
/conf
232 @config
/conf
-o
$(CONFIG_IN
)
235 @
$(MAKE
) -C
$(LINUXDIR
) config
238 @
$(MAKE
) -C
$(LINUXDIR
) menuconfig
241 @
$(MAKE
) -C
$(LINUXDIR
) oldconfig
243 config conf
: rconf kconf
245 menuconfig mconf
: rmconf kmconf
247 oldconfig oldconf
: roldconf koldconf
251 # overrides and extra dependencies
255 @cd busybox
&& [ -s .config
] ||
( cp config.save .config
; $(MAKE
) oldconfig
)
256 @
$(MAKE
) -C busybox CFLAGS
="-Os"
257 @cp busybox
/.config busybox
/config.save
262 rm -rf
$(INSTALLDIR
)/busybox
263 $(MAKE
) -C busybox
install CONFIG_PREFIX
=$(INSTALLDIR
)/busybox CFLAGS
="-Os"
266 cd busybox
&& [ -s .config
] && cp .config config.save
267 $(MAKE
) -C busybox
distclean
268 cd busybox
&& mv config.save .config
271 $(MAKE
) -C busybox menuconfig
274 httpd
: matrixssl shared nvram mssl
279 @
$(MAKE
) -C www
install INSTALLDIR
=$(INSTALLDIR
)/www TOMATO_EXPERIMENTAL
=$(TOMATO_EXPERIMENTAL
)
283 @
$(MAKE
) -C matrixssl
/src
289 $(MAKE
) -C matrixssl
/src
clean
293 install -D openssl
/libcrypto.so
$(INSTALLDIR
)/openssl
/usr
/lib
/libcrypto.so
294 $(STRIP
) $(INSTALLDIR
)/openssl
/usr
/lib
/libcrypto.so
296 install -D
-m
500 openssl
/apps
/openssl
$(INSTALLDIR
)/openssl
/usr
/sbin
/openssl
297 $(STRIP
) $(INSTALLDIR
)/openssl
/usr
/sbin
/openssl
299 install -D
-m
0500 httpd
/gencert.sh
$(INSTALLDIR
)/openssl
/usr
/sbin
/gencert.sh
301 # perl -e 'while (<>) { s/.SECS/time()-(24*60*60)/e; print; }' < httpd/gencert.sh > $(INSTALLDIR)/openssl/usr/sbin/gencert.sh
302 # chmod 0500 $(INSTALLDIR)/openssl/usr/sbin/gencert.sh
304 # install -D openssl/libssl.so $(INSTALLDIR)/openssl/usr/lib/libssl.so
305 # $(STRIP) $(INSTALLDIR)/openssl/usr/lib/libssl.so
316 @
$(MAKE
) -C bridge brctl
/brctl
319 install -D bridge
/brctl
/brctl
$(INSTALLDIR
)/bridge
/usr
/sbin
/brctl
320 $(STRIP
) $(INSTALLDIR
)/bridge
/usr
/sbin
/brctl
324 install -D dnsmasq
/src
/dnsmasq
$(INSTALLDIR
)/dnsmasq
/usr
/sbin
/dnsmasq
325 $(STRIP
) $(INSTALLDIR
)/dnsmasq
/usr
/sbin
/dnsmasq
329 $(MAKE
) -C iptables BINDIR
=/usr
/sbin LIBDIR
=/usr
/lib KERNEL_DIR
=$(LINUXDIR
)
332 install -D iptables
/iptables
$(INSTALLDIR
)/iptables
/usr
/sbin
/iptables
333 cd
$(INSTALLDIR
)/iptables
/usr
/sbin
&& \
334 ln
-sf iptables iptables-restore
336 install -d
$(INSTALLDIR
)/iptables
/usr
/lib
/iptables
337 install -D iptables
/extensions
/*.so
$(INSTALLDIR
)/iptables
/usr
/lib
/iptables
/
339 install -D iptables
/libiptc.so
$(INSTALLDIR
)/iptables
/usr
/lib
/libiptc.so
341 $(STRIP
) $(INSTALLDIR
)/iptables
/usr
/sbin
/iptables
342 $(STRIP
) $(INSTALLDIR
)/iptables
/usr
/lib
/iptables
/*.so
343 $(STRIP
) $(INSTALLDIR
)/iptables
/usr
/lib
/libiptc.so
346 -$(MAKE
) -C iptables KERNEL_DIR
=$(LINUXDIR
) clean
350 $(MAKE
) -C ppp
/pppoecd
$* INSTALLDIR
=$(INSTALLDIR
)/ppp
351 # $(MAKE) -C ppp/pppoecd $* INSTALLDIR=$(INSTALLDIR)/ppp DFLAGS="-DDEBUG -DDEBUGALL"
354 $(MAKE
) -C ppp
/pppoecd
$* INSTALLDIR
=$(INSTALLDIR
)/ppp
357 upnp
: nvram shared iptables
361 $(MAKE
) -C miniupnpd
-f Makefile.tomato
364 -$(MAKE
) -C miniupnpd
-f Makefile.tomato
clean
367 install -D miniupnpd
/miniupnpd
$(INSTALLDIR
)/miniupnpd
/usr
/sbin
/miniupnpd
368 $(STRIP
) $(INSTALLDIR
)/miniupnpd
/usr
/sbin
/miniupnpd
374 @
$(MAKE
) -C vlan CROSS
=$(CROSS_COMPILE
) STRIPTOOL
=$(STRIP
)
377 $(MAKE
) -C vlan CROSS
=$(CROSS_COMPILE
) STRIPTOOL
=$(STRIP
) INSTALLDIR
=$(INSTALLDIR
) install
381 install -D pptp-client
/pptp
$(INSTALLDIR
)/pptp-client
/usr
/sbin
/pptp
382 $(STRIP
) $(INSTALLDIR
)/pptp-client
/usr
/sbin
/pptp
387 @
$(MAKE
) -C pppd
/pppd
390 $(MAKE
) -C pppd
/pppd
clean
393 install -D pppd
/pppd
/pppd
$(INSTALLDIR
)/pppd
/usr
/sbin
/pppd
394 $(STRIP
) $(INSTALLDIR
)/pppd
/usr
/sbin
/pppd
397 # install -D ipupdate/ez-ipupdate $(INSTALLDIR)/ipupdate/usr/sbin/ez-ipupdate
398 # $(STRIP) $(INSTALLDIR)/ipupdate/usr/sbin/ez-ipupdate
403 @
$(MAKE
) -C zebra CC
=$(CC
) AR
=$(AR
) RANLIB
=$(RANLIB
)
406 install -D zebra
/zebra
/zebra
$(INSTALLDIR
)/zebra
/usr
/sbin
/zebra
407 install -D zebra
/ripd
/ripd
$(INSTALLDIR
)/zebra
/usr
/sbin
/ripd
408 install -D zebra
/lib
/libzebra.so
$(INSTALLDIR
)/zebra
/usr
/lib
/libzebra.so
409 $(STRIP
) $(INSTALLDIR
)/zebra
/usr
/sbin
/zebra
410 $(STRIP
) $(INSTALLDIR
)/zebra
/usr
/sbin
/ripd
411 $(STRIP
) $(INSTALLDIR
)/zebra
/usr
/lib
/libzebra.so
415 install -d
$(INSTALLDIR
)/rp-l2tp
/usr
/lib
/l2tp
416 install rp-l2tp
/handlers
/*.so
$(INSTALLDIR
)/rp-l2tp
/usr
/lib
/l2tp
417 $(STRIP
) $(INSTALLDIR
)/rp-l2tp
/usr
/lib
/l2tp
/*.so
418 install -D rp-l2tp
/handlers
/l2tp-control
$(INSTALLDIR
)/rp-l2tp
/usr
/sbin
/l2tp-control
419 $(STRIP
) $(INSTALLDIR
)/rp-l2tp
/usr
/sbin
/l2tp-control
420 install -D rp-l2tp
/l2tpd
$(INSTALLDIR
)/rp-l2tp
/usr
/sbin
/l2tpd
421 $(STRIP
) $(INSTALLDIR
)/rp-l2tp
/usr
/sbin
/l2tpd
425 install -D bpalogin
/bpalogin
$(INSTALLDIR
)/bpalogin
/usr
/sbin
/bpalogin
426 $(STRIP
) $(INSTALLDIR
)/bpalogin
/usr
/sbin
/bpalogin
431 # @-mkdir -p libnet/lib
432 # @$(MAKE) -C libnet CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
436 # @$(MAKE) -C libpcap CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
439 @
[ ! -f libbcm
/Makefile
] ||
$(MAKE
) -C libbcm
442 install -D libbcm
/libbcm.so
$(INSTALLDIR
)/libbcm
/usr
/lib
/libbcm.so
443 $(STRIP
) $(INSTALLDIR
)/libbcm
/usr
/lib
/libbcm.so
447 install -D iproute2
/tc
/tc
$(INSTALLDIR
)/iproute2
/usr
/sbin
/tc
448 $(STRIP
) $(INSTALLDIR
)/iproute2
/usr
/sbin
/tc
449 install -D iproute2
/ip
/ip
$(INSTALLDIR
)/iproute2
/usr
/sbin
/ip
450 $(STRIP
) $(INSTALLDIR
)/iproute2
/usr
/sbin
/ip
456 dropbear
: dropbear
/config.h
458 @make
-C dropbear PROGRAMS
="dropbear dbclient dropbearkey scp" MULTI
=1
461 install -D dropbear
/dropbearmulti
$(INSTALLDIR
)/dropbear
/usr
/bin
/dropbearmulti
462 $(STRIP
) $(INSTALLDIR
)/dropbear
/usr
/bin
/dropbearmulti
463 cd
$(INSTALLDIR
)/dropbear
/usr
/bin
&& \
464 ln
-sf dropbearmulti dropbear
&& \
465 ln
-sf dropbearmulti dropbearconvert
&& \
466 ln
-sf dropbearmulti dropbearkey
&& \
467 ln
-sf dropbearmulti dbclient
&& \
468 ln
-sf dropbearmulti ssh
&& \
469 ln
-sf dropbearmulti scp
472 @make
-C dropbear
clean
475 cd dropbear
&& CFLAGS
="-O2 -Wall" ac_cv_func_logout
=no ac_cv_func_logwtmp
=no .
/configure
--host
=mipsel-linux
--disable-zlib
--enable-syslog
--disable-lastlog
--disable-utmp
--disable-utmpx
--disable-wtmp
--disable-wtmpx
--disable-pututline
--disable-pututxline
--disable-loginfunc
--disable-largefile
476 make
-C dropbear
clean
482 ebtables-install
: dummy
483 install -D ebtables
/ebtables
$(INSTALLDIR
)/ebtables
/usr
/sbin
/ebtables
485 mkdir
-p
$(INSTALLDIR
)/ebtables
/usr
/lib
/
486 cp ebtables
/*.so
$(INSTALLDIR
)/ebtables
/usr
/lib
/
487 cp ebtables
/extensions
/*.so
$(INSTALLDIR
)/ebtables
/usr
/lib
/
490 make
-C ebtables
clean
500 @
[ ! -d
$* ] ||
( $(SEP
); $(MAKE
) -C
$* )
504 @
-[ ! -d
$* ] ||
$(MAKE
) -C
$* clean
507 @
[ ! -d
$* ] ||
$(MAKE
) -C
$* install INSTALLDIR
=$(INSTALLDIR
)/$*
512 $(obj-y
) $(obj-n
) $(obj-clean
) $(obj-install
): dummy
514 .PHONY
: all clean distclean mrproper
install package
515 .PHONY
: conf mconf oldconf kconf kmconf config menuconfig oldconfig
516 .PHONY
: dummy libnet libpcap