+# Remove unneeded coverage files, then generate the xml files that can be given
+# to sonar. gcov.xml is based on the "raw" coverage and dcov.xml is based on
+# the discounted coverage.
+#
+function mk_xml {
+ rm -fr *_test.c.gcov test_*.c.gcov *_test.c.dcov test_*.c.dcov # we don't report on the unit test code, so ditch
+ cat *.gcov | cov2xml.ksh >gcov.xml
+ cat *.dcov | cov2xml.ksh >dcov.xml
+}
+
+
+# -----------------------------------------------------------------------------------------------------------------
+
+# we assume that the project has been built in the ../[.]build directory
+if [[ -d ../build ]]
+then
+ export LD_LIBRARY_PATH=../build/lib:../build/lib64
+else
+ if [[ -d ../.build ]]
+ then
+ export LD_LIBRARY_PATH=../.build/lib:../.build/lib64
+ export C_INCLUDE_PATH=../.build/include
+
+ else
+ echo "[WARN] cannot find build directory (tried ../build and ../.build); things might not work"
+ echo ""
+ fi
+fi