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
This commit is contained in:
Patrick Georgi
2010-03-14 21:25:03 +00:00
parent 8702ab5ab1
commit 020f51fdc0
5 changed files with 58 additions and 18 deletions

View File

@@ -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"