xref: /freebsd/contrib/openpam/misc/coverity.sh.in (revision 848ee2a3a8b47c9905fc51fefcf60eb371edbb98)
1#!/bin/sh
2
3usage() {
4	echo "usage: ${0##*/} [-jN]" >&2
5	exit 1
6}
7
8while getopts "j:" opt ; do
9	case $opt in
10	j)
11		j="-j$OPTARG"
12		;;
13	*)
14		usage
15		;;
16	esac
17done
18
19if which -s cov01 ; then
20	cov01="$(which cov01)"
21fi
22covint="cov-int"
23covlog="${covint}/build-log.txt"
24srcdir="@abs_top_srcdir@"
25cd "${srcdir}" || exit 1
26rm -rf "${covint}"
27gmake clean || exit 1
28"${cov01:-:}" -q -u
29"${cov01:-:}" -q -0
30cov-build --dir "${covint}" gmake "$@"
31"${cov01:-:}" -q -o
32gmake clean
33if tail -1 "${covlog}" | grep -q "completed successfully" ; then
34	tar caf "@PACKAGE@-@PACKAGE_VERSION@-cov-int.txz" "${covint}"
35else
36	tail "${covlog}"
37fi
38