mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
In order to allow building as non-root with a non-default CC (which
root may not have access to through its $PATH), defer the generation of an error until CC is actually needed. Original patch by Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
4d5a404460
commit
aacef84b33
4 files changed
+18
-10
No files matched your search
@@ -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
|
||||
|
||||
+3
-3
@@ -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 $@ $<
|
||||
|
||||
@@ -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")
|
||||
@@ -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))
|
||||
|
||||