Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -64,27 +64,40 @@ rm -f nano.tcl.h.new.1 mv nano.tcl.h.new.2 nano.tcl.h test: @EXTENSION_TARGET@ pkgIndex.tcl @srcdir@/test/test.tcl . + +ifeq (@ENABLE_COVERAGE@,true) +coverage.dir: test + rm -f nano-coverage.info + lcov --capture --directory . --output-file nano-coverage.info + mkdir coverage.dir + genhtml nano-coverage.info --output-directory coverage.dir + rm -f nano-coverage.info +endif install: @EXTENSION_TARGET@ pkgIndex.tcl @srcdir@/nano.man $(INSTALL) -d '$(DESTDIR)$(PACKAGE_INSTALL_DIR)' $(INSTALL_PROGRAM) @EXTENSION_TARGET@ '$(DESTDIR)$(PACKAGE_INSTALL_DIR)' $(INSTALL_DATA) pkgIndex.tcl '$(DESTDIR)$(PACKAGE_INSTALL_DIR)' $(INSTALL_DATA) @srcdir@/nano.man '$(DESTDIR)$(PACKAGE_INSTALL_DIR)' clean: rm -f nano-amalgamation.c nano-amalgamation.o - rm -f @EXTENSION_TARGET@ nano.o + rm -f @EXTENSION_TARGET@ nano.o nano.gcda nano.gcno rm -f blake2b.o tweetnacl.o randombytes.o + rm -f blake2b.gcda tweetnacl.gcda randombytes.gcda + rm -f blake2b.gcno tweetnacl.gcno randombytes.gcno + rm -f nano-coverage.info distclean: clean rm -f Makefile pkgIndex.tcl-shared pkgIndex.tcl-static nano.syms rm -f pkgIndex.tcl rm -f config.log config.status rm -f nano.tcl.h nano.tcl.h.new.1 nano.tcl.h.new.2 + rm -rf coverage.dir mrproper: distclean rm -f @srcdir@/configure @srcdir@/aclocal.m4 @srcdir@/config.guess @srcdir@/config.sub @srcdir@/install-sh rm -f @srcdir@/nano.vers rm -rf @srcdir@/tweetnacl @srcdir@/blake2b Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -35,10 +35,21 @@ AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [enable debugging parameters]), [ if test "$enableval" = "yes"; then tcl_nano_debug='true' fi ]) + +dnl Enable support for a code coverage build +tcl_nano_coverage='false' +AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [enable code coverage build (requires debug)]), [ + if test "$enableval" = "yes"; then + tcl_nano_coverage='true' + tcl_nano_debug='true' + fi +]) + +dnl If we are building a debug release, enable debugging flags if test "$tcl_nano_debug" = 'true'; then AC_DEFINE(TCLEXT_TCL_NANO_DEBUG, [1], [Enable debugging build]) AX_CHECK_COMPILE_FLAG([-mmpx -fcheck-pointer-bounds], [CFLAGS="$CFLAGS -mmpx -fcheck-pointer-bounds"]) AX_CHECK_COMPILE_FLAG([-g3], [CFLAGS="$CFLAGS -g3"]) AX_CHECK_COMPILE_FLAG([-ggdb3], [CFLAGS="$CFLAGS -ggdb3"]) @@ -47,10 +58,20 @@ AX_CHECK_COMPILE_FLAG([-Wno-unused-value], [CFLAGS="$CFLAGS -Wno-unused-value"]) AX_CHECK_COMPILE_FLAG([-Wno-unused-parameter], [CFLAGS="$CFLAGS -Wno-unused-parameter"]) AX_CHECK_COMPILE_FLAG([-Wno-deprecated-declarations], [CFLAGS="$CFLAGS -Wno-deprecated-declarations"]) fi AX_CHECK_COMPILE_FLAG([-Wno-sign-compare], [CFLAGS="$CFLAGS -Wno-sign-compare"]) + +dnl If enabled, do code coverage +if test "$tcl_nano_coverage" = 'true'; then + ENABLE_COVERAGE='true' + AC_SUBST(ENABLE_COVERAGE) + AX_CHECK_COMPILE_FLAG([-coverage], [ + CFLAGS="$CFLAGS -coverage" + LDFLAGS="$LDFLAGS -coverage" + ]) +fi dnl Enable compiler warnings AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="-Wall $CFLAGS"]) AX_CHECK_COMPILE_FLAG([-W], [ CFLAGS="-W $CFLAGS"