summaryrefslogtreecommitdiff
path: root/busybox/Makefile
diff options
context:
space:
mode:
authornobody <nobody@localhost>2004-10-13 09:42:10 +0000
committernobody <nobody@localhost>2004-10-13 09:42:10 +0000
commit8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373 (patch)
tree1826706cd4fd009fcd14f4f8021005ec8ec0fa59 /busybox/Makefile
downloadbusybox-w32-8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373.tar.gz
busybox-w32-8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373.tar.bz2
busybox-w32-8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373.zip
This commit was manufactured by cvs2svn to create tag 'busybox_1_00'.
Diffstat (limited to 'busybox/Makefile')
-rw-r--r--busybox/Makefile315
1 files changed, 315 insertions, 0 deletions
diff --git a/busybox/Makefile b/busybox/Makefile
new file mode 100644
index 000000000..3e2b3ef18
--- /dev/null
+++ b/busybox/Makefile
@@ -0,0 +1,315 @@
1# Makefile for busybox
2#
3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4#
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.
9#
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.
14#
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
18#
19
20#--------------------------------------------------------------
21# You shouldn't need to mess with anything beyond this point...
22#--------------------------------------------------------------
23noconfig_targets := menuconfig config oldconfig randconfig \
24 defconfig allyesconfig allnoconfig clean distclean \
25 release tags
26
27ifndef TOPDIR
28TOPDIR=$(CURDIR)/
29endif
30ifndef top_srcdir
31top_srcdir=$(CURDIR)
32endif
33ifndef top_builddir
34top_builddir=$(CURDIR)
35endif
36
37srctree=$(top_srcdir)
38vpath %/Config.in $(srctree)
39
40include $(top_builddir)/Rules.mak
41
42DIRS:=applets archival archival/libunarchive coreutils console-tools \
43 debianutils editors findutils init miscutils modutils networking \
44 networking/libiproute networking/udhcp procps loginutils shell \
45 sysklogd util-linux libpwdgrp coreutils/libcoreutils libbb
46
47SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
48
49ifeq ($(strip $(CONFIG_SELINUX)),y)
50CFLAGS += -I/usr/include/selinux
51LIBRARIES += -lsecure
52endif
53
54CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in
55CONFIG_DEFCONFIG = $(top_srcdir)/sysdeps/$(TARGET_OS)/defconfig
56
57ALL_DIRS:= $(DIRS) scripts/config
58ALL_MAKEFILES:=$(patsubst %,%/Makefile,$(ALL_DIRS))
59
60ifeq ($(KBUILD_SRC),)
61
62ifdef O
63 ifeq ("$(origin O)", "command line")
64 KBUILD_OUTPUT := $(O)
65 endif
66endif
67
68# That's our default target when none is given on the command line
69.PHONY: _all
70_all:
71
72ifneq ($(KBUILD_OUTPUT),)
73# Invoke a second make in the output directory, passing relevant variables
74# check that the output directory actually exists
75saved-output := $(KBUILD_OUTPUT)
76KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
77$(if $(wildcard $(KBUILD_OUTPUT)),, \
78 $(error output directory "$(saved-output)" does not exist))
79
80.PHONY: $(MAKECMDGOALS)
81
82$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile
83 $(MAKE) -C $(KBUILD_OUTPUT) \
84 top_srcdir=$(CURDIR) \
85 top_builddir=$(KBUILD_OUTPUT) \
86 TOPDIR=$(KBUILD_OUTPUT) \
87 KBUILD_SRC=$(CURDIR) \
88 -f $(CURDIR)/Makefile $@
89
90$(KBUILD_OUTPUT)/Rules.mak:
91 @echo > $@
92 @echo top_srcdir=$(CURDIR) >> $@
93 @echo top_builddir=$(KBUILD_OUTPUT) >> $@
94 @echo include $(top_srcdir)/Rules.mak >> $@
95
96$(KBUILD_OUTPUT)/Makefile:
97 @echo > $@
98 @echo top_srcdir=$(CURDIR) >> $@
99 @echo top_builddir=$(KBUILD_OUTPUT) >> $@
100 @echo KBUILD_SRC='$$(top_srcdir)' >> $@
101 @echo include '$$(KBUILD_SRC)'/Makefile >> $@
102
103# Leave processing to above invocation of make
104skip-makefile := 1
105endif # ifneq ($(KBUILD_OUTPUT),)
106endif # ifeq ($(KBUILD_SRC),)
107
108ifeq ($(skip-makefile),)
109
110_all: all
111
112ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
113
114all: busybox busybox.links doc
115
116all_tree: $(ALL_MAKEFILES)
117
118$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile
119 d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@
120
121# In this section, we need .config
122-include $(top_builddir)/.config.cmd
123include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
124-include $(top_builddir)/.depend
125
126busybox: $(ALL_MAKEFILES) .depend include/config.h $(libraries-y)
127 $(CC) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
128 $(STRIPCMD) $@
129
130busybox.links: $(top_srcdir)/applets/busybox.mkll include/config.h $(top_srcdir)/include/applets.h
131 - $(SHELL) $^ >$@
132
133install: applets/install.sh busybox busybox.links
134 $(SHELL) $< $(PREFIX)
135ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
136 @echo
137 @echo
138 @echo --------------------------------------------------
139 @echo You will probably need to make your busybox binary
140 @echo setuid root to ensure all configured applets will
141 @echo work properly.
142 @echo --------------------------------------------------
143 @echo
144endif
145
146uninstall: busybox.links
147 rm -f $(PREFIX)/bin/busybox
148 for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
149
150install-hardlinks: applets/install.sh busybox busybox.links
151 $(SHELL) $< $(PREFIX) --hardlinks
152
153check: busybox
154 bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
155 $(top_srcdir)/testsuite/runtest
156
157# Documentation Targets
158doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
159
160docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod
161 -mkdir -p docs
162 - ( cat $(top_srcdir)/docs/busybox_header.pod; \
163 $(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h; \
164 cat $(top_srcdir)/docs/busybox_footer.pod ) > docs/busybox.pod
165
166docs/BusyBox.txt: docs/busybox.pod
167 @echo
168 @echo BusyBox Documentation
169 @echo
170 -mkdir -p docs
171 -pod2text $< > $@
172
173docs/BusyBox.1: docs/busybox.pod
174 - mkdir -p docs
175 - pod2man --center=BusyBox --release="version $(VERSION)" \
176 $< > $@
177
178docs/BusyBox.html: docs/busybox.net/BusyBox.html
179 - mkdir -p docs
180 -@ rm -f docs/BusyBox.html
181 -@ cp docs/busybox.net/BusyBox.html docs/BusyBox.html
182
183docs/busybox.net/BusyBox.html: docs/busybox.pod
184 -@ mkdir -p docs/busybox.net
185 - pod2html --noindex $< > \
186 docs/busybox.net/BusyBox.html
187 -@ rm -f pod2htm*
188
189# The nifty new buildsystem stuff
190scripts/mkdep: $(top_srcdir)/scripts/mkdep.c
191 $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
192
193scripts/split-include: $(top_srcdir)/scripts/split-include.c
194 $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
195
196.depend: scripts/mkdep
197 rm -f .depend .hdepend;
198 mkdir -p include/config;
199 scripts/mkdep -I include -- \
200 `find $(top_srcdir) -name \*.c -print | sed -e "s,^./,,"` >> .depend;
201 scripts/mkdep -I include -- \
202 `find $(top_srcdir) -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
203
204depend dep: include/config.h .depend
205
206include/config/MARKER: depend scripts/split-include
207 scripts/split-include include/config.h include/config
208 @ touch include/config/MARKER
209
210include/config.h: .config
211 @if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
212 $(MAKE) -C scripts/config conf; \
213 fi;
214 @$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
215
216finished2:
217 @echo
218 @echo Finished installing...
219 @echo
220
221else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
222
223all: menuconfig
224
225# configuration
226# ---------------------------------------------------------------------------
227
228$(ALL_MAKEFILES): %/Makefile: $(top_srcdir)/%/Makefile
229 d=`dirname $@`; [ -d "$$d" ] || mkdir -p "$$d"; cp $< $@
230
231scripts/config/conf: scripts/config/Makefile Rules.mak
232 $(MAKE) -C scripts/config conf
233 -@if [ ! -f .config ] ; then \
234 cp $(CONFIG_DEFCONFIG) .config; \
235 fi
236
237scripts/config/mconf: scripts/config/Makefile Rules.mak
238 $(MAKE) -C scripts/config ncurses conf mconf
239 -@if [ ! -f .config ] ; then \
240 cp $(CONFIG_DEFCONFIG) .config; \
241 fi
242
243menuconfig: scripts/config/mconf
244 @./scripts/config/mconf $(CONFIG_CONFIG_IN)
245
246config: scripts/config/conf
247 @./scripts/config/conf $(CONFIG_CONFIG_IN)
248
249oldconfig: scripts/config/conf
250 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
251
252randconfig: scripts/config/conf
253 @./scripts/config/conf -r $(CONFIG_CONFIG_IN)
254
255allyesconfig: scripts/config/conf
256 @./scripts/config/conf -y $(CONFIG_CONFIG_IN)
257 sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
258 sed -i -e "s/^USING_CROSS_COMPILER.*/# USING_CROSS_COMPILER is not set/" .config
259 sed -i -e "s/^CONFIG_STATIC.*/# CONFIG_STATIC is not set/" .config
260 sed -i -e "s/^CONFIG_SELINUX.*/# CONFIG_SELINUX is not set/" .config
261 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
262
263allnoconfig: scripts/config/conf
264 @./scripts/config/conf -n $(CONFIG_CONFIG_IN)
265
266defconfig: scripts/config/conf
267 @./scripts/config/conf -d $(CONFIG_CONFIG_IN)
268
269clean:
270 - rm -f docs/busybox.dvi docs/busybox.ps \
271 docs/busybox.pod docs/busybox.net/busybox.html \
272 docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
273 docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
274 docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
275 .config.old .hdepend busybox
276 - rm -rf _install
277 - find . -name .\*.flags -exec rm -f {} \;
278 - find . -name \*.o -exec rm -f {} \;
279 - find . -name \*.a -exec rm -f {} \;
280
281distclean: clean
282 - rm -f scripts/split-include scripts/mkdep
283 - rm -rf include/config include/config.h
284 - find . -name .depend -exec rm -f {} \;
285 rm -f .config .config.old .config.cmd
286 - $(MAKE) -C scripts/config clean
287
288release: distclean #doc
289 cd ..; \
290 rm -rf $(PROG)-$(VERSION); \
291 cp -a busybox $(PROG)-$(VERSION); \
292 \
293 find $(PROG)-$(VERSION)/ -type d \
294 -name CVS \
295 -print \
296 -exec rm -rf {} \; ; \
297 \
298 find $(PROG)-$(VERSION)/ -type f \
299 -name .\#* \
300 -print \
301 -exec rm -f {} \; ; \
302 \
303 tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
304
305tags:
306 ctags -R .
307
308
309endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
310
311endif # ifeq ($(skip-makefile),)
312
313.PHONY: dummy subdirs release distclean clean config oldconfig \
314 menuconfig tags check test depend buildtree
315