kbuild: make C=2 forces sparse run

From: Sam Ravnborg
Date: Wed Aug 18 2004 - 16:12:35 EST


# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/17 23:02:08+02:00 sam@xxxxxxxxxxxxxxxxx
# kbuild: make C=2 now force sparse to be run for all .c files
#
# With make C=2 sparse ($(CHECK)) will be run on all .c files also if they
# do not need to be compiled.
# Usefull to run sparse on a fully compiled kernel tree.
# Implemented on request from Al Viro (although he liked to be able to
# run sparse without building any source).
#
# Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
#
# scripts/Makefile.build
# 2004/08/17 23:01:51+02:00 sam@xxxxxxxxxxxxxxxxx +9 -2
# Allow sparse to be forced to be used - for all .c files.
#
# Makefile
# 2004/08/17 23:01:51+02:00 sam@xxxxxxxxxxxxxxxxx +2 -1
# Document how to force use of sparse, even when no source needs to be compiled.
#
diff -Nru a/Makefile b/Makefile
--- a/Makefile 2004-08-19 01:05:30 +02:00
+++ b/Makefile 2004-08-19 01:05:30 +02:00
@@ -958,7 +958,8 @@

@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
@echo ' make O=dir [targets] Locate all output files in "dir", including .config'
- @echo ' make C=1 [targets] Check all c source with checker tool'
+ @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse)'
+ @echo ' make C=2 [targets] Force check of all c source with $$CHECK (sparse)'
@echo ''
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
@echo 'For further info see the ./README file'
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
--- a/scripts/Makefile.build 2004-08-19 01:05:30 +02:00
+++ b/scripts/Makefile.build 2004-08-19 01:05:30 +02:00
@@ -83,8 +83,13 @@

# Linus' kernel sanity checking tool
ifneq ($(KBUILD_CHECKSRC),0)
-quiet_cmd_checksrc = CHECK $<
- cmd_checksrc = $(CHECK) $(c_flags) $< ;
+ ifeq ($(KBUILD_CHECKSRC),2)
+ quiet_cmd_force_checksrc = CHECK $<
+ cmd_force_checksrc = $(CHECK) $(c_flags) $< ;
+ else
+ quiet_cmd_checksrc = CHECK $<
+ cmd_checksrc = $(CHECK) $(c_flags) $< ;
+ endif
endif


@@ -182,11 +187,13 @@
# Built-in and composite module parts

%.o: %.c FORCE
+ $(call cmd,force_checksrc)
$(call if_changed_rule,cc_o_c)

# Single-part modules are special since we need to mark them in $(MODVERDIR)

$(single-used-m): %.o: %.c FORCE
+ $(call cmd,force_checksrc)
$(call if_changed_rule,cc_o_c)
@{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/