[Skiboot] [PATCH 01/25] sparse: add make variable C to run sparse when compiling skiboot

Cédric Le Goater clg at fr.ibm.com
Tue Feb 24 22:14:15 AEDT 2015


As this is done on the Linux kernel, one can now run sparse using
C=1 on the command line. The variable CF can be used to tune the
sparse options.

Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
---
 Makefile.main  |    3 +++
 Makefile.rules |   11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/Makefile.main b/Makefile.main
index b5376fc0eaa9..c99182585638 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -87,6 +87,9 @@ ifneq ($(KERNEL),)
 CPPFLAGS += -DBUILTIN_KERNEL="\"$(KERNEL)\""
 endif
 
+CHECK		= sparse
+CHECKFLAGS     := $(CF)
+
 .SECONDARY:
 
 vpath %.c $(SRC)
diff --git a/Makefile.rules b/Makefile.rules
index 3014c819f9b2..27da0dce9be8 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -27,6 +27,15 @@ define cook_cflags
        $(filter-out $(CFLAGS_SKIP_$(1)), $(CPPFLAGS) $(CFLAGS)) $(CFLAGS_$(1))
 endef
 
+ifeq ($(C),1)
+  ifeq ($(VERBOSE),1)
+	cmd_check = $(CHECK) $(CHECKFLAGS) $(call cook_cflags,$@) $<
+  else
+	cmd_check = @$(CHECK) $(CHECKFLAGS) $(call cook_cflags,$@) $<
+  endif
+endif
+
+
 %.o : %.S include/asm-offsets.h
 	$(call Q,AS, $(CC) $(call cook_aflags,$@) -c $< -o $@, $@)
 
@@ -34,10 +43,12 @@ endef
 	$(call Q,CC, $(CC) $(call cook_aflags,$@) -E -c $< -o $@, $@)
 
 %.o : %.c
+	$(call cmd_check)
 	$(call Q,CC, $(CC) $(call cook_cflags,$@) -c $< -o $@, $@)
 
 # Force the use of the C compiler, not C++ for the .C files in libpore
 %.o : %.C
+	$(call cmd_check)
 	$(call Q,CC, $(CC) $(call cook_cflags,$@) -x c -c $< -o $@, $@)
 
 %.s : %.c
-- 
1.7.10.4



More information about the Skiboot mailing list