]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
Tidy makefiles to use CFLAGS-$(foo) idiom instead of ifeq.
authorTim Deegan <Tim.Deegan@citrix.com>
Tue, 8 Mar 2011 10:23:52 +0000 (10:23 +0000)
committerTim Deegan <Tim.Deegan@citrix.com>
Tue, 8 Mar 2011 10:23:52 +0000 (10:23 +0000)
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Config.mk
config/StdGNU.mk
xen/Rules.mk
xen/arch/x86/Rules.mk

index aee6e5b8adcb6270251dc5cd5ed5914609de2836..9c16c1f2ce1271f1727067b97edbc979530c10d3 100644 (file)
--- a/Config.mk
+++ b/Config.mk
@@ -23,6 +23,15 @@ DESTDIR     ?= /
 # Allow phony attribute to be listed as dependency rather than fake target
 .PHONY: .phony
 
+# Use Clang/LLVM instead of GCC?
+clang ?= n
+ifeq ($(clang),n)
+gcc := y
+else
+gcc := n
+endif
+
+
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
@@ -148,12 +157,9 @@ CFLAGS += -Wall -Wstrict-prototypes
 # result of any casted expression causes a warning.
 CFLAGS += -Wno-unused-value
 
-ifeq ($(clang),y)
 # Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
-CFLAGS += -Wno-parentheses
-# And is over-zealous with the printf format lint
-CFLAGS += -Wno-format
-endif
+# and is over-zealous with the printf format lint
+CFLAGS-$(clang) += -Wno-parentheses -Wno-format
 
 $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
 $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
index 786efd7e20c23f387b998e071a50d87365616ef4..25aeb4d819c7ccc621e8bfe06b386fac9a944c37 100644 (file)
@@ -76,14 +76,10 @@ CFLAGS += -O2 -fomit-frame-pointer
 else
 # Less than -O1 produces bad code and large stack frames
 CFLAGS += -O1 -fno-omit-frame-pointer
-ifneq ($(clang),y)
-CFLAGS += -fno-optimize-sibling-calls
-endif
+CFLAGS-$(gcc) += -fno-optimize-sibling-calls
 endif
 
 ifeq ($(lto),y)
 CFLAGS += -flto
-ifeq ($(clang),y)
-LDFLAGS += -plugin LLVMgold.so
-endif
+LDFLAGS-$(clang) += -plugin LLVMgold.so
 endif
index 9a9829bcb3c165d7dc36157d036d1ad9f4c10897..c39706a6c716408be7466c790881fdd160b9d3a3 100644 (file)
@@ -9,7 +9,6 @@ perfc_arrays  ?= n
 lock_profile  ?= n
 crash_debug   ?= n
 frame_pointer ?= n
-clang         ?= n
 lto           ?= n
 
 XEN_ROOT=$(BASEDIR)/..
@@ -83,6 +82,8 @@ AFLAGS += $(AFLAGS-y) $(filter-out -std=gnu%,$(filter-out -flto,$(CFLAGS)))
 # LDFLAGS are only passed directly to $(LD)
 LDFLAGS += $(LDFLAGS_DIRECT)
 
+LDFLAGS += $(LDFLAGS-y)
+
 include Makefile
 
 # Ensure each subdirectory has exactly one trailing slash.
index f951398b60f8ac8c689ac0071f7aa7a4f62f78bb..df7cf34cce5316ee6595b4e5d93a6d4abdb517d7 100644 (file)
@@ -14,9 +14,7 @@ supervisor_mode_kernel ?= n
 # Solaris grabs stdarg.h and friends from the system include directory.
 # Clang likewise.
 ifneq ($(XEN_OS),SunOS)
-ifneq ($(clang),y)
-CFLAGS += -nostdinc
-endif
+CFLAGS-$(gcc) += -nostdinc
 endif
 
 CFLAGS += -fno-builtin -fno-common -Wredundant-decls
@@ -52,7 +50,7 @@ x86_32 := n
 x86_64 := y
 endif
 
-ifneq ($(clang),y)
+ifeq ($(gcc),y)
 # Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
 $(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4")
 endif