@@ -87,6 +87,9 @@ ifneq ($(KERNEL),)
CPPFLAGS += -DBUILTIN_KERNEL="\"$(KERNEL)\""
endif
+CHECK = sparse
+CHECKFLAGS := $(CF)
+
.SECONDARY:
vpath %.c $(SRC)
@@ -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
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@fr.ibm.com> --- Makefile.main | 3 +++ Makefile.rules | 11 +++++++++++ 2 files changed, 14 insertions(+)