From f18c86461e224db3b9edf7539a0c76f5b2859810 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Sat, 5 Oct 2013 21:30:59 +0100 Subject: [PATCH] actual coverage reports and api docs can be build via make again ... now project name and version are taken from configure ... ahh and configure holds version information from git. --- Makefile.am | 14 +++++++++-- Makefile.am.coverage | 34 -------------------------- configure.ac | 23 +++++++++++++----- docs/Makefile.am | 17 +++++++++++++ tests/Makefile.am | 58 ++++++++++++++++++++++++++++++++++++++------ 5 files changed, 96 insertions(+), 50 deletions(-) delete mode 100644 Makefile.am.coverage create mode 100644 docs/Makefile.am diff --git a/Makefile.am b/Makefile.am index 10c16f2..bfe6e99 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,16 @@ ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = include assets certs config run -SUBDIRS = src tests +SUBDIRS = src tests docs -include $(top_srcdir)/Makefile.am.coverage +.PHONY: docs coverage-html + +if HAVE_DOXYGEN +docs: + -$(MAKE) -C docs $(AM_MAKEFLAGS) -k $@ +endif + +if HAVE_GCOV +coverage-html: + -$(MAKE) -C tests $(AM_MAKEFLAGS) -k $@ +endif diff --git a/Makefile.am.coverage b/Makefile.am.coverage deleted file mode 100644 index 52643e5..0000000 --- a/Makefile.am.coverage +++ /dev/null @@ -1,34 +0,0 @@ - -# Coverage targets - -#if HAVE_GCOV - - .PHONY: clean-gcda - clean-gcda: - @echo Removing old coverage results - -find -name '*.gcda' -print | xargs -r rm - - .PHONY: coverage-html generate-coverage-html clean-coverage-html - coverage-html: clean-gcda - -$(MAKE) -C tests $(AM_MAKEFLAGS) -k check-build - $(MAKE) $(AM_MAKEFLAGS) init-coverage-html - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html - - init-coverage-html: - $(LCOV) -d $(top_builddir) -z - $(LCOV) -d $(top_builddir) -c -i -o coverage.base - - generate-coverage-html: - @echo Collecting coverage data - $(LCOV) -d $(top_builddir) -c -o coverage.run --gcov-tool /usr/bin/gcov - $(LCOV) -d $(top_builddir) -a ./coverage.base -a ./coverage.run -o coverage.info - LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --branch-coverage --show-details coverage.run - - clean-coverage-html: clean-gcda - -$(LCOV) --directory $(top_builddir) -z - -rm -rf coverage.info coveragereport - - clean-local: clean-coverage-html - -#endif # HAVE_GCOV diff --git a/configure.ac b/configure.ac index c6c2210..b5f3d9a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,13 +2,15 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) -AC_INIT([taskrambler], [0.1.6], [Georg Hopp ]) +AC_INIT([taskrambler], + [m4_esyscmd_s([git describe --always --abbrev=0])], + [Georg Hopp ]) LT_INIT AM_INIT_AUTOMAKE #AM_INIT_AUTOMAKE([subdir-objects]) -#AM_SILENT_RULES([yes]) +AM_SILENT_RULES([yes]) AC_COPYRIGHT([Copyright © 2013 Georg Hopp]) -AC_REVISION([$Id:$]) +AC_REVISION([m4_esyscmd_s([git describe --always])]) AC_CONFIG_SRCDIR([src/taskrambler.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) @@ -22,9 +24,6 @@ AC_SUBST(COVERAGE_LDFLAGS) m4_include([m4/memopt.m4]) AC_MEM_OPT -m4_include([m4/dragonegg.m4]) -AC_DRAGONEGG - PWD=$(/bin/pwd) AC_SUBST(PWD) @@ -35,6 +34,17 @@ AC_PROG_CC_C99 AC_PROG_LIBTOOL AM_PROG_CC_C_O +# Doxygen +AC_CHECK_PROGS([DOXYGEN], [doxygen]) +if test -z "$DOXYGEN"; + then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support]) +fi + +AM_CONDITIONAL([HAVE_DOXYGEN], + [test -n "$DOXYGEN"]) +AM_COND_IF([HAVE_DOXYGEN], + [AC_CONFIG_FILES([docs/Doxyfile])]) + # # Checks for libraries. # AC_CHECK_LIB([json], [json_object_new_object], [], # [AC_MSG_ERROR([json-c library not found], [1])]) @@ -73,5 +83,6 @@ AC_CONFIG_FILES([Makefile src/application/Makefile src/storage/Makefile src/user/Makefile + docs/Makefile tests/Makefile]) AC_OUTPUT diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000..9f6dce2 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,17 @@ +if HAVE_DOXYGEN +# directory = $(top_srcdir)/docs/man/man3/ +# +# dist_man_MANS = $(directory)/man_page_1.3 $(directory)/man_page_2.3 +# $(directory)/man_page_1.3: doxyfile.stamp +# $(directory)/man_page_2.3: doxyfile.stamp + +.PHONY: docs + +docs: + mkdir $(PACKAGE_VERSION) + $(DOXYGEN) Doxyfile + echo Timestamp > doxyfile.stamp + +clean-local: + rm -rf $(top_srcdir)/docs/$(PACKAGE_VERSION) +endif diff --git a/tests/Makefile.am b/tests/Makefile.am index 141b5ed..c2d950c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -47,20 +47,62 @@ SERVER = $(SOCKET) $(STREAM) \ ../src/utils/signalHandling.c \ mock/mock_worker.c +AM_CFLAGS = -O0 -Wall -ggdb -I ../include -I .. -I . $(MEM_OPT_FLAGS) +AM_LDFLAGS = + +if HAVE_GCOV +AM_CFLAGS += $(COVERAGE_CFLAGS) +AM_LDFLAGS += $(COVERAGE_LDFLAGS) +endif + classTest_SOURCES = $(CLASS) classTest.c -classTest_CFLAGS = -Wall -ggdb -O0 -fprofile-arcs -ftest-coverage -pg -I ../include -I .. -I . -classTest_LDFLAGS = -lgcov -pg +classTest_CFLAGS = $(AM_CFLAGS) -pg +classTest_LDFLAGS = $(AM_LDFLAGS) -pg loggerTest_SOURCES = $(LOGGER) loggerTest.c -loggerTest_CFLAGS = -Wall -ggdb -O0 -fprofile-arcs -ftest-coverage -pg -I ../include -I .. -I . -loggerTest_LDFLAGS = -lgcov -pg +loggerTest_CFLAGS = $(AM_CFLAGS) -pg +loggerTest_LDFLAGS = $(AM_LDFLAGS) -pg socketTest_SOURCES = $(SOCKET) socketTest.c -socketTest_CFLAGS = -Wall -ggdb -O0 -fprofile-arcs -ftest-coverage -pg -I ../include -I .. -I . -socketTest_LDFLAGS = -lgcov -pg +socketTest_CFLAGS = $(AM_CFLAGS) -pg +socketTest_LDFLAGS = $(AM_LDFLAGS) -pg serverTest_SOURCES = $(SERVER) serverTest.c -serverTest_CFLAGS = -Wall -ggdb -O0 -fprofile-arcs -ftest-coverage -pg -I ../include -I .. -I . -serverTest_LDFLAGS = $(STREAM_OBJ) -lgcov -lcrypto -pg +serverTest_CFLAGS = $(AM_CFLAGS) -pg +serverTest_LDFLAGS = $(STREAM_OBJ) $(AM_LDFLAGS) -lcrypto -pg EXTRA_DIST = runtest.h mock/mock_class.h mock/mock_logger.h + +if HAVE_GCOV + +.PHONY: clean-gcda clean-gcno coverage-html clean-coverage + +cov_dir = $(top_srcdir)/tests/coverage/$(PACKAGE_VERSION) + +coverage-html: clean clean-coverage check + @echo Collecting coverage data + $(LCOV) -d $(top_srcdir) -c -i -o coverage.base + $(LCOV) -d $(top_srcdir) -c -o coverage.run --gcov-tool /usr/bin/gcov + $(LCOV) -d $(top_srcdir) \ + -a ./coverage.base -a ./coverage.run \ + -o coverage.info + LANG=C $(GENHTML) --prefix $(top_srcdir) \ + --output-directory $(cov_dir) \ + --title "$(PACKAGE_NAME) $(PACKAGE_VERSION)" \ + --legend --branch-coverage --show-details coverage.run + +clean-coverage: clean-gcda clean-gcno + $(LCOV) -d $(top_srcdir) -z + -rm -rf coverage.info coverage.base coverage.run $(cov_dir) + +clean-gcda: + @echo Removing old coverage results + -find $(top_srcdir) -name '*.gcda' -print | xargs -r rm + +clean-gcno: + @echo Removing old coverage results + -find $(top_srcdir) -name '*.gcno' -print | xargs -r rm + +clean-local: clean-coverage + +endif # HAVE_GCOV