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
60 ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
63 @echo --------------------------------------------------
64 @echo You will probably need to make your busybox binary
65 @echo setuid root to ensure all configured applets will
67 @echo --------------------------------------------------
71 uninstall: busybox.links
72 rm -f $(PREFIX)/bin/busybox
73 for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
75 install-hardlinks: applets/install.sh busybox busybox.links
76 $(SHELL) $< $(PREFIX) --hardlinks
79 # Documentation Targets
80 doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
82 docs/busybox.pod : docs/busybox_header.pod include/usage.h docs/busybox_footer.pod
83 - ( cat docs/busybox_header.pod; \
84 docs/autodocifier.pl include/usage.h; \
85 cat docs/busybox_footer.pod ) > docs/busybox.pod
87 docs/BusyBox.txt: docs/busybox.pod
89 @echo BusyBox Documentation
94 docs/BusyBox.1: docs/busybox.pod
96 - pod2man --center=BusyBox --release="version $(VERSION)" \
99 docs/BusyBox.html: docs/busybox.net/BusyBox.html
101 -@ rm -f docs/BusyBox.html
102 -@ ln -s busybox.net/BusyBox.html docs/BusyBox.html
104 docs/busybox.net/BusyBox.html: docs/busybox.pod
105 -@ mkdir -p docs/busybox.net
106 - pod2html --noindex $< > \
107 docs/busybox.net/BusyBox.html
110 # The nifty new buildsystem stuff
111 scripts/mkdep: scripts/mkdep.c
112 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
114 scripts/split-include: scripts/split-include.c
115 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
117 .depend: scripts/mkdep
118 rm -f .depend .hdepend;
119 mkdir -p include/config;
120 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
121 scripts/mkdep -I include -- \
122 `find -name \*.c -print | sed -e "s,^./,,"` >> .depend;
123 scripts/mkdep -I include -- \
124 `find -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
126 depend dep: include/config.h .depend
128 include/config/MARKER: depend scripts/split-include
129 scripts/split-include include/config.h include/config
130 @ touch include/config/MARKER
132 include/config.h: .config
133 @if [ ! -x ./scripts/config/conf ] ; then \
134 $(MAKE) -C scripts/config conf; \
136 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
139 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
143 @echo Finished installing...
146 else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
151 # ---------------------------------------------------------------------------
154 $(MAKE) -C scripts/config conf
155 -@if [ ! -f .config ] ; then \
156 cp $(CONFIG_DEFCONFIG) .config; \
158 scripts/config/mconf:
159 $(MAKE) -C scripts/config ncurses conf mconf
160 -@if [ ! -f .config ] ; then \
161 cp $(CONFIG_DEFCONFIG) .config; \
164 menuconfig: scripts/config/mconf
165 @./scripts/config/mconf $(CONFIG_CONFIG_IN)
167 config: scripts/config/conf
168 @./scripts/config/conf $(CONFIG_CONFIG_IN)
170 oldconfig: scripts/config/conf
171 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
173 randconfig: scripts/config/conf
174 @./scripts/config/conf -r $(CONFIG_CONFIG_IN)
176 allyesconfig: scripts/config/conf
177 @./scripts/config/conf -y $(CONFIG_CONFIG_IN)
178 sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
179 sed -i -e "s/^USING_CROSS_COMPILER.*/# USING_CROSS_COMPILER is not set/" .config
180 sed -i -e "s/^CONFIG_STATIC.*/# CONFIG_STATIC is not set/" .config
181 sed -i -e "s/^CONFIG_SELINUX.*/# CONFIG_SELINUX is not set/" .config
182 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
184 allnoconfig: scripts/config/conf
185 @./scripts/config/conf -n $(CONFIG_CONFIG_IN)
187 defconfig: scripts/config/conf
188 @./scripts/config/conf -d $(CONFIG_CONFIG_IN)
191 cd testsuite && ./runtest
194 - rm -f docs/busybox.dvi docs/busybox.ps \
195 docs/busybox.pod docs/busybox.net/busybox.html \
196 docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
197 docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
198 docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
199 .config.old .hdepend busybox
201 - find . -name .\*.flags -exec rm -f {} \;
202 - find . -name \*.o -exec rm -f {} \;
203 - find . -name \*.a -exec rm -f {} \;
206 - rm -f scripts/split-include scripts/mkdep
207 - rm -rf include/config include/config.h
208 - find . -name .depend -exec rm -f {} \;
209 rm -f .config .config.old .config.cmd
210 - $(MAKE) -C scripts/config clean
212 release: distclean #doc
214 rm -rf $(PROG)-$(VERSION); \
215 cp -a busybox $(PROG)-$(VERSION); \
217 find $(PROG)-$(VERSION)/ -type d \
220 -exec rm -rf {} \; ; \
222 find $(PROG)-$(VERSION)/ -type f \
225 -exec rm -f {} \; ; \
227 tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
233 endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
235 .PHONY: dummy subdirs release distclean clean config oldconfig \
236 menuconfig tags check test depend