diff options
| author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-06-13 14:20:17 +0000 |
|---|---|---|
| committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-06-13 14:20:17 +0000 |
| commit | 7b8ff22685339709c84a67fcb43147c2e4971afa (patch) | |
| tree | 3119c4c8a74435b746a5d3b2dee7e4db99507d02 | |
| parent | 2f6a3179446c83c23347fc7f7aef05c51310c6db (diff) | |
| download | busybox-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-- | Makefile | 85 | ||||
| -rw-r--r-- | Rules.mak | 22 |
2 files changed, 58 insertions, 49 deletions
| @@ -43,18 +43,36 @@ _all: | |||
| 43 | 43 | ||
| 44 | CONFIG_CONFIG_IN = $(top_srcdir)/Config.in | 44 | CONFIG_CONFIG_IN = $(top_srcdir)/Config.in |
| 45 | 45 | ||
| 46 | ifeq ($(KBUILD_SRC),) | 46 | ifeq ($(BUILD_SRC),) |
| 47 | |||
| 48 | ifdef O | 47 | ifdef 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 |
| 53 | else | 52 | else |
| 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) |
| 57 | endif | ||
| 58 | |||
| 59 | # see if we are in verbose mode | ||
| 60 | BUILD_VERBOSE := | ||
| 61 | ifdef V | ||
| 62 | ifeq ("$(origin V)", "command line") | ||
| 63 | BUILD_VERBOSE := $(V) | ||
| 64 | endif | ||
| 65 | endif | ||
| 66 | ifdef VERBOSE | ||
| 67 | ifeq ("$(origin VERBOSE)", "command line") | ||
| 68 | BUILD_VERBOSE := $(VERBOSE) | ||
| 69 | endif | ||
| 70 | endif | ||
| 71 | |||
| 72 | ifneq ($(strip $(BUILD_VERBOSE)),) | ||
| 73 | export BUILD_VERBOSE | ||
| 74 | CHECK_VERBOSE := -v | ||
| 75 | # ARFLAGS+=v | ||
| 58 | endif | 76 | endif |
| 59 | 77 | ||
| 60 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y) | 78 | ifneq ($(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 | ||
| 72 | ifneq ($(KBUILD_OUTPUT),) | 90 | ifneq ($(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 |
| 75 | saved-output := $(KBUILD_OUTPUT) | 93 | saved-output := $(BUILD_OUTPUT) |
| 76 | KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) | 94 | BUILD_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 |
| 103 | skip-makefile := 1 | 121 | skip-makefile := 1 |
| 104 | endif # ifneq ($(KBUILD_OUTPUT),) | 122 | endif # ifneq ($(BUILD_OUTPUT),) |
| 105 | endif # ifeq ($(KBUILD_SRC),) | 123 | endif # ifeq ($(BUILD_SRC),) |
| 106 | 124 | ||
| 107 | ifeq ($(skip-makefile),) | 125 | ifeq ($(skip-makefile),) |
| 108 | 126 | ||
| @@ -305,13 +323,9 @@ $(LIBBUSYBOX_SONAME): | |||
| 305 | ifndef MAJOR_VERSION | 323 | ifndef MAJOR_VERSION |
| 306 | $(error MAJOR_VERSION needed for $@ is not defined) | 324 | $(error MAJOR_VERSION needed for $@ is not defined) |
| 307 | endif | 325 | endif |
| 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 | |||
| 319 | endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | 333 | endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) |
| 320 | 334 | ||
| 321 | busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y) | 335 | busybox_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 | ||
| 329 | busybox: busybox_unstripped | 338 | busybox: 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 |
| 360 | endif | 369 | endif |
| 361 | 370 | ||
| 362 | # see if we are in verbose mode | ||
| 363 | KBUILD_VERBOSE := | ||
| 364 | ifdef V | ||
| 365 | ifeq ("$(origin V)", "command line") | ||
| 366 | KBUILD_VERBOSE := $(V) | ||
| 367 | endif | ||
| 368 | endif | ||
| 369 | ifneq ($(strip $(KBUILD_VERBOSE)),) | ||
| 370 | CHECK_VERBOSE := -v | ||
| 371 | # ARFLAGS+=v | ||
| 372 | endif | ||
| 373 | |||
| 374 | check test: busybox | 371 | check 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) |
| @@ -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. |
| 106 | ifeq ($(strip $(V)),2) | 106 | ifeq ($(strip $(BUILD_VERBOSE)),2) |
| 107 | VERBOSE_CHECK_CC=echo CC=\"$(1)\" check_cc $(2) >&2; | 107 | VERBOSE_CHECK_CC=echo CC=\"$(1)\" check_cc $(2) >&2; |
| 108 | endif | 108 | endif |
| 109 | check_cc=$(shell \ | 109 | check_cc=$(shell \ |
| @@ -120,7 +120,7 @@ check_cc:= | |||
| 120 | endif | 120 | endif |
| 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 |
| 123 | ifeq ($(strip $(V)),2) | 123 | ifeq ($(strip $(BUILD_VERBOSE)),2) |
| 124 | VERBOSE_CHECK_LD=echo LD=\"$(1)\" check_ld $(2) >&2; | 124 | VERBOSE_CHECK_LD=echo LD=\"$(1)\" check_ld $(2) >&2; |
| 125 | endif | 125 | endif |
| 126 | check_ld=$(shell \ | 126 | check_ld=$(shell \ |
| @@ -135,7 +135,7 @@ check_ld:= | |||
| 135 | endif | 135 | endif |
| 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 |
| 138 | ifeq ($(strip $(V)),2) | 138 | ifeq ($(strip $(BUILD_VERBOSE)),2) |
| 139 | VERBOSE_CHECK_STRIP=echo STRIPCMD=\"$(1)\" check_strip $(2) >&2; | 139 | VERBOSE_CHECK_STRIP=echo STRIPCMD=\"$(1)\" check_strip $(2) >&2; |
| 140 | endif | 140 | endif |
| 141 | check_strip=$(shell \ | 141 | check_strip=$(shell \ |
| @@ -365,7 +365,7 @@ SECHO := @-false | |||
| 365 | DISP := sil | 365 | DISP := sil |
| 366 | Q := @ | 366 | Q := @ |
| 367 | else | 367 | else |
| 368 | ifneq ($(V)$(VERBOSE),) | 368 | ifneq ($(BUILD_VERBOSE),) |
| 369 | SECHO := @-false | 369 | SECHO := @-false |
| 370 | DISP := ver | 370 | DISP := ver |
| 371 | Q := | 371 | Q := |
| @@ -410,7 +410,18 @@ disp_elf2flt = $($(DISP)_disp_elf2flt) | |||
| 410 | cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< | 410 | cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< |
| 411 | cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $< | 411 | cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $< |
| 412 | cmd_strip = $(STRIPCMD) $@ | 412 | cmd_strip = $(STRIPCMD) $@ |
| 413 | cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) | 413 | cmd_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) | ||
| 420 | cmd_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) | ||
| 414 | cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@ | 425 | cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@ |
| 415 | cmd_ar = $(AR) $(ARFLAGS) $@ $^ | 426 | cmd_ar = $(AR) $(ARFLAGS) $@ $^ |
| 416 | cmd_elf2flt = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@ | 427 | cmd_elf2flt = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@ |
| @@ -418,6 +429,7 @@ compile.c = @$(disp_compile.c) ; $(cmd_compile.c) | |||
| 418 | compile.h = @$(disp_compile.h) ; $(cmd_compile.h) | 429 | compile.h = @$(disp_compile.h) ; $(cmd_compile.h) |
| 419 | do_strip = @$(disp_strip) ; $(cmd_strip) | 430 | do_strip = @$(disp_strip) ; $(cmd_strip) |
| 420 | do_link = @$(disp_link) ; $(cmd_link) | 431 | do_link = @$(disp_link) ; $(cmd_link) |
| 432 | do_link.so = @$(disp_link) ; $(cmd_link.so) | ||
| 421 | do_link.h = @$(disp_link.h) ; $(cmd_link.h) | 433 | do_link.h = @$(disp_link.h) ; $(cmd_link.h) |
| 422 | do_ar = @$(disp_ar) ; $(cmd_ar) | 434 | do_ar = @$(disp_ar) ; $(cmd_ar) |
| 423 | do_elf2flt = @$(disp_elf2flt) ; $(cmd_elf2flt) | 435 | do_elf2flt = @$(disp_elf2flt) ; $(cmd_elf2flt) |
