diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-01-13 08:59:49 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-01-13 08:59:49 +0000 |
commit | 6b1ce5497dcb3becd432853e1666a0f01abe8829 (patch) | |
tree | 4b665419024be40be5c8dac9906d4c991631b904 /Config.mk | |
parent | e2869f9f1c70a6acfe35c16e7e0bd75e2dd93971 (diff) | |
download | xen-6b1ce5497dcb3becd432853e1666a0f01abe8829.tar.gz xen-6b1ce5497dcb3becd432853e1666a0f01abe8829.tar.bz2 xen-6b1ce5497dcb3becd432853e1666a0f01abe8829.zip |
build: Define cc-option-add to immediately add options to CFLAGS
without deferring the test execution of CC. This avoids extra
executions of CC every time CFLAGS is expanded.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'Config.mk')
-rw-r--r-- | Config.mk | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -38,6 +38,15 @@ endif cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \ /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;) +# cc-option-add: Add an option to compilation flags, but only if supported. +# Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6) +cc-option-add = $(eval $(call cc-option-add-closure,$(1),$(2),$(3))) +define cc-option-add-closure + ifneq ($$(call cc-option,$$($(2)),$(3),n),n) + $(1) += $(3) + endif +endef + # cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'. # Usage: ifeq ($(call cc-ver,$(CC),0x030400),y) cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \ @@ -84,8 +93,8 @@ CFLAGS += -Wall -Wstrict-prototypes # result of any casted expression causes a warning. CFLAGS += -Wno-unused-value -HOSTCFLAGS += $(call cc-option,$(HOSTCC),-Wdeclaration-after-statement,) -CFLAGS += $(call cc-option,$(CC),-Wdeclaration-after-statement,) +$(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement) +$(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement) LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) |