From 020f51fdc0c54c8dcb115de611d48946695b155d Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Sun, 14 Mar 2010 21:25:03 +0000 Subject: 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 Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5208 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/abuild/abuild | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'util') diff --git a/util/abuild/abuild b/util/abuild/abuild index a9633c9215..1e67685ffb 100755 --- a/util/abuild/abuild +++ b/util/abuild/abuild @@ -173,6 +173,12 @@ function create_config echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$loglevel=y" >> .config echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> .config fi + + if [ "$scanbuild" = "true" ]; then + printf "(scan-build enabled) " + echo "CONFIG_SCANBUILD_ENABLE=y" >> .config + echo "CONFIG_SCANBUILD_REPORT_LOCATION=\"$TARGET/scan-build-results-tmp\"" >> .config + fi fi yes "" | $MAKE oldconfig obj=${build_dir} > ${build_dir}/config.log @@ -364,21 +370,6 @@ function build_target CC="$CC -fno-stack-protector" fi - if [ "$scanbuild" = "true" ]; then - ccwrap=`mktemp` - mkdir -p $TARGET/${VENDOR}_${MAINBOARD} - mkdir -p $TARGET/scan-build-results-tmp - mv $ccwrap $TARGET/${VENDOR}_${MAINBOARD} - ccwrap=$TARGET/${VENDOR}_${MAINBOARD}/`basename $ccwrap` - echo '#!/bin/sh' > $ccwrap - echo $CC' "$@"' >> $ccwrap - chmod +x $ccwrap - origMAKE=$MAKE - MAKE="scan-build --use-cc=$ccwrap -o $TARGET/scan-build-results-tmp -analyze-headers $MAKE GCC=$ccwrap" - CC="\$(CC)" - HOSTCC="CCC_CC=$HOSTCC \$(CC)" - fi - built_successfully $VENDOR $MAINBOARD && \ { printf " ( mainboard/$VENDOR/$MAINBOARD previously ok )\n\n" -- cgit v1.2.3