summaryrefslogtreecommitdiff
path: root/config.mk
diff options
context:
space:
mode:
authorKim Phillips <kim.phillips@freescale.com>2012-09-21 12:28:17 +0000
committerTom Rini <trini@ti.com>2012-10-15 11:54:03 -0700
commit4ab64933e3372ef0ad759fc7eae95713f9afd817 (patch)
tree1b0a01d15decc8cbf3364898714ca118dda7cebb /config.mk
parente46a4350b484cf7bc4ab861967bf303fc439c9e0 (diff)
add check infrastructure, default sparse
Add support for running source code checkers on u-boot source, e.g., using sparse to aid with typechecking. This comes in especially handy as SoC vendors mix and match cores and devices with different endianness, thus here we add CHECK_ENDIAN to the otherwise linux kernel default CHECKFLAGS. Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Diffstat (limited to 'config.mk')
-rw-r--r--config.mk8
1 files changed, 8 insertions, 0 deletions
diff --git a/config.mk b/config.mk
index 51b47838cf5..bb5c69a15d9 100644
--- a/config.mk
+++ b/config.mk
@@ -149,6 +149,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
RANLIB = $(CROSS_COMPILE)RANLIB
DTC = dtc
+CHECK = sparse
#########################################################################
@@ -275,6 +276,10 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),)
LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE)
endif
+# Linus' kernel sanity checking tool
+CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
+ -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
+
# Location of a usable BFD library, where we define "usable" as
# "built for ${HOST}, supports ${TARGET}". Sensible values are
# - When cross-compiling: the root of the cross-environment
@@ -322,6 +327,9 @@ $(obj)%.s: %.S
$(obj)%.o: %.S
$(CC) $(ALL_AFLAGS) -o $@ $< -c
$(obj)%.o: %.c
+ifneq ($(CHECKSRC),0)
+ $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $<
+endif
$(CC) $(ALL_CFLAGS) -o $@ $< -c
$(obj)%.i: %.c
$(CPP) $(ALL_CFLAGS) -o $@ $< -c