Minor changes to allow static analysis checkers besides sparse
This patch allows CHECK and CHECKFLAGS to be passed in on the make
invocation, such that one could specify a checker other than sparse,
and/or different flags. The current values of CHECK and CHECKFLAGS
remain as defaults thereby preserving backwards compatibility with the
simple "make C=1" scenario.
This is useful for several reasons:
- using checkers besides sparse
- specifying a different version of sparse
- overriding sparse's flags with custom ones
- passing a different checker's flags
Note that the CHECK assignment was easily replaced with ?= but the
CHECKFLAGS assigned used := for the $(CF) variable, and as there is
no ?:= assignment, an ifndef was used.
Signed-off-by: Dustin Kirkland <[EMAIL PROTECTED]>
---
diff -urpN linux-2.6.17-rc4-mm3/Makefile linux-2.6.17-rc4-mm3-checker/Makefile
--- linux-2.6.17-rc4-mm3/Makefile 2006-05-22 14:12:38.000000000 -0500
+++ linux-2.6.17-rc4-mm3-checker/Makefile 2006-05-23 12:10:22.000000000
-0500
@@ -41,8 +41,9 @@ ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0
endif
-# Call sparse as part of compilation of C files
-# Use 'make C=1' to enable sparse checking
+# Call checker as part of compilation of C files
+# Use 'make C=1' to enable checking (sparse, by default)
+# Override with 'make C=1 CHECK=checker_executable CHECKFLAGS=....'
ifdef C
ifeq ("$(origin C)", "command line")
@@ -297,9 +298,11 @@ GENKSYMS = scripts/genksyms/genksyms
DEPMOD = /sbin/depmod
KALLSYMS = scripts/kallsyms
PERL = perl
-CHECK = sparse
+CHECK ?= sparse
-CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise
$(CF)
+ifndef CHECKFLAGS
+ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise
$(CF)
+endif
MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS)
@@ -1068,8 +1071,8 @@ help:
@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 $$CHECK (sparse)'
- @echo ' make C=2 [targets] Force check of all c source with $$CHECK
(sparse)'
+ @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse
by default)'
+ @echo ' make C=2 [targets] Force check of all c source with $$CHECK
(sparse by default)'
@echo ''
@echo 'Execute "make" or "make all" to build all targets marked with
[*] '
@echo 'For further info see the ./README file'
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
kbuild-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kbuild-devel