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
70 doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
72 docs/busybox.pod : docs/busybox_header.pod include/usage.h docs/busybox_footer.pod
73 - ( cat docs/busybox_header.pod; \
74 docs/autodocifier.pl include/usage.h; \
75 cat docs/busybox_footer.pod ) > docs/busybox.pod
77 docs/BusyBox.txt: docs/busybox.pod
79 @echo BusyBox Documentation
84 docs/BusyBox.1: docs/busybox.pod
86 - pod2man --center=BusyBox --release="version $(VERSION)" \
89 docs/BusyBox.html: docs/busybox.net/BusyBox.html
91 -@ rm -f docs/BusyBox.html
92 -@ ln -s busybox.net/BusyBox.html docs/BusyBox.html
94 docs/busybox.net/BusyBox.html: docs/busybox.pod
95 -@ mkdir -p docs/busybox.net
96 - pod2html --noindex $< > \
97 docs/busybox.net/BusyBox.html
100 # The nifty new buildsystem stuff
101 scripts/mkdep: scripts/mkdep.c
102 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
104 scripts/split-include: scripts/split-include.c
105 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
107 .depend: scripts/mkdep
108 rm -f .depend .hdepend;
109 mkdir -p include/config;
110 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
111 scripts/mkdep -I include -- \
112 `find -name \*.c -print | sed -e "s,^./,,"` >> .depend;
113 scripts/mkdep -I include -- \
114 `find -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
116 depend dep: include/config.h .depend
118 include/config/MARKER: depend scripts/split-include
119 scripts/split-include include/config.h include/config
120 @ touch include/config/MARKER
122 include/config.h: .config
123 @if [ ! -x ./scripts/config/conf ] ; then \
124 $(MAKE) -C scripts/config conf; \
126 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
129 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
133 @echo Finished installing...
136 else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
141 # ---------------------------------------------------------------------------
144 $(MAKE) -C scripts/config conf
145 -@if [ ! -f .config ] ; then \
146 cp $(CONFIG_DEFCONFIG) .config; \
148 scripts/config/mconf:
149 $(MAKE) -C scripts/config ncurses conf mconf
150 -@if [ ! -f .config ] ; then \
151 cp $(CONFIG_DEFCONFIG) .config; \
154 menuconfig: scripts/config/mconf
155 @./scripts/config/mconf $(CONFIG_CONFIG_IN)
157 config: scripts/config/conf
158 @./scripts/config/conf $(CONFIG_CONFIG_IN)
160 oldconfig: scripts/config/conf
161 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
163 randconfig: scripts/config/conf
164 @./scripts/config/conf -r $(CONFIG_CONFIG_IN)
166 allyesconfig: scripts/config/conf
167 @./scripts/config/conf -y $(CONFIG_CONFIG_IN)
168 sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
169 sed -i -e "s/^USING_CROSS_COMPILER.*/# USING_CROSS_COMPILER is not set/" .config
170 sed -i -e "s/^CONFIG_STATIC.*/# CONFIG_STATIC is not set/" .config
171 sed -i -e "s/^CONFIG_SELINUX.*/# CONFIG_SELINUX is not set/" .config
172 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
174 allnoconfig: scripts/config/conf
175 @./scripts/config/conf -n $(CONFIG_CONFIG_IN)
177 defconfig: scripts/config/conf
178 @./scripts/config/conf -d $(CONFIG_CONFIG_IN)
181 cd testsuite && ./runtest
184 - rm -f docs/busybox.dvi docs/busybox.ps \
185 docs/busybox.pod docs/busybox.net/busybox.html \
186 docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
187 docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
188 docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
189 .config.old .hdepend busybox
191 - find . -name .\*.flags -exec rm -f {} \;
192 - find . -name \*.o -exec rm -f {} \;
193 - find . -name \*.a -exec rm -f {} \;
196 - rm -f scripts/split-include scripts/mkdep
197 - rm -rf include/config include/config.h
198 - find . -name .depend -exec rm -f {} \;
199 rm -f .config .config.old .config.cmd
200 - $(MAKE) -C scripts/config clean
202 release: distclean #doc
204 rm -rf $(PROG)-$(VERSION); \
205 cp -a busybox $(PROG)-$(VERSION); \
207 find $(PROG)-$(VERSION)/ -type d \
210 -exec rm -rf {} \; ; \
212 find $(PROG)-$(VERSION)/ -type f \
215 -exec rm -f {} \; ; \
217 tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
223 endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
225 .PHONY: dummy subdirs release distclean clean config oldconfig \
226 menuconfig tags check test depend