]> git.ipfire.org Git - thirdparty/systemd.git/blame - make_gcov.sh
[PATCH] Don't use any syslog() in signal handler, cause it may deadlock.
[thirdparty/systemd.git] / make_gcov.sh
CommitLineData
d9154d11
GKH
1#!/bin/sh
2#
3# gcov capability for udev
4#
5# Provides code coverage analysis for udev.
6#
7# make_gcov.sh assumes the same same default parameters as make, but also
8# accepts the same parameters as make (see README file in udev/ for
9# parameter info). There is one exception, klibc can not be used with
10# gcov as it will not compile cleanly.
11#
12# make_gcov.sh then overrides CFLAGS to strip out optimization in order
13# for gcov to get correct code coverage analysis.
14#
15# Leann Ogasawara <ogasawara@osdl.org>, April 2004
16
17# clean up udev dir
18clean_udev () {
19 find -name "*.da" -exec rm -f "{}" \;
20 find -name "*.bb" -exec rm -f "{}" \;
21 find -name "*.bbg" -exec rm -f "{}" \;
22 find -name "*.gcov" -exec rm -f "{}" \;
23 make clean
24}
25
26PWD=`pwd`
27GCCINCDIR=`gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"`
28LIBSYSFS="-I$PWD/libsysfs"
29WARNINGS="-Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
30GCC="-I$GCCINCDIR"
31USE_LOG="-DLOG"
32DEBUG="-D_GNU_SOURCE"
33GCOV_FLAGS="-pipe -fprofile-arcs -ftest-coverage"
34
35for i in $*; do
36 pre=`echo $i | sed 's/=.*//g'`
37 post=`echo $i | sed 's/.*=//g'`
38 if [ $pre = "USE_KLIBC" ] && [ $post = "true" ]; then
39 echo "cannot use gcov with klibc, will not compile"
40 exit
41 elif [ $pre = "USE_LOG" ] && [ $post = "false" ]; then
42 USE_LOG=""
43 elif [ $pre = "DEBUG" ] && [ $post = "true" ]; then
44 DEBUG="-g -DDEBUG -D_GNU_SOURCE"
45 elif [ $pre = "clean" ]; then
46 clean_udev
47 exit
48 fi
49done
50
51clean_udev
52
53make $* CFLAGS="$WARNINGS $GCOV_FLAGS $USE_LOG $DEBUG $GCC $LIBSYSFS"