ia64/xen-unstable

changeset 11893:b2e71d574045

Replace test-gcc-flag with Linux-style cc-option.

Improve on Linux implementation by looking for any output
on stdout/stderr. This indicates badness.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Oct 18 19:14:34 2006 +0100 (2006-10-18)
parents 1e8ba8d21175
children 47718a3d011e
files Config.mk tools/firmware/hvmloader/Makefile tools/firmware/vmxassist/Makefile tools/ioemu/Makefile.target xen/arch/x86/Rules.mk
line diff
     1.1 --- a/Config.mk	Wed Oct 18 18:41:47 2006 +0100
     1.2 +++ b/Config.mk	Wed Oct 18 19:14:34 2006 +0100
     1.3 @@ -26,7 +26,10 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/includ
     1.4  EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
     1.5  endif
     1.6  
     1.7 -test-gcc-flag = $(shell $(1) -v --help 2>&1 | grep " $(2) " >/dev/null 2>&1 && echo $(2))
     1.8 +# cc-option
     1.9 +# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
    1.10 +cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
    1.11 +              /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
    1.12  
    1.13  ifneq ($(debug),y)
    1.14  CFLAGS += -DNDEBUG
    1.15 @@ -42,8 +45,8 @@ CFLAGS += -Wall -Wstrict-prototypes
    1.16  # result of any casted expression causes a warning.
    1.17  CFLAGS += -Wno-unused-value
    1.18  
    1.19 -HOSTCFLAGS += $(call test-gcc-flag,$(HOSTCC),-Wdeclaration-after-statement)
    1.20 -CFLAGS     += $(call test-gcc-flag,$(CC),-Wdeclaration-after-statement)
    1.21 +HOSTCFLAGS += $(call cc-option,$(HOSTCC),-Wdeclaration-after-statement,)
    1.22 +CFLAGS     += $(call cc-option,$(CC),-Wdeclaration-after-statement,)
    1.23  
    1.24  LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
    1.25  CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
     2.1 --- a/tools/firmware/hvmloader/Makefile	Wed Oct 18 18:41:47 2006 +0100
     2.2 +++ b/tools/firmware/hvmloader/Makefile	Wed Oct 18 19:14:34 2006 +0100
     2.3 @@ -32,9 +32,9 @@ DEFINES  =-DDEBUG
     2.4  XENINC   =-I$(XEN_ROOT)/tools/libxc
     2.5  
     2.6  # Disable PIE/SSP if GCC supports them. They can break us.
     2.7 -CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
     2.8 -CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
     2.9 -CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
    2.10 +CFLAGS  += $(call cc-option,$(CC),-nopie,)
    2.11 +CFLAGS  += $(call cc-option,$(CC),-fno-stack-protector,)
    2.12 +CFLAGS  += $(call cc-option,$(CC),-fno-stack-protector-all,)
    2.13  
    2.14  OBJCOPY  = objcopy
    2.15  CFLAGS  += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
     3.1 --- a/tools/firmware/vmxassist/Makefile	Wed Oct 18 18:41:47 2006 +0100
     3.2 +++ b/tools/firmware/vmxassist/Makefile	Wed Oct 18 19:14:34 2006 +0100
     3.3 @@ -32,9 +32,9 @@ DEFINES=-DDEBUG -DTEXTADDR=$(TEXTADDR)
     3.4  XENINC=-I$(XEN_ROOT)/tools/libxc
     3.5  
     3.6  # Disable PIE/SSP if GCC supports them. They can break us.
     3.7 -CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
     3.8 -CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
     3.9 -CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
    3.10 +CFLAGS  += $(call cc-option,$(CC),-nopie,)
    3.11 +CFLAGS  += $(call cc-option,$(CC),-fno-stack-protector,)
    3.12 +CFLAGS  += $(call cc-option,$(CC),-fno-stack-protector-all,)
    3.13  
    3.14  CPP      = cpp -P
    3.15  OBJCOPY  = objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0
     4.1 --- a/tools/ioemu/Makefile.target	Wed Oct 18 18:41:47 2006 +0100
     4.2 +++ b/tools/ioemu/Makefile.target	Wed Oct 18 19:14:34 2006 +0100
     4.3 @@ -23,7 +23,7 @@ VPATH+=:$(SRC_PATH)/linux-user
     4.4  DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
     4.5  endif
     4.6  CFLAGS+=-Wall -O2 -g -fno-strict-aliasing
     4.7 -SSE2 := $(call test-gcc-flag,$(CC),-msse2)
     4.8 +SSE2 := $(call cc-option,$(CC),-msse2,)
     4.9  ifeq ($(SSE2),-msse2)
    4.10  CFLAGS += -DUSE_SSE2=1 -msse2
    4.11  endif
     5.1 --- a/xen/arch/x86/Rules.mk	Wed Oct 18 18:41:47 2006 +0100
     5.2 +++ b/xen/arch/x86/Rules.mk	Wed Oct 18 19:14:34 2006 +0100
     5.3 @@ -11,26 +11,26 @@ HAS_VGA  := y
     5.4  pae ?= n
     5.5  supervisor_mode_kernel ?= n
     5.6  
     5.7 -CFLAGS  += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
     5.8 -CFLAGS  += -iwithprefix include -Werror -Wno-pointer-arith -pipe
     5.9 -CFLAGS  += -I$(BASEDIR)/include 
    5.10 -CFLAGS  += -I$(BASEDIR)/include/asm-x86/mach-generic
    5.11 -CFLAGS  += -I$(BASEDIR)/include/asm-x86/mach-default
    5.12 +CFLAGS += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
    5.13 +CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
    5.14 +CFLAGS += -I$(BASEDIR)/include 
    5.15 +CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
    5.16 +CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
    5.17  
    5.18  # Prevent floating-point variables from creeping into Xen.
    5.19 -CFLAGS  += -msoft-float
    5.20 +CFLAGS += -msoft-float
    5.21  
    5.22  # Disable PIE/SSP if GCC supports them. They can break us.
    5.23 -CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
    5.24 -CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
    5.25 -CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
    5.26 +CFLAGS += $(call cc-option,$(CC),-nopie,)
    5.27 +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
    5.28 +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
    5.29  
    5.30  ifeq ($(TARGET_SUBARCH)$(pae),x86_32y)
    5.31 -CFLAGS  += -DCONFIG_X86_PAE=1
    5.32 +CFLAGS += -DCONFIG_X86_PAE=1
    5.33  endif
    5.34  
    5.35  ifeq ($(supervisor_mode_kernel),y)
    5.36 -CFLAGS  += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1
    5.37 +CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1
    5.38  endif
    5.39  
    5.40  ifeq ($(XEN_TARGET_ARCH),x86_32)
    5.41 @@ -39,11 +39,11 @@ x86_64 := n
    5.42  endif
    5.43  
    5.44  ifeq ($(TARGET_SUBARCH),x86_64)
    5.45 -CFLAGS  += -mno-red-zone -fpic -fno-reorder-blocks
    5.46 -CFLAGS  += -fno-asynchronous-unwind-tables
    5.47 +CFLAGS += -mno-red-zone -fpic -fno-reorder-blocks
    5.48 +CFLAGS += -fno-asynchronous-unwind-tables
    5.49  # -fvisibility=hidden reduces -fpic cost, if it's available
    5.50 -CFLAGS  += $(shell $(CC) -v --help 2>&1 | grep " -fvisibility=" | \
    5.51 -             grep -q hidden && echo "-DGCC_HAS_VISIBILITY_ATTRIBUTE")
    5.52 +CFLAGS += $(call cc-option,$(CC),-fvisibility=hidden,)
    5.53 +CFLAGS := $(subst -fvisibility=hidden,-DGCC_HAS_VISIBILITY_ATTRIBUTE,$(CFLAGS))
    5.54  x86_32 := n
    5.55  x86_64 := y
    5.56  endif