2004-04-17 11:09:17 +04:00
#!/bin/sh
#
# gcov capability for udev
#
# Provides code coverage analysis for udev.
#
# make_gcov.sh assumes the same same default parameters as make, but also
# accepts the same parameters as make (see README file in udev/ for
# parameter info). There is one exception, klibc can not be used with
# gcov as it will not compile cleanly.
#
# make_gcov.sh then overrides CFLAGS to strip out optimization in order
# for gcov to get correct code coverage analysis.
#
# Leann Ogasawara <ogasawara@osdl.org>, April 2004
# clean up udev dir
clean_udev ( ) {
2004-12-05 18:31:51 +03:00
find -name "*.gcno" -exec rm -f "{}" \;
find -name "*.gcda" -exec rm -f "{}" \;
2004-04-17 11:09:17 +04:00
find -name "*.gcov" -exec rm -f "{}" \;
2004-12-05 18:31:51 +03:00
rm -f udev_gcov.txt
2004-04-17 11:09:17 +04:00
make clean
}
PWD = ` pwd `
GCCINCDIR = ` gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp" `
2004-12-05 18:31:51 +03:00
LIBSYSFS = " -I $PWD /libsysfs/sysfs -I $PWD /libsysfs "
2004-04-17 11:09:17 +04:00
WARNINGS = "-Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
GCC = " -I $GCCINCDIR "
2005-03-06 12:15:51 +03:00
USE_LOG = "-DUSE_LOG"
2004-04-17 11:09:17 +04:00
DEBUG = "-D_GNU_SOURCE"
GCOV_FLAGS = "-pipe -fprofile-arcs -ftest-coverage"
for i in $* ; do
pre = ` echo $i | sed 's/=.*//g' `
post = ` echo $i | sed 's/.*=//g' `
if [ $pre = "USE_KLIBC" ] && [ $post = "true" ] ; then
echo "cannot use gcov with klibc, will not compile"
exit
elif [ $pre = "USE_LOG" ] && [ $post = "false" ] ; then
USE_LOG = ""
elif [ $pre = "DEBUG" ] && [ $post = "true" ] ; then
DEBUG = "-g -DDEBUG -D_GNU_SOURCE"
elif [ $pre = "clean" ] ; then
clean_udev
exit
fi
done
clean_udev
2004-12-05 18:31:51 +03:00
make $* CFLAGS = " $WARNINGS $GCOV_FLAGS $USE_LOG $DEBUG $GCC $LIBSYSFS " LDFLAGS = "-Wl,-warn-common -fprofile-arcs"