3 # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #--------------------------------------------------------------
21 # You shouldn't need to mess with anything beyond this point...
22 #--------------------------------------------------------------
23 noconfig_targets := menuconfig config oldconfig randconfig \
24 defconfig allyesconfig allnoconfig clean distclean \
29 DIRS:=applets archival archival/libunarchive coreutils console-tools \
30 debianutils editors findutils init miscutils modutils networking \
31 networking/libiproute networking/udhcp procps loginutils shell \
32 sysklogd util-linux libpwdgrp coreutils/libcoreutils libbb
34 ifeq ($(strip $(CONFIG_SELINUX)),y)
35 CFLAGS += -I/usr/include/selinux
39 CONFIG_CONFIG_IN = sysdeps/$(TARGET_OS)/Config.in
40 CONFIG_DEFCONFIG = sysdeps/$(TARGET_OS)/defconfig
42 ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
44 all: busybox busybox.links doc
46 # In this section, we need .config
48 include $(patsubst %,%/Makefile.in, $(DIRS))
49 -include $(TOPDIR).depend
51 busybox: .depend include/config.h $(libraries-y)
52 $(CC) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
55 busybox.links: applets/busybox.mkll include/config.h
58 install: applets/install.sh busybox busybox.links
61 uninstall: busybox.links
62 rm -f $(PREFIX)/bin/busybox
63 for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
65 install-hardlinks: applets/install.sh busybox busybox.links
66 $(SHELL) $< $(PREFIX) --hardlinks
69 # Documentation Targets
73 olddoc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
75 docs/busybox.pod : docs/busybox_header.pod include/usage.h docs/busybox_footer.pod
76 - ( cat docs/busybox_header.pod; \
77 docs/autodocifier.pl include/usage.h; \
78 cat docs/busybox_footer.pod ) > docs/busybox.pod
80 docs/BusyBox.txt: docs/busybox.pod
82 @echo BusyBox Documentation
87 docs/BusyBox.1: docs/busybox.pod
89 - pod2man --center=BusyBox --release="version $(VERSION)" \
92 docs/BusyBox.html: docs/busybox.net/BusyBox.html
94 -@ rm -f docs/BusyBox.html
95 -@ ln -s busybox.net/BusyBox.html docs/BusyBox.html
97 docs/busybox.net/BusyBox.html: docs/busybox.pod
98 -@ mkdir -p docs/busybox.net
99 - pod2html --noindex $< > \
100 docs/busybox.net/BusyBox.html
104 # New docs based on DOCBOOK SGML
105 newdoc: docs/busybox.txt docs/busybox.pdf docs/busybox/busyboxdocumentation.html
107 docs/busybox.txt: docs/busybox.sgml
109 @echo BusyBox Documentation
112 (cd docs; sgmltools -b txt busybox.sgml)
114 docs/busybox.dvi: docs/busybox.sgml
116 (cd docs; sgmltools -b dvi busybox.sgml)
118 docs/busybox.ps: docs/busybox.sgml
120 (cd docs; sgmltools -b ps busybox.sgml)
122 docs/busybox.pdf: docs/busybox.ps
124 (cd docs; ps2pdf busybox.ps)
126 docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
128 (cd docs/busybox.net; sgmltools -b html ../busybox.sgml)
130 # The nifty new buildsystem stuff
131 scripts/mkdep: scripts/mkdep.c
132 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
134 scripts/split-include: scripts/split-include.c
135 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
137 .depend: scripts/mkdep
138 rm -f .depend .hdepend;
139 mkdir -p include/config;
140 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
141 scripts/mkdep -I include -- \
142 `find -name \*.c -print | sed -e "s,^./,,"` >> .depend;
143 scripts/mkdep -I include -- \
144 `find -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
146 depend dep: include/config.h .depend
148 include/config/MARKER: depend scripts/split-include
149 scripts/split-include include/config.h include/config
150 @ touch include/config/MARKER
152 include/config.h: .config
153 @if [ ! -x ./scripts/config/conf ] ; then \
154 $(MAKE) -C scripts/config conf; \
156 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
159 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
163 @echo Finished installing...
166 else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
171 # ---------------------------------------------------------------------------
174 $(MAKE) -C scripts/config conf
175 -@if [ ! -f .config ] ; then \
176 cp $(CONFIG_DEFCONFIG) .config; \
178 scripts/config/mconf:
179 $(MAKE) -C scripts/config ncurses conf mconf
180 -@if [ ! -f .config ] ; then \
181 cp $(CONFIG_DEFCONFIG) .config; \
184 menuconfig: scripts/config/mconf
185 @./scripts/config/mconf $(CONFIG_CONFIG_IN)
187 config: scripts/config/conf
188 @./scripts/config/conf $(CONFIG_CONFIG_IN)
190 oldconfig: scripts/config/conf
191 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
193 randconfig: scripts/config/conf
194 @./scripts/config/conf -r $(CONFIG_CONFIG_IN)
196 allyesconfig: scripts/config/conf
197 @./scripts/config/conf -y $(CONFIG_CONFIG_IN)
198 sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
199 sed -i -e "s/^USING_CROSS_COMPILER.*/# USING_CROSS_COMPILER is not set/" .config
200 sed -i -e "s/^CONFIG_STATIC.*/# CONFIG_STATIC is not set/" .config
201 sed -i -e "s/^CONFIG_SELINUX.*/# CONFIG_SELINUX is not set/" .config
202 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
204 allnoconfig: scripts/config/conf
205 @./scripts/config/conf -n $(CONFIG_CONFIG_IN)
207 defconfig: scripts/config/conf
208 @./scripts/config/conf -d $(CONFIG_CONFIG_IN)
211 # Note that 'tests' is depricated. Use 'make check' instead
212 # To use the nice new testsuite....
213 cd tests && ./tester.sh
216 cd testsuite && ./runtest
219 - $(MAKE) -C tests clean
220 - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
221 docs/busybox.pdf docs/busybox.pod docs/busybox.net/busybox.html \
222 docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
223 docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
224 docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
225 .config.old .hdepend busybox
227 - find . -name .\*.flags -exec rm -f {} \;
228 - find . -name \*.o -exec rm -f {} \;
229 - find . -name \*.a -exec rm -f {} \;
232 - rm -f scripts/split-include scripts/mkdep
233 - rm -rf include/config include/config.h
234 - find . -name .depend -exec rm -f {} \;
235 rm -f .config .config.old .config.cmd
236 - $(MAKE) -C scripts/config clean
238 release: distclean #doc
240 rm -rf $(PROG)-$(VERSION); \
241 cp -a busybox $(PROG)-$(VERSION); \
243 find $(PROG)-$(VERSION)/ -type d \
246 -exec rm -rf {} \; ; \
248 find $(PROG)-$(VERSION)/ -type f \
251 -exec rm -f {} \; ; \
253 tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
259 endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
261 .PHONY: dummy subdirs release distclean clean config oldconfig \
262 menuconfig tags check test tests depend