aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile231
1 files changed, 103 insertions, 128 deletions
diff --git a/Makefile b/Makefile
index 879c4d6e5..fe346b0d4 100644
--- a/Makefile
+++ b/Makefile
@@ -15,18 +15,11 @@ noconfig_targets := menuconfig config oldconfig randconfig \
15 15
16# the toplevel sourcedir 16# the toplevel sourcedir
17ifndef top_srcdir 17ifndef top_srcdir
18# make-3.79.1 didn't support MAKEFILE_LIST 18top_srcdir=$(CURDIR)
19# for building out-of-tree, users of make-3.79.1 still have to pass top_srcdir=
20# to make: make -f /srcs/busybox/Makefile top_srcdir=/srcs/busybox
21ifdef MAKEFILE_LIST
22top_srcdir:=$(shell cd $(dir $(firstword $(MAKEFILE_LIST))) && pwd)
23else
24top_srcdir:=$(CURDIR)
25endif
26endif 19endif
27# toplevel directory of the object-tree 20# toplevel directory of the object-tree
28ifndef top_builddir 21ifndef top_builddir
29top_builddir:=$(CURDIR) 22top_builddir=$(CURDIR)
30endif 23endif
31 24
32export srctree=$(top_srcdir) 25export srctree=$(top_srcdir)
@@ -41,86 +34,79 @@ SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
41 34
42# That's our default target when none is given on the command line 35# That's our default target when none is given on the command line
43.PHONY: _all 36.PHONY: _all
37_all:
44 38
45_all: all 39CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
46 40
47# see if we are in verbose mode 41ifeq ($(KBUILD_SRC),)
48ifdef VERBOSE
49 CHECK_VERBOSE := -v
50 PACKAGE_BE_VERBOSE := $(VERBOSE)
51endif
52ifdef V
53 CHECK_VERBOSE := -v
54 PACKAGE_BE_VERBOSE := $(V)
55endif
56 42
57ifdef O 43ifdef O
58 ifeq ("$(origin O)", "command line") 44 ifeq ("$(origin O)", "command line")
59 PACKAGE_OUTPUTDIR := $(shell cd $(O) && pwd) 45 KBUILD_OUTPUT := $(O)
60 top_builddir := $(PACKAGE_OUTPUTDIR) 46 top_builddir := $(O)
61 endif 47 endif
62else 48else
63# If no alternate output-dir was specified, we build in cwd 49# If no alternate output-dir was specified, we build in cwd
64 PACKAGE_OUTPUTDIR := $(top_builddir) 50# We are using KBUILD_OUTPUT nevertheless to make sure that we create
51# Rules.mak and the toplevel Makefile, in case they don't exist.
52 KBUILD_OUTPUT := $(top_builddir)
65endif 53endif
66 54
67define check_gcc 55ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
68$(if $(2),$(if $(shell $(CC) $(2) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 && echo y),$(2),$(if $(3),$(3))),$(if $(3),$(3))) 56# pull in OS specific commands like cp, mkdir, etc. early
69endef 57-include $(top_srcdir)/Rules.mak
70
71define check_ld
72$(if $(2),$(if $(shell $(LD) $(2) -o /dev/null -b binary /dev/null > /dev/null 2>&1 && echo y),$(shell echo \-Wl,$(2)),$(if $(3),$(3))),$(if $(3),$(3)))
73endef
74
75#######################################################################
76# make-3.79.1 doesn't support order-only prerequisites..
77ifeq ($(MAKE_VERSION),3.79.1)
78|: $(^) ;
79endif 58endif
80#######################################################################
81 59
82 60# All object directories.
83 61OBJ_DIRS := $(DIRS)
84# Handle building out of tree 62all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include)
85ifneq ($(top_builddir),$(top_srcdir)) 63all_tree: $(all_tree)
86all_tree := $(patsubst %,$(top_builddir)/%,$(DIRS) scripts scripts/config include include/config)
87$(all_tree): 64$(all_tree):
88 @mkdir -p "$@" 65 @mkdir -p "$@"
89 66
90saved-output := $(PACKAGE_OUTPUTDIR) 67ifneq ($(KBUILD_OUTPUT),)
91 68# Invoke a second make in the output directory, passing relevant variables
92$(if $(wildcard $(PACKAGE_OUTPUTDIR)),, \ 69# Check that the output directory actually exists
70saved-output := $(KBUILD_OUTPUT)
71KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
72$(if $(wildcard $(KBUILD_OUTPUT)),, \
93 $(error output directory "$(saved-output)" does not exist)) 73 $(error output directory "$(saved-output)" does not exist))
94 74
95.PHONY: $(filter $(noconfig_targets),$(MAKECMDGOALS)) 75.PHONY: $(MAKECMDGOALS)
76
77$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree
78 $(Q)$(MAKE) -C $(KBUILD_OUTPUT) \
79 top_srcdir=$(top_srcdir) \
80 top_builddir=$(top_builddir) \
81 KBUILD_SRC=$(top_srcdir) \
82 -f $(CURDIR)/Makefile $@
96 83
97$(PACKAGE_OUTPUTDIR)/Rules.mak: 84$(KBUILD_OUTPUT)/Rules.mak:
98 @echo > $@ 85 @echo > $@
99 @echo top_srcdir=$(top_srcdir) >> $@ 86 @echo top_srcdir=$(top_srcdir) >> $@
100 @echo top_builddir=$(PACKAGE_OUTPUTDIR) >> $@ 87 @echo top_builddir=$(KBUILD_OUTPUT) >> $@
101 @echo include $$\(top_srcdir\)/Rules.mak >> $@ 88 @echo include $(top_srcdir)/Rules.mak >> $@
102 89
103$(PACKAGE_OUTPUTDIR)/Makefile: 90$(KBUILD_OUTPUT)/Makefile:
104 @echo > $@ 91 @echo > $@
105 @echo top_srcdir=$(top_srcdir) >> $@ 92 @echo top_srcdir=$(top_srcdir) >> $@
106 @echo top_builddir=$(PACKAGE_OUTPUTDIR) >> $@ 93 @echo top_builddir=$(KBUILD_OUTPUT) >> $@
107 @echo PACKAGE_SOURCEDIR='$$(top_srcdir)' >> $@ 94 @echo KBUILD_SRC='$$(top_srcdir)' >> $@
108 @echo include '$$(PACKAGE_SOURCEDIR)'/Makefile >> $@ 95 @echo include '$$(KBUILD_SRC)'/Makefile >> $@
109 96
97# Leave processing to above invocation of make
98skip-makefile := 1
99endif # ifneq ($(KBUILD_OUTPUT),)
100endif # ifeq ($(KBUILD_SRC),)
110 101
111buildtree := $(all_tree) $(PACKAGE_OUTPUTDIR)/Rules.mak $(PACKAGE_OUTPUTDIR)/Makefile 102ifeq ($(skip-makefile),)
112 103
113# We only need a copy of the Makefile for the config targets and reuse 104# We only need a copy of the Makefile for the config targets and reuse
114# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES. 105# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
115scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile | $(buildtree) 106scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
116 @cp $(top_srcdir)/scripts/config/Makefile $@ 107 cp $< $@
117 108
118else 109_all: all
119all_tree := include/config
120$(all_tree):
121 @mkdir -p "$@"
122buildtree := $(all_tree)
123endif # ifneq ($(PACKAGE_OUTPUTDIR),$(top_srcdir))
124 110
125help: 111help:
126 @echo 'Cleaning:' 112 @echo 'Cleaning:'
@@ -151,44 +137,37 @@ help:
151 @echo ' release - create a distribution tarball' 137 @echo ' release - create a distribution tarball'
152 @echo ' sizes - show size of all enabled busybox symbols' 138 @echo ' sizes - show size of all enabled busybox symbols'
153 @echo 139 @echo
154 @echo 'Make flags:'
155 @echo ' V=<number> - print verbose make output (default: unset)'
156 @echo ' 0 print CC invocations'
157 @echo ' 1'
158 @echo ' 2 also print when make enters a directory'
159 @echo ' 3 also verbosely print shell invocations'
160 140
161-include $(top_srcdir)/Rules.mak 141
142include $(top_srcdir)/Rules.mak
162 143
163ifneq ($(strip $(HAVE_DOT_CONFIG)),y) 144ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
145
164# Default target if none was requested explicitly 146# Default target if none was requested explicitly
165all: menuconfig ; 147all: defconfig menuconfig
166 148
167ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
168# warn if no configuration exists and we are asked to build a non-config target 149# warn if no configuration exists and we are asked to build a non-config target
169.config: 150.config:
170 @echo "" 151 @echo ""
171 @echo "No $(top_builddir)/$@ found!" 152 @echo "No $(top_builddir)/$@ found!"
172 @echo "Please refer to 'make help', section Configuration." 153 @echo "Please refer to 'make help', section Configuration."
173 @echo "" 154 @echo ""
174 @exit 1 155 @exit 1
175else
176# Avoid implicit rule to kick in by using an empty command
177.config: $(buildtree) ;
178endif
179endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
180
181 156
182# configuration 157# configuration
183# --------------------------------------------------------------------------- 158# ---------------------------------------------------------------------------
184 159
185CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
186
187scripts/config/conf: scripts/config/Makefile 160scripts/config/conf: scripts/config/Makefile
188 $(Q)$(MAKE) -C scripts/config conf 161 $(Q)$(MAKE) -C scripts/config conf
162 -@if [ ! -f .config ] ; then \
163 touch .config; \
164 fi
189 165
190scripts/config/mconf: scripts/config/Makefile 166scripts/config/mconf: scripts/config/Makefile
191 $(Q)$(MAKE) -C scripts/config ncurses conf mconf 167 $(Q)$(MAKE) -C scripts/config ncurses conf mconf
168 -@if [ ! -f .config ] ; then \
169 touch .config; \
170 fi
192 171
193menuconfig: scripts/config/mconf 172menuconfig: scripts/config/mconf
194 @[ -f .config ] || make $(MAKEFLAGS) defconfig 173 @[ -f .config ] || make $(MAKEFLAGS) defconfig
@@ -220,6 +199,7 @@ defconfig: scripts/config/conf
220 @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config 199 @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
221 @./scripts/config/conf -o $(CONFIG_CONFIG_IN) 200 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
222 201
202
223allbareconfig: scripts/config/conf 203allbareconfig: scripts/config/conf
224 @./scripts/config/conf -y $(CONFIG_CONFIG_IN) 204 @./scripts/config/conf -y $(CONFIG_CONFIG_IN)
225 @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config 205 @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
@@ -227,28 +207,19 @@ allbareconfig: scripts/config/conf
227 @echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config 207 @echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config
228 @./scripts/config/conf -o $(CONFIG_CONFIG_IN) 208 @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
229 209
230ifeq ($(strip $(HAVE_DOT_CONFIG)),y) 210else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
231 211
232# Load all Config.in 212all: busybox busybox.links doc
233-include $(top_builddir)/.config.cmd
234 213
235endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y) 214# In this section, we need .config
215-include $(top_builddir)/.config.cmd
216include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
236 217
237include $(patsubst %,%/Makefile.in,$(SRC_DIRS)) 218endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
238 219
239ifeq ($(strip $(HAVE_DOT_CONFIG)),y) 220-include $(top_builddir)/.config
240# Finally pull in the dependencies (headers and other includes) of the
241# individual object files
242-include $(top_builddir)/.depend 221-include $(top_builddir)/.depend
243 222
244$(top_builddir)/applets/applets.o: $(top_builddir)/.config
245# Everything is set.
246
247all: busybox busybox.links doc ;
248
249# Two modes of operation: legacy and IMA
250# Legacy mode builds each object through an individual invocation of CC
251# IMA compiles all sources at once (aka IPO aka IPA etc.)
252 223
253ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) 224ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
254libraries-y:= 225libraries-y:=
@@ -269,16 +240,18 @@ else # CONFIG_BUILD_AT_ONCE
269# This was the old way the binary was built. 240# This was the old way the binary was built.
270libbusybox-obj:=archival/libunarchive/libunarchive.a \ 241libbusybox-obj:=archival/libunarchive/libunarchive.a \
271 networking/libiproute/libiproute.a \ 242 networking/libiproute/libiproute.a \
272 libpwdgrp/libpwdgrp.a coreutils/libcoreutils/libcoreutils.a \ 243 libpwdgrp/libpwdgrp.a \
244 coreutils/libcoreutils/libcoreutils.a \
273 libbb/libbb.a 245 libbb/libbb.a
274libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj)) 246libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj))
247
275ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) 248ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
276# linking against libbusybox, so don't build the .a already contained in the .so 249# linking against libbusybox, so don't build the .a already contained in the .so
277libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y)) 250libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y))
278endif # CONFIG_FEATURE_SHARED_BUSYBOX 251endif # CONFIG_FEATURE_SHARED_BUSYBOX
279
280endif # CONFIG_BUILD_AT_ONCE 252endif # CONFIG_BUILD_AT_ONCE
281 253
254
282ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) 255ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
283LD_LIBBUSYBOX:=libbusybox.so 256LD_LIBBUSYBOX:=libbusybox.so
284LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION) 257LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)
@@ -286,21 +259,17 @@ DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \
286 $(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ 259 $(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
287 $(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION) 260 $(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION)
288 261
289endif # CONFIG_BUILD_LIBBUSYBOX
290
291ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) 262ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
292ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) 263ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
293# --combine but not linking against libbusybox, so compile lib*.c 264# --combine but not linking against libbusybox, so compile all
294BUSYBOX_SRC := $(LIBRARY_SRC) 265BUSYBOX_SRC := $(LIBRARY_SRC)
295BUSYBOX_DEFINE:= $(LIBRARY_DEFINE) 266BUSYBOX_DEFINE:= $(LIBRARY_DEFINE)
296endif # !CONFIG_FEATURE_SHARED_BUSYBOX 267endif # !CONFIG_FEATURE_SHARED_BUSYBOX
297$(LIBBUSYBOX_SONAME): $(LIBRARY_SRC) 268$(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
298else # CONFIG_BUILD_AT_ONCE 269else # CONFIG_BUILD_AT_ONCE
299$(LIBBUSYBOX_SONAME): $(libbusybox-obj) 270$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
300AR_INTRO:=-Wl,--whole-archive
301AR_EXTRO:=-Wl,--no-whole-archive
302endif # CONFIG_BUILD_AT_ONCE 271endif # CONFIG_BUILD_AT_ONCE
303 272endif # CONFIG_BUILD_LIBBUSYBOX
304 273
305ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) 274ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
306LDBUSYBOX:=-L$(top_builddir) -lbusybox 275LDBUSYBOX:=-L$(top_builddir) -lbusybox
@@ -315,23 +284,20 @@ endif
315 -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ 284 -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
316 -Wl,-z,combreloc $(LIB_LDFLAGS) \ 285 -Wl,-z,combreloc $(LIB_LDFLAGS) \
317 -o $(@) \ 286 -o $(@) \
318 -Wl,--start-group \ 287 -Wl,--start-group -Wl,--whole-archive \
319 $(LIBRARY_DEFINE) $(AR_INTRO) $(^) $(AR_EXTRO) \ 288 $(LIBRARY_DEFINE) $(^) \
320 -Wl,--end-group 289 -Wl,--no-whole-archive -Wl,--end-group
321 @rm -f $(DO_INSTALL_LIBS) 290 @rm -f $(DO_INSTALL_LIBS)
322 @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done 291 @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done
323 $(do_strip) 292 $(do_strip)
324 293
325endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) 294endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
326 295
327busybox_unstripped: $(top_builddir)/.depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y) 296busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(libraries-y)
328 $(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \ 297 $(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
329 $(foreach f,$(^:.o=.c),$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \ 298 -o $@ -Wl,--start-group \
330 $(CFLAGS-$(@)) \
331 -o $@ -Wl,--start-group \
332 $(APPLETS_DEFINE) $(APPLET_SRC) \ 299 $(APPLETS_DEFINE) $(APPLET_SRC) \
333 $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) \ 300 $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
334 $(libraries-y) \
335 $(LDBUSYBOX) $(LIBRARIES) \ 301 $(LDBUSYBOX) $(LIBRARIES) \
336 -Wl,--end-group 302 -Wl,--end-group
337 303
@@ -365,6 +331,17 @@ ifneq ($(strip $(DO_INSTALL_LIBS)),n)
365 done 331 done
366endif 332endif
367 333
334# see if we are in verbose mode
335KBUILD_VERBOSE :=
336ifdef V
337 ifeq ("$(origin V)", "command line")
338 KBUILD_VERBOSE := $(V)
339 endif
340endif
341ifneq ($(strip $(KBUILD_VERBOSE)),)
342 CHECK_VERBOSE := -v
343# ARFLAGS+=v
344endif
368check test: busybox 345check test: busybox
369 bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \ 346 bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
370 $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE) 347 $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
@@ -373,7 +350,7 @@ sizes: busybox_unstripped
373 $(NM) --size-sort $(<) 350 $(NM) --size-sort $(<)
374 351
375# Documentation Targets 352# Documentation Targets
376doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html ; 353doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
377 354
378docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod $(top_srcdir)/docs/autodocifier.pl 355docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod $(top_srcdir)/docs/autodocifier.pl
379 $(disp_doc) 356 $(disp_doc)
@@ -407,7 +384,7 @@ docs/busybox.net/BusyBox.html: docs/busybox.pod
407 384
408# The nifty new dependency stuff 385# The nifty new dependency stuff
409scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c 386scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
410 $(do_link.h) 387 $(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
411 388
412DEP_INCLUDES := include/bb_config.h 389DEP_INCLUDES := include/bb_config.h
413 390
@@ -419,21 +396,22 @@ include/bbconfigopts.h: .config
419 $(Q)$(top_srcdir)/scripts/config/mkconfigs > $@ 396 $(Q)$(top_srcdir)/scripts/config/mkconfigs > $@
420endif 397endif
421 398
422depend dep: $(top_builddir)/.depend ; 399depend dep: .depend
423$(top_builddir)/.depend: $(buildtree) scripts/bb_mkdep $(DEP_INCLUDES) 400.depend: scripts/bb_mkdep $(DEP_INCLUDES)
424 $(disp_gen) 401 $(disp_gen)
425 $(Q)rm -f .depend 402 $(Q)rm -f .depend
426 $(Q)scripts/bb_mkdep $(MKDEP_ARGS) \ 403 $(Q)mkdir -p include/config
427 -I $(top_srcdir)/include $(top_srcdir) > $@.tmp 404 $(Q)scripts/bb_mkdep -I $(top_srcdir)/include $(top_srcdir) > $@.tmp
428 $(Q)mv $@.tmp $@ 405 $(Q)mv $@.tmp $@
429 406
430include/bb_config.h: .config 407include/bb_config.h: .config
431 $(disp_gen) 408 @if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \
409 $(MAKE) -C scripts/config conf; \
410 fi;
432 @$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN) 411 @$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
433 412
434endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
435
436clean: 413clean:
414 - $(MAKE) -C scripts/config $@
437 - rm -f docs/busybox.dvi docs/busybox.ps \ 415 - rm -f docs/busybox.dvi docs/busybox.ps \
438 docs/busybox.pod docs/busybox.net/busybox.html \ 416 docs/busybox.pod docs/busybox.net/busybox.html \
439 docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \ 417 docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
@@ -446,10 +424,9 @@ clean:
446 -o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f 424 -o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f
447 425
448distclean: clean 426distclean: clean
449 - $(MAKE) -C scripts/config clean
450 - rm -f scripts/bb_mkdep 427 - rm -f scripts/bb_mkdep
451 - rm -r -f include/config $(DEP_INCLUDES) 428 - rm -r -f include/config $(DEP_INCLUDES)
452 - find . -name .depend'*' | xargs rm -f 429 - find . -name .depend'*' | xargs rm -f
453 rm -f .config .config.old .config.cmd 430 rm -f .config .config.old .config.cmd
454 431
455release: distclean #doc 432release: distclean #doc
@@ -472,10 +449,8 @@ release: distclean #doc
472tags: 449tags:
473 ctags -R . 450 ctags -R .
474 451
475# keep these in sync with noconfig_targets above!
476.PHONY: dummy subdirs check test depend dep buildtree \
477 menuconfig config oldconfig randconfig \
478 defconfig allyesconfig allnoconfig allbareconfig \
479 clean distclean \
480 release tags
481 452
453endif # ifeq ($(skip-makefile),)
454
455.PHONY: dummy subdirs release distclean clean config oldconfig \
456 menuconfig tags check test depend dep buildtree