diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 231 |
1 files changed, 103 insertions, 128 deletions
@@ -15,18 +15,11 @@ noconfig_targets := menuconfig config oldconfig randconfig \ | |||
15 | 15 | ||
16 | # the toplevel sourcedir | 16 | # the toplevel sourcedir |
17 | ifndef top_srcdir | 17 | ifndef top_srcdir |
18 | # make-3.79.1 didn't support MAKEFILE_LIST | 18 | top_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 | ||
21 | ifdef MAKEFILE_LIST | ||
22 | top_srcdir:=$(shell cd $(dir $(firstword $(MAKEFILE_LIST))) && pwd) | ||
23 | else | ||
24 | top_srcdir:=$(CURDIR) | ||
25 | endif | ||
26 | endif | 19 | endif |
27 | # toplevel directory of the object-tree | 20 | # toplevel directory of the object-tree |
28 | ifndef top_builddir | 21 | ifndef top_builddir |
29 | top_builddir:=$(CURDIR) | 22 | top_builddir=$(CURDIR) |
30 | endif | 23 | endif |
31 | 24 | ||
32 | export srctree=$(top_srcdir) | 25 | export 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 | 39 | CONFIG_CONFIG_IN = $(top_srcdir)/Config.in |
46 | 40 | ||
47 | # see if we are in verbose mode | 41 | ifeq ($(KBUILD_SRC),) |
48 | ifdef VERBOSE | ||
49 | CHECK_VERBOSE := -v | ||
50 | PACKAGE_BE_VERBOSE := $(VERBOSE) | ||
51 | endif | ||
52 | ifdef V | ||
53 | CHECK_VERBOSE := -v | ||
54 | PACKAGE_BE_VERBOSE := $(V) | ||
55 | endif | ||
56 | 42 | ||
57 | ifdef O | 43 | ifdef 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 |
62 | else | 48 | else |
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) | ||
65 | endif | 53 | endif |
66 | 54 | ||
67 | define check_gcc | 55 | ifneq ($(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 |
69 | endef | 57 | -include $(top_srcdir)/Rules.mak |
70 | |||
71 | define 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))) | ||
73 | endef | ||
74 | |||
75 | ####################################################################### | ||
76 | # make-3.79.1 doesn't support order-only prerequisites.. | ||
77 | ifeq ($(MAKE_VERSION),3.79.1) | ||
78 | |: $(^) ; | ||
79 | endif | 58 | endif |
80 | ####################################################################### | ||
81 | 59 | ||
82 | 60 | # All object directories. | |
83 | 61 | OBJ_DIRS := $(DIRS) | |
84 | # Handle building out of tree | 62 | all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include) |
85 | ifneq ($(top_builddir),$(top_srcdir)) | 63 | all_tree: $(all_tree) |
86 | all_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 | ||
90 | saved-output := $(PACKAGE_OUTPUTDIR) | 67 | ifneq ($(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 |
70 | saved-output := $(KBUILD_OUTPUT) | ||
71 | KBUILD_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 | ||
98 | skip-makefile := 1 | ||
99 | endif # ifneq ($(KBUILD_OUTPUT),) | ||
100 | endif # ifeq ($(KBUILD_SRC),) | ||
110 | 101 | ||
111 | buildtree := $(all_tree) $(PACKAGE_OUTPUTDIR)/Rules.mak $(PACKAGE_OUTPUTDIR)/Makefile | 102 | ifeq ($(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. |
115 | scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile | $(buildtree) | 106 | scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile |
116 | @cp $(top_srcdir)/scripts/config/Makefile $@ | 107 | cp $< $@ |
117 | 108 | ||
118 | else | 109 | _all: all |
119 | all_tree := include/config | ||
120 | $(all_tree): | ||
121 | @mkdir -p "$@" | ||
122 | buildtree := $(all_tree) | ||
123 | endif # ifneq ($(PACKAGE_OUTPUTDIR),$(top_srcdir)) | ||
124 | 110 | ||
125 | help: | 111 | help: |
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 | |
142 | include $(top_srcdir)/Rules.mak | ||
162 | 143 | ||
163 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y) | 144 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y) |
145 | |||
164 | # Default target if none was requested explicitly | 146 | # Default target if none was requested explicitly |
165 | all: menuconfig ; | 147 | all: defconfig menuconfig |
166 | 148 | ||
167 | ifneq ($(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 |
175 | else | ||
176 | # Avoid implicit rule to kick in by using an empty command | ||
177 | .config: $(buildtree) ; | ||
178 | endif | ||
179 | endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) | ||
180 | |||
181 | 156 | ||
182 | # configuration | 157 | # configuration |
183 | # --------------------------------------------------------------------------- | 158 | # --------------------------------------------------------------------------- |
184 | 159 | ||
185 | CONFIG_CONFIG_IN = $(top_srcdir)/Config.in | ||
186 | |||
187 | scripts/config/conf: scripts/config/Makefile | 160 | scripts/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 | ||
190 | scripts/config/mconf: scripts/config/Makefile | 166 | scripts/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 | ||
193 | menuconfig: scripts/config/mconf | 172 | menuconfig: 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 | |||
223 | allbareconfig: scripts/config/conf | 203 | allbareconfig: 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 | ||
230 | ifeq ($(strip $(HAVE_DOT_CONFIG)),y) | 210 | else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) |
231 | 211 | ||
232 | # Load all Config.in | 212 | all: busybox busybox.links doc |
233 | -include $(top_builddir)/.config.cmd | ||
234 | 213 | ||
235 | endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y) | 214 | # In this section, we need .config |
215 | -include $(top_builddir)/.config.cmd | ||
216 | include $(patsubst %,%/Makefile.in, $(SRC_DIRS)) | ||
236 | 217 | ||
237 | include $(patsubst %,%/Makefile.in,$(SRC_DIRS)) | 218 | endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) |
238 | 219 | ||
239 | ifeq ($(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 | |||
247 | all: 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 | ||
253 | ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) | 224 | ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) |
254 | libraries-y:= | 225 | libraries-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. |
270 | libbusybox-obj:=archival/libunarchive/libunarchive.a \ | 241 | libbusybox-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 |
274 | libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj)) | 246 | libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj)) |
247 | |||
275 | ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) | 248 | ifeq ($(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 |
277 | libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y)) | 250 | libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y)) |
278 | endif # CONFIG_FEATURE_SHARED_BUSYBOX | 251 | endif # CONFIG_FEATURE_SHARED_BUSYBOX |
279 | |||
280 | endif # CONFIG_BUILD_AT_ONCE | 252 | endif # CONFIG_BUILD_AT_ONCE |
281 | 253 | ||
254 | |||
282 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | 255 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) |
283 | LD_LIBBUSYBOX:=libbusybox.so | 256 | LD_LIBBUSYBOX:=libbusybox.so |
284 | LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION) | 257 | LIBBUSYBOX_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 | ||
289 | endif # CONFIG_BUILD_LIBBUSYBOX | ||
290 | |||
291 | ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) | 262 | ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) |
292 | ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) | 263 | ifneq ($(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 |
294 | BUSYBOX_SRC := $(LIBRARY_SRC) | 265 | BUSYBOX_SRC := $(LIBRARY_SRC) |
295 | BUSYBOX_DEFINE:= $(LIBRARY_DEFINE) | 266 | BUSYBOX_DEFINE:= $(LIBRARY_DEFINE) |
296 | endif # !CONFIG_FEATURE_SHARED_BUSYBOX | 267 | endif # !CONFIG_FEATURE_SHARED_BUSYBOX |
297 | $(LIBBUSYBOX_SONAME): $(LIBRARY_SRC) | 268 | $(LIBBUSYBOX_SONAME): $(LIBRARY_SRC) |
298 | else # CONFIG_BUILD_AT_ONCE | 269 | else # CONFIG_BUILD_AT_ONCE |
299 | $(LIBBUSYBOX_SONAME): $(libbusybox-obj) | 270 | $(LIBBUSYBOX_SONAME): $(libbusybox-obj) |
300 | AR_INTRO:=-Wl,--whole-archive | ||
301 | AR_EXTRO:=-Wl,--no-whole-archive | ||
302 | endif # CONFIG_BUILD_AT_ONCE | 271 | endif # CONFIG_BUILD_AT_ONCE |
303 | 272 | endif # CONFIG_BUILD_LIBBUSYBOX | |
304 | 273 | ||
305 | ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) | 274 | ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) |
306 | LDBUSYBOX:=-L$(top_builddir) -lbusybox | 275 | LDBUSYBOX:=-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 | ||
325 | endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | 294 | endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) |
326 | 295 | ||
327 | busybox_unstripped: $(top_builddir)/.depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y) | 296 | busybox_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 |
366 | endif | 332 | endif |
367 | 333 | ||
334 | # see if we are in verbose mode | ||
335 | KBUILD_VERBOSE := | ||
336 | ifdef V | ||
337 | ifeq ("$(origin V)", "command line") | ||
338 | KBUILD_VERBOSE := $(V) | ||
339 | endif | ||
340 | endif | ||
341 | ifneq ($(strip $(KBUILD_VERBOSE)),) | ||
342 | CHECK_VERBOSE := -v | ||
343 | # ARFLAGS+=v | ||
344 | endif | ||
368 | check test: busybox | 345 | check 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 |
376 | doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html ; | 353 | doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html |
377 | 354 | ||
378 | docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod $(top_srcdir)/docs/autodocifier.pl | 355 | docs/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 |
409 | scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c | 386 | scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c |
410 | $(do_link.h) | 387 | $(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ $< |
411 | 388 | ||
412 | DEP_INCLUDES := include/bb_config.h | 389 | DEP_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 > $@ |
420 | endif | 397 | endif |
421 | 398 | ||
422 | depend dep: $(top_builddir)/.depend ; | 399 | depend 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 | ||
430 | include/bb_config.h: .config | 407 | include/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 | ||
434 | endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y) | ||
435 | |||
436 | clean: | 413 | clean: |
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 | ||
448 | distclean: clean | 426 | distclean: 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 | ||
455 | release: distclean #doc | 432 | release: distclean #doc |
@@ -472,10 +449,8 @@ release: distclean #doc | |||
472 | tags: | 449 | tags: |
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 | ||
453 | endif # ifeq ($(skip-makefile),) | ||
454 | |||
455 | .PHONY: dummy subdirs release distclean clean config oldconfig \ | ||
456 | menuconfig tags check test depend dep buildtree | ||