]>
Commit | Line | Data |
---|---|---|
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 | |
18 | clean_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 | ||
26 | PWD=`pwd` | |
27 | GCCINCDIR=`gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"` | |
28 | LIBSYSFS="-I$PWD/libsysfs" | |
29 | WARNINGS="-Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" | |
30 | GCC="-I$GCCINCDIR" | |
31 | USE_LOG="-DLOG" | |
32 | DEBUG="-D_GNU_SOURCE" | |
33 | GCOV_FLAGS="-pipe -fprofile-arcs -ftest-coverage" | |
34 | ||
35 | for 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 | |
49 | done | |
50 | ||
51 | clean_udev | |
52 | ||
53 | make $* CFLAGS="$WARNINGS $GCOV_FLAGS $USE_LOG $DEBUG $GCC $LIBSYSFS" |