ia64/xen-unstable

changeset 19031:27e9687c5b3d

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>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 13 08:59:49 2009 +0000 (2009-01-13)
parents 0e448d0a41ff
children 1c6642adaeb2
files Config.mk tools/firmware/Rules.mk tools/tests/blowfish.mk tools/vnet/libxutil/Makefile xen/arch/x86/Rules.mk
line diff
     1.1 --- a/Config.mk	Tue Jan 13 08:40:42 2009 +0000
     1.2 +++ b/Config.mk	Tue Jan 13 08:59:49 2009 +0000
     1.3 @@ -38,6 +38,15 @@ endif
     1.4  cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
     1.5                /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
     1.6  
     1.7 +# cc-option-add: Add an option to compilation flags, but only if supported.
     1.8 +# Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)
     1.9 +cc-option-add = $(eval $(call cc-option-add-closure,$(1),$(2),$(3)))
    1.10 +define cc-option-add-closure
    1.11 +    ifneq ($$(call cc-option,$$($(2)),$(3),n),n)
    1.12 +        $(1) += $(3)
    1.13 +    endif
    1.14 +endef
    1.15 +
    1.16  # cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
    1.17  # Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
    1.18  cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
    1.19 @@ -84,8 +93,8 @@ CFLAGS += -Wall -Wstrict-prototypes
    1.20  # result of any casted expression causes a warning.
    1.21  CFLAGS += -Wno-unused-value
    1.22  
    1.23 -HOSTCFLAGS += $(call cc-option,$(HOSTCC),-Wdeclaration-after-statement,)
    1.24 -CFLAGS     += $(call cc-option,$(CC),-Wdeclaration-after-statement,)
    1.25 +$(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
    1.26 +$(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
    1.27  
    1.28  LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
    1.29  CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
     2.1 --- a/tools/firmware/Rules.mk	Tue Jan 13 08:40:42 2009 +0000
     2.2 +++ b/tools/firmware/Rules.mk	Tue Jan 13 08:59:49 2009 +0000
     2.3 @@ -13,9 +13,9 @@ endif
     2.4  CFLAGS += -Werror
     2.5  
     2.6  # Disable PIE/SSP if GCC supports them. They can break us.
     2.7 -CFLAGS += $(call cc-option,$(CC),-nopie,)
     2.8 -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
     2.9 -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
    2.10 +$(call cc-option-add,CFLAGS,CC,-nopie)
    2.11 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector)
    2.12 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector-all)
    2.13  
    2.14  # Extra CFLAGS suitable for an embedded type of environment.
    2.15  CFLAGS += -fno-builtin -msoft-float
     3.1 --- a/tools/tests/blowfish.mk	Tue Jan 13 08:40:42 2009 +0000
     3.2 +++ b/tools/tests/blowfish.mk	Tue Jan 13 08:59:49 2009 +0000
     3.3 @@ -5,9 +5,9 @@ CFLAGS =
     3.4  include $(XEN_ROOT)/tools/Rules.mk
     3.5  
     3.6  # Disable PIE/SSP if GCC supports them. They can break us.
     3.7 -CFLAGS += $(call cc-option,$(CC),-nopie,)
     3.8 -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
     3.9 -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
    3.10 +$(call cc-option-add,CFLAGS,CC,-nopie)
    3.11 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector)
    3.12 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector-all)
    3.13  
    3.14  CFLAGS += -fno-builtin -msoft-float
    3.15  
     4.1 --- a/tools/vnet/libxutil/Makefile	Tue Jan 13 08:40:42 2009 +0000
     4.2 +++ b/tools/vnet/libxutil/Makefile	Tue Jan 13 08:59:49 2009 +0000
     4.3 @@ -24,7 +24,8 @@ LIB_SRCS += util.c
     4.4  LIB_OBJS := $(LIB_SRCS:.c=.o)
     4.5  PIC_OBJS := $(LIB_SRCS:.c=.opic)
     4.6  
     4.7 -CFLAGS   += -Werror -fno-strict-aliasing $(call cc-option,$(CC),-fgnu89-inline,)
     4.8 +$(call cc-option-add,CFLAGS,CC,-fgnu89-inline)
     4.9 +CFLAGS   += -Werror -fno-strict-aliasing
    4.10  CFLAGS   += -O3
    4.11  #CFLAGS   += -g
    4.12  
     5.1 --- a/xen/arch/x86/Rules.mk	Tue Jan 13 08:40:42 2009 +0000
     5.2 +++ b/xen/arch/x86/Rules.mk	Tue Jan 13 08:59:49 2009 +0000
     5.3 @@ -26,9 +26,9 @@ CFLAGS += -I$(BASEDIR)/include/asm-x86/m
     5.4  CFLAGS += -msoft-float
     5.5  
     5.6  # Disable PIE/SSP if GCC supports them. They can break us.
     5.7 -CFLAGS += $(call cc-option,$(CC),-nopie,)
     5.8 -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
     5.9 -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
    5.10 +$(call cc-option-add,CFLAGS,CC,-nopie)
    5.11 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector)
    5.12 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector-all)
    5.13  
    5.14  ifeq ($(supervisor_mode_kernel),y)
    5.15  CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1