aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-06-13 14:20:17 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-06-13 14:20:17 +0000
commit7b8ff22685339709c84a67fcb43147c2e4971afa (patch)
tree3119c4c8a74435b746a5d3b2dee7e4db99507d02
parent2f6a3179446c83c23347fc7f7aef05c51310c6db (diff)
downloadbusybox-w32-7b8ff22685339709c84a67fcb43147c2e4971afa.tar.gz
busybox-w32-7b8ff22685339709c84a67fcb43147c2e4971afa.tar.bz2
busybox-w32-7b8ff22685339709c84a67fcb43147c2e4971afa.zip
- make VERBOSE= and V= work equally; use BUILD_VERBOSE internally.
- move the link flags to cmd_link* so they are printed when requesting verbose output
-rw-r--r--Makefile85
-rw-r--r--Rules.mak22
2 files changed, 58 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index 27e51e35e..036888e3d 100644
--- a/Makefile
+++ b/Makefile
@@ -43,18 +43,36 @@ _all:
43 43
44CONFIG_CONFIG_IN = $(top_srcdir)/Config.in 44CONFIG_CONFIG_IN = $(top_srcdir)/Config.in
45 45
46ifeq ($(KBUILD_SRC),) 46ifeq ($(BUILD_SRC),)
47
48ifdef O 47ifdef O
49 ifeq ("$(origin O)", "command line") 48 ifeq ("$(origin O)", "command line")
50 KBUILD_OUTPUT := $(O) 49 BUILD_OUTPUT := $(O)
51 top_builddir := $(O) 50 top_builddir := $(O)
52 endif 51 endif
53else 52else
54# If no alternate output-dir was specified, we build in cwd 53# If no alternate output-dir was specified, we build in cwd
55# We are using KBUILD_OUTPUT nevertheless to make sure that we create 54# We are using BUILD_OUTPUT nevertheless to make sure that we create
56# Rules.mak and the toplevel Makefile, in case they don't exist. 55# Rules.mak and the toplevel Makefile, in case they don't exist.
57 KBUILD_OUTPUT := $(top_builddir) 56 BUILD_OUTPUT := $(top_builddir)
57endif
58
59# see if we are in verbose mode
60BUILD_VERBOSE :=
61ifdef V
62 ifeq ("$(origin V)", "command line")
63 BUILD_VERBOSE := $(V)
64 endif
65endif
66ifdef VERBOSE
67 ifeq ("$(origin VERBOSE)", "command line")
68 BUILD_VERBOSE := $(VERBOSE)
69 endif
70endif
71
72ifneq ($(strip $(BUILD_VERBOSE)),)
73 export BUILD_VERBOSE
74 CHECK_VERBOSE := -v
75# ARFLAGS+=v
58endif 76endif
59 77
60ifneq ($(strip $(HAVE_DOT_CONFIG)),y) 78ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
@@ -69,40 +87,40 @@ all_tree: $(all_tree)
69$(all_tree): 87$(all_tree):
70 @mkdir -p "$@" 88 @mkdir -p "$@"
71 89
72ifneq ($(KBUILD_OUTPUT),) 90ifneq ($(BUILD_OUTPUT),)
73# Invoke a second make in the output directory, passing relevant variables 91# Invoke a second make in the output directory, passing relevant variables
74# Check that the output directory actually exists 92# Check that the output directory actually exists
75saved-output := $(KBUILD_OUTPUT) 93saved-output := $(BUILD_OUTPUT)
76KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) 94BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd)
77$(if $(wildcard $(KBUILD_OUTPUT)),, \ 95$(if $(wildcard $(BUILD_OUTPUT)),, \
78 $(error output directory "$(saved-output)" does not exist)) 96 $(error output directory "$(saved-output)" does not exist))
79 97
80.PHONY: $(MAKECMDGOALS) 98.PHONY: $(MAKECMDGOALS)
81 99
82$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree 100$(filter-out _all,$(MAKECMDGOALS)) _all: $(BUILD_OUTPUT)/Rules.mak $(BUILD_OUTPUT)/Makefile all_tree
83 $(Q)$(MAKE) -C $(KBUILD_OUTPUT) \ 101 $(Q)$(MAKE) -C $(BUILD_OUTPUT) \
84 top_srcdir=$(top_srcdir) \ 102 top_srcdir=$(top_srcdir) \
85 top_builddir=$(top_builddir) \ 103 top_builddir=$(top_builddir) \
86 KBUILD_SRC=$(top_srcdir) \ 104 BUILD_SRC=$(top_srcdir) \
87 -f $(CURDIR)/Makefile $@ 105 -f $(CURDIR)/Makefile $@
88 106
89$(KBUILD_OUTPUT)/Rules.mak: 107$(BUILD_OUTPUT)/Rules.mak:
90 @echo > $@ 108 @echo > $@
91 @echo top_srcdir=$(top_srcdir) >> $@ 109 @echo top_srcdir=$(top_srcdir) >> $@
92 @echo top_builddir=$(KBUILD_OUTPUT) >> $@ 110 @echo top_builddir=$(BUILD_OUTPUT) >> $@
93 @echo include $(top_srcdir)/Rules.mak >> $@ 111 @echo include $(top_srcdir)/Rules.mak >> $@
94 112
95$(KBUILD_OUTPUT)/Makefile: 113$(BUILD_OUTPUT)/Makefile:
96 @echo > $@ 114 @echo > $@
97 @echo top_srcdir=$(top_srcdir) >> $@ 115 @echo top_srcdir=$(top_srcdir) >> $@
98 @echo top_builddir=$(KBUILD_OUTPUT) >> $@ 116 @echo top_builddir=$(BUILD_OUTPUT) >> $@
99 @echo KBUILD_SRC='$$(top_srcdir)' >> $@ 117 @echo BUILD_SRC='$$(top_srcdir)' >> $@
100 @echo include '$$(KBUILD_SRC)'/Makefile >> $@ 118 @echo include '$$(BUILD_SRC)'/Makefile >> $@
101 119
102# Leave processing to above invocation of make 120# Leave processing to above invocation of make
103skip-makefile := 1 121skip-makefile := 1
104endif # ifneq ($(KBUILD_OUTPUT),) 122endif # ifneq ($(BUILD_OUTPUT),)
105endif # ifeq ($(KBUILD_SRC),) 123endif # ifeq ($(BUILD_SRC),)
106 124
107ifeq ($(skip-makefile),) 125ifeq ($(skip-makefile),)
108 126
@@ -305,13 +323,9 @@ $(LIBBUSYBOX_SONAME):
305ifndef MAJOR_VERSION 323ifndef MAJOR_VERSION
306 $(error MAJOR_VERSION needed for $@ is not defined) 324 $(error MAJOR_VERSION needed for $@ is not defined)
307endif 325endif
308 $(do_link) $(LIB_CFLAGS) $(CFLAGS_COMBINE) \ 326 $(do_link.so) \
309 -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ 327 -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
310 -Wl,-z,combreloc $(LIB_LDFLAGS) \ 328 -Wl,-z,combreloc
311 -o $(@) \
312 $(LD_START_GROUP) $(LD_WHOLE_ARCHIVE) \
313 $(LIBRARY_DEFINE) $(^) \
314 $(LD_NO_WHOLE_ARCHIVE) $(LD_END_GROUP)
315 @rm -f $(DO_INSTALL_LIBS) 329 @rm -f $(DO_INSTALL_LIBS)
316 @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done 330 @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done
317 $(do_strip) 331 $(do_strip)
@@ -319,12 +333,7 @@ endif
319endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) 333endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
320 334
321busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y) 335busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y)
322 $(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \ 336 $(do_link)
323 -o $@ $(LD_START_GROUP) \
324 $(APPLETS_DEFINE) $(APPLET_SRC) \
325 $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
326 $(LDBUSYBOX) $(LIBRARIES) \
327 $(LD_END_GROUP)
328 337
329busybox: busybox_unstripped 338busybox: busybox_unstripped
330 $(Q)cp busybox_unstripped busybox 339 $(Q)cp busybox_unstripped busybox
@@ -359,18 +368,6 @@ ifneq ($(strip $(DO_INSTALL_LIBS)),n)
359 done 368 done
360endif 369endif
361 370
362# see if we are in verbose mode
363KBUILD_VERBOSE :=
364ifdef V
365 ifeq ("$(origin V)", "command line")
366 KBUILD_VERBOSE := $(V)
367 endif
368endif
369ifneq ($(strip $(KBUILD_VERBOSE)),)
370 CHECK_VERBOSE := -v
371# ARFLAGS+=v
372endif
373
374check test: busybox 371check test: busybox
375 bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite SED="$(SED)" \ 372 bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite SED="$(SED)" \
376 $(SHELL) $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE) 373 $(SHELL) $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
diff --git a/Rules.mak b/Rules.mak
index e3e3dd667..550fe19bf 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -103,7 +103,7 @@ endif
103# A nifty macro to make testing gcc features easier, but note that everything 103# A nifty macro to make testing gcc features easier, but note that everything
104# that uses this _must_ use := or it will be re-evaluated everytime it is 104# that uses this _must_ use := or it will be re-evaluated everytime it is
105# referenced. 105# referenced.
106ifeq ($(strip $(V)),2) 106ifeq ($(strip $(BUILD_VERBOSE)),2)
107VERBOSE_CHECK_CC=echo CC=\"$(1)\" check_cc $(2) >&2; 107VERBOSE_CHECK_CC=echo CC=\"$(1)\" check_cc $(2) >&2;
108endif 108endif
109check_cc=$(shell \ 109check_cc=$(shell \
@@ -120,7 +120,7 @@ check_cc:=
120endif 120endif
121 121
122# A not very robust macro to check for available ld flags 122# A not very robust macro to check for available ld flags
123ifeq ($(strip $(V)),2) 123ifeq ($(strip $(BUILD_VERBOSE)),2)
124VERBOSE_CHECK_LD=echo LD=\"$(1)\" check_ld $(2) >&2; 124VERBOSE_CHECK_LD=echo LD=\"$(1)\" check_ld $(2) >&2;
125endif 125endif
126check_ld=$(shell \ 126check_ld=$(shell \
@@ -135,7 +135,7 @@ check_ld:=
135endif 135endif
136 136
137# A not very robust macro to check for available strip flags 137# A not very robust macro to check for available strip flags
138ifeq ($(strip $(V)),2) 138ifeq ($(strip $(BUILD_VERBOSE)),2)
139VERBOSE_CHECK_STRIP=echo STRIPCMD=\"$(1)\" check_strip $(2) >&2; 139VERBOSE_CHECK_STRIP=echo STRIPCMD=\"$(1)\" check_strip $(2) >&2;
140endif 140endif
141check_strip=$(shell \ 141check_strip=$(shell \
@@ -365,7 +365,7 @@ SECHO := @-false
365DISP := sil 365DISP := sil
366Q := @ 366Q := @
367else 367else
368ifneq ($(V)$(VERBOSE),) 368ifneq ($(BUILD_VERBOSE),)
369SECHO := @-false 369SECHO := @-false
370DISP := ver 370DISP := ver
371Q := 371Q :=
@@ -410,7 +410,18 @@ disp_elf2flt = $($(DISP)_disp_elf2flt)
410cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< 410cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
411cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $< 411cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $<
412cmd_strip = $(STRIPCMD) $@ 412cmd_strip = $(STRIPCMD) $@
413cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) 413cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
414 $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
415 -o $@ $(LD_START_GROUP) \
416 $(APPLETS_DEFINE) $(APPLET_SRC) \
417 $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \
418 $(LDBUSYBOX) $(LIBRARIES) \
419 $(LD_END_GROUP)
420cmd_link.so = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \
421 $(LIB_CFLAGS) $(CFLAGS_COMBINE) $(LIB_LDFLAGS) \
422 -o $(@) $(LD_START_GROUP) $(LD_WHOLE_ARCHIVE) \
423 $(LIBRARY_DEFINE) $(^) \
424 $(LD_NO_WHOLE_ARCHIVE) $(LD_END_GROUP)
414cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@ 425cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@
415cmd_ar = $(AR) $(ARFLAGS) $@ $^ 426cmd_ar = $(AR) $(ARFLAGS) $@ $^
416cmd_elf2flt = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@ 427cmd_elf2flt = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@
@@ -418,6 +429,7 @@ compile.c = @$(disp_compile.c) ; $(cmd_compile.c)
418compile.h = @$(disp_compile.h) ; $(cmd_compile.h) 429compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
419do_strip = @$(disp_strip) ; $(cmd_strip) 430do_strip = @$(disp_strip) ; $(cmd_strip)
420do_link = @$(disp_link) ; $(cmd_link) 431do_link = @$(disp_link) ; $(cmd_link)
432do_link.so = @$(disp_link) ; $(cmd_link.so)
421do_link.h = @$(disp_link.h) ; $(cmd_link.h) 433do_link.h = @$(disp_link.h) ; $(cmd_link.h)
422do_ar = @$(disp_ar) ; $(cmd_ar) 434do_ar = @$(disp_ar) ; $(cmd_ar)
423do_elf2flt = @$(disp_elf2flt) ; $(cmd_elf2flt) 435do_elf2flt = @$(disp_elf2flt) ; $(cmd_elf2flt)