diff options
author | Cédric Le Goater <clg@fr.ibm.com> | 2015-02-24 12:14:15 +0100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-02-26 17:20:33 +1100 |
commit | aedc25b063b8125e84805781f8d368d8fd78f9c3 (patch) | |
tree | 08fa8792e5eb980b65a1eb8c5f2377ede7b497d0 | |
parent | 6c26bc72093a317a7018bafbece55393d9e222f5 (diff) | |
download | skiboot-aedc25b063b8125e84805781f8d368d8fd78f9c3.zip skiboot-aedc25b063b8125e84805781f8d368d8fd78f9c3.tar.gz skiboot-aedc25b063b8125e84805781f8d368d8fd78f9c3.tar.bz2 |
sparse: add make variable C to run sparse when compiling skiboot
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>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | Makefile.main | 3 | ||||
-rw-r--r-- | Makefile.rules | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Makefile.main b/Makefile.main index 665baf4..cf41a22 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 2aace78..d63cbf4 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -33,6 +33,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 $@, $@) @@ -40,10 +49,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 |