summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-01-04 20:02:47 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-01-04 20:02:47 +0000
commit62d266d93650d3f9c6264ebd5cac2914936350c2 (patch)
tree09c39c7315718ef0eb45af83a9d00ca5327e4b08 /clang
parent2011-01-04 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-testing-62d266d93650d3f9c6264ebd5cac2914936350c2.tar.bz2
2011-01-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* clang/do_clang: New file.
Diffstat (limited to 'clang')
-rwxr-xr-xclang/do_clang79
1 files changed, 79 insertions, 0 deletions
diff --git a/clang/do_clang b/clang/do_clang
new file mode 100755
index 0000000..0d500ed
--- /dev/null
+++ b/clang/do_clang
@@ -0,0 +1,79 @@
+#! /bin/sh
+#
+# This script automates running clang-analyzer on RTEMS.
+#
+# NOTE:
+# + clang/scan does not support -B option so no code which needs bsp.h
+# + clang/scan has bug about embedded space in RHS of -D option.
+#
+# $Id$
+#
+
+#
+# TODO:
+# + parse arguments for some of the hard-coded items.
+# + better instructions on setup. Where to download, etc.
+#
+
+OUTPUTDIR=/home/joel/rtems-4.11-work/build/clang/output
+RTEMS_BIN=/opt/rtems-4.11/bin
+RTEMS_TARGET=sparc-rtems4.11
+RTEMS_BSP=sis
+#RTEMS_TARGET=i386-rtems4.11
+#RTEMS_BSP=pc386
+
+#
+# Checks the status returned by executables and exits if it is non-zero.
+#
+check_fatal()
+{
+ if [ $1 -ne 0 ] ; then
+ shift
+ echo "ERROR: $*" >&2
+ exit 1
+ fi
+}
+
+type ${RTEMS_TARGET}-gcc
+check_fatal $? "gcc not in path"
+
+type scan-build >/dev/null 2>&1
+check_fatal $? "scan-build not in PATH"
+
+# How many jobs in parallel
+if [ -r /usr/bin/getconf ] ; then
+ cpus=`/usr/bin/getconf _NPROCESSORS_ONLN`
+ cpus=`expr ${cpus} + 1`
+else
+ cpus=2
+fi
+# Clean build directory and start over
+rm -rf b-clang-${RTEMS_TARGET}
+check_fatal $? "Could not remove build directory"
+mkdir -p b-clang-${RTEMS_TARGET}
+check_fatal $? "Could not make build directory"
+cd b-clang-${RTEMS_TARGET}
+check_fatal $? "Could not cd to build directory"
+
+# Configure RTEMS
+#$r/configure --target=${RTEMS_TARGET} --enable-multilib \
+# --disable-networking --disable-itron --disable-tests \
+# --enable-rtemsbsp=${RTEMS_BSP} >c.log 2>&1
+$r/configure --target=${RTEMS_TARGET} --disable-multilib \
+ --disable-networking --disable-itron --disable-tests \
+ --enable-rtemsbsp=${RTEMS_BSP} >c.log 2>&1
+check_fatal $? "could not configure RTEMS"
+
+# Build RTEMS
+BASE=`pwd`
+#cd ${RTEMS_TARGET}/cpukit
+#check_fatal $? "could not cd ${RTEMS_TARGET}/cpukit"
+
+scan-build -o ${OUTPUTDIR} --experimental-checks \
+ --use-cc ${RTEMS_TARGET}-gcc \
+ --use-c++ ${RTEMS_TARGET}-g++ \
+ make -j${cpus} >${BASE}/b.log 2>&1
+check_fatal $? "could not make RTEMS"
+
+# Ran completed OK
+exit 0