diff options
-rw-r--r-- | Config.mk | 14 | ||||
-rw-r--r-- | tools/Rules.mk | 6 | ||||
-rw-r--r-- | xen/arch/x86/Rules.mk | 4 | ||||
-rw-r--r-- | xen/include/public/foreign/Makefile | 4 |
4 files changed, 18 insertions, 10 deletions
@@ -31,17 +31,27 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/include EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR) endif -# cc-option +# cc-option: Check if compiler supports first option, else fall back to second. # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586) 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-ver +# 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. \ '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \ then echo y; else echo n; fi ;) +# cc-ver-check: Check compiler is at least specified version, else fail. +# Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4") +cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3))) +define cc-ver-check-closure + ifeq ($$(call cc-ver,$$($(1)),$(2)),n) + override $(1) = echo "*** FATAL BUILD ERROR: "$(3) >&2; exit 1; + cc-option := n + endif +endef + ifneq ($(debug),y) CFLAGS += -DNDEBUG else diff --git a/tools/Rules.mk b/tools/Rules.mk index 3e13eceb55..e087c94dd4 100644 --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -24,9 +24,9 @@ CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs) CFLAGS += $(CFLAGS-y) # Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers) -ifeq ($(CONFIG_X86)$(call cc-ver,$(CC),0x030400),yn) -$(error Xen tools require at least gcc-3.4) -endif +check-$(CONFIG_X86) = $(call cc-ver-check,CC,0x030400,\ + "Xen requires at least gcc-3.4") +$(eval $(check-y)) %.opic: %.c $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $< diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk index 86b9f33ab1..97e376a4ab 100644 --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/Rules.mk @@ -59,6 +59,4 @@ HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/svm/*.h) HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/vmx/*.h) # Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers) -ifneq ($(call cc-ver,$(CC),0x030400),y) -$(error Xen requires at least gcc-3.4) -endif +$(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4") diff --git a/xen/include/public/foreign/Makefile b/xen/include/public/foreign/Makefile index c107c5ab7f..b16c3efec1 100644 --- a/xen/include/public/foreign/Makefile +++ b/xen/include/public/foreign/Makefile @@ -1,5 +1,5 @@ -XEN_ROOT := ../../../.. -include $(XEN_ROOT)/tools/Rules.mk +XEN_ROOT=../../../.. +include $(XEN_ROOT)/Config.mk architectures := x86_32 x86_64 ia64 headers := $(patsubst %, %.h, $(architectures)) |