summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@coresystems.de>2010-03-14 21:25:03 +0000
committerPatrick Georgi <patrick.georgi@coresystems.de>2010-03-14 21:25:03 +0000
commit020f51fdc0c54c8dcb115de611d48946695b155d (patch)
tree31eaaef17f69842cccc00c2a60a37539cb0074b4 /Makefile
parent8702ab5ab1ee3e9f4f4d6edd7cec85ed6029aac8 (diff)
Add scan-build support to the build system.
When configured in Kconfig, just running "make" calls scan-build as appropriate (however, it does not check for the presence of scan-build) The target directory for the scan-build report is configurable and defaults to the scan-build default of /tmp/scan-build-$date-$num abuild is adapted to properly run scanbuild when ran with the -sb option. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5208 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 33 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 9de0fe5efe..cb556e7f1d 100644
--- a/Makefile
+++ b/Makefile
@@ -19,8 +19,16 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
+ifeq ($(INNER_SCANBUILD),y)
+CC_real:=$(CC)
+endif
$(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile > .xcompile)))
include .xcompile
+ifeq ($(INNER_SCANBUILD),y)
+CC:=$(CC_real)
+HOSTCC:=$(CC_real) --hostcc
+HOSTCXX:=$(CC_real) --hostcxx
+endif
export top := $(PWD)
export src := $(top)/src
@@ -90,7 +98,25 @@ endif
# The primary target needs to be here before we include the
# other files
+ifeq ($(INNER_SCANBUILD),y)
+CONFIG_SCANBUILD_ENABLE:=
+endif
+
+ifeq ($(CONFIG_SCANBUILD_ENABLE),y)
+ifneq ($(CONFIG_SCANBUILD_REPORT_LOCATION),)
+CONFIG_SCANBUILD_REPORT_LOCATION:=-o $(CONFIG_SCANBUILD_REPORT_LOCATION)
+endif
+all:
+ echo '#!/bin/sh' > .ccwrap
+ echo 'CC="$(CC)"' >> .ccwrap
+ echo 'if [ "$$1" = "--hostcc" ]; then shift; CC="$(HOSTCC)"; fi' >> .ccwrap
+ echo 'if [ "$$1" = "--hostcxx" ]; then shift; CC="$(HOSTCXX)"; fi' >> .ccwrap
+ echo 'eval $$CC $$*' >> .ccwrap
+ chmod +x .ccwrap
+ scan-build $(CONFIG_SCANBUILD_REPORT_LOCATION) -analyze-headers --use-cc=$(top)/.ccwrap --use-c++=$(top)/.ccwrap $(MAKE) INNER_SCANBUILD=y
+else
all: coreboot
+endif
#######################################################################
@@ -110,7 +136,12 @@ $(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devi
(cd $(obj)/mainboard/$(MAINBOARDDIR) ; PYTHONPATH=$(top)/util/sconfig export PYTHONPATH; python config.py $(MAINBOARDDIR) $(top) $(obj)/mainboard/$(MAINBOARDDIR))
$(obj)/mainboard/$(MAINBOARDDIR)/static.o: $(obj)/mainboard/$(MAINBOARDDIR)/static.c
-#
+ @printf " CC $(subst $(obj)/,,$(@))\n"
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(obj)/arch/i386/../../option_table.o: $(obj)/arch/i386/../../option_table.c
+ @printf " CC $(subst $(obj)/,,$(@))\n"
+ $(CC) $(CFLAGS) -c -o $@ $<
objs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.o
initobjs:=
@@ -325,7 +356,7 @@ clean-for-update: doxygen-clean
$(MAKE) -C util/sconfig clean
clean: clean-for-update
- rm -f $(obj)/coreboot*
+ rm -f $(obj)/coreboot* .ccwrap
distclean: clean
rm -rf $(obj)