[PATCH] make: allow to change a compiler

Andrey Vagin avagin at openvz.org
Thu Jun 20 18:02:57 EDT 2013


clang-analyzer sets the environment variable CC
scan-build -plist-html --use-analyzer /usr/bin/clang make

[gorcunov@: use ifneq for arm sake]

Cc: Chanho Park <chanho61.park at samsung.com>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Makefile b/Makefile
index 125b5b3..ceae933 100644
--- a/Makefile
+++ b/Makefile
@@ -26,12 +26,26 @@ include Makefile.config
 FIND		:= find
 CSCOPE		:= cscope
 RM		:= rm -f
+
+#
+# CROSS_COMPILE is tricky, if set we can't
+# use ?= operator, so lets do another way
+
+ifneq ($(CROSS_COMPILE),)
 LD		:= $(CROSS_COMPILE)ld
 CC		:= $(CROSS_COMPILE)gcc
 NM		:= $(CROSS_COMPILE)nm
 SH		:= bash
 MAKE		:= make
 OBJCOPY		:= $(CROSS_COMPILE)objcopy
+else
+LD		:= ld
+CC		?= gcc
+NM		:= nm
+SH		:= bash
+MAKE		:= make
+OBJCOPY		:= objcopy
+endif
 
 #
 # Fetch ARCH from the uname if not yet set
-- 
1.8.1.4


--f2QGlHpHGjS2mn6Y--


More information about the CRIU mailing list