diff --git a/.gitignore b/.gitignore index 9bcc349..c36cc14 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ bin obj lib doc +cov # IDE .vscode diff --git a/Makefile b/Makefile index d1b68f5..d6cf51c 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ DEBUG ?= false USRDIR ?= /usr .PHONY: build i install uni uninstall\ - tools library tests docs clean + tools library tests docs cov clean LIB = basen OBJS =\ @@ -59,6 +59,8 @@ DIRS =\ ${OBJDIR}\ ${OBJDIR}/hash\ ${LIBDIR}\ + doc\ + cov build: library tools @@ -80,8 +82,19 @@ uninstall: docs: doxygen Doxyfile +cover: ${DIRS} ${patsubst %, ${BINDIR}/%${-g}-cov, ${TESTS}} + ${patsubst %, ./${BINDIR}/%${-g}-cov;, ${TESTS}} + gcovr --html-nested cov/index.html + gcovr + +${OBJDIR}/%${-g}-cov.o: ${SRCDIR}/%.cpp ${INCDIR}/${LIB}/%.hpp + ${CC} -o $@ -c $< -I${INCDIR} ${-l} ${CFLAGS} --coverage + +${BINDIR}/%${-g}-cov: ${TESTDIR}/%.cpp ${patsubst %, ${OBJDIR}/%${-g}-cov.o, ${OBJS}} + ${CC} -o $@ $^ -I${INCDIR} ${-l} -lgtest ${CFLAGS} --coverage + clean: - rm -rf ${OBJDIR}/* ${LIBDIR}/* ${BINDIR}/* + rm -rf ${DIRS} ifneq (${OBJS},)