From a1a0e47148f8bbb583c886144b34a9b114a42b10 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Fri, 7 Nov 2014 15:57:46 +0100 Subject: [PATCH 1/4] Begin to update build-system --- Makefile | 133 ++++++++++------ config.mk | 16 ++ tests/Makefile | 146 +++++++++++++----- tests/config.mk | 13 +- tests/test_document.c | 2 +- tests/test_session.c | 2 +- tests/test_utils.c | 2 +- adjustment.c => zathura/adjustment.c | 0 adjustment.h => zathura/adjustment.h | 0 bookmarks.c => zathura/bookmarks.c | 0 bookmarks.h => zathura/bookmarks.h | 0 callbacks.c => zathura/callbacks.c | 0 callbacks.h => zathura/callbacks.h | 0 commands.c => zathura/commands.c | 0 commands.h => zathura/commands.h | 0 completion.c => zathura/completion.c | 0 completion.h => zathura/completion.h | 0 config.c => zathura/config.c | 0 config.h => zathura/config.h | 0 content-type.c => zathura/content-type.c | 0 content-type.h => zathura/content-type.h | 0 .../css-definitions.h | 0 database-plain.c => zathura/database-plain.c | 0 database-plain.h => zathura/database-plain.h | 0 .../database-sqlite.c | 0 .../database-sqlite.h | 0 database.c => zathura/database.c | 0 database.h => zathura/database.h | 0 .../dbus-interface-definitions.h | 0 dbus-interface.c => zathura/dbus-interface.c | 0 dbus-interface.h => zathura/dbus-interface.h | 0 document.c => zathura/document.c | 0 document.h => zathura/document.h | 0 glib-compat.h => zathura/glib-compat.h | 0 internal.h => zathura/internal.h | 0 links.c => zathura/links.c | 0 links.h => zathura/links.h | 0 macros.h => zathura/macros.h | 0 main.c => zathura/main.c | 0 marks.c => zathura/marks.c | 0 marks.h => zathura/marks.h | 0 page-widget.c => zathura/page-widget.c | 0 page-widget.h => zathura/page-widget.h | 0 page.c => zathura/page.c | 0 page.h => zathura/page.h | 0 plugin-api.h => zathura/plugin-api.h | 0 plugin.c => zathura/plugin.c | 0 plugin.h => zathura/plugin.h | 0 print.c => zathura/print.c | 0 print.h => zathura/print.h | 0 render.c => zathura/render.c | 0 render.h => zathura/render.h | 0 shortcuts.c => zathura/shortcuts.c | 0 shortcuts.h => zathura/shortcuts.h | 0 synctex.c => zathura/synctex.c | 0 synctex.h => zathura/synctex.h | 0 {synctex => zathura/synctex}/LICENSE | 0 {synctex => zathura/synctex}/Makefile | 0 {synctex => zathura/synctex}/synctex_parser.c | 0 {synctex => zathura/synctex}/synctex_parser.h | 0 .../synctex}/synctex_parser_utils.c | 0 .../synctex}/synctex_parser_utils.h | 0 .../synctex}/synctex_parser_version.txt | 0 types.c => zathura/types.c | 0 types.h => zathura/types.h | 0 utils.c => zathura/utils.c | 0 utils.h => zathura/utils.h | 0 version.h.in => zathura/version.h.in | 0 zathura.c => zathura/zathura.c | 0 zathura.h => zathura/zathura.h | 0 70 files changed, 223 insertions(+), 91 deletions(-) rename adjustment.c => zathura/adjustment.c (100%) rename adjustment.h => zathura/adjustment.h (100%) rename bookmarks.c => zathura/bookmarks.c (100%) rename bookmarks.h => zathura/bookmarks.h (100%) rename callbacks.c => zathura/callbacks.c (100%) rename callbacks.h => zathura/callbacks.h (100%) rename commands.c => zathura/commands.c (100%) rename commands.h => zathura/commands.h (100%) rename completion.c => zathura/completion.c (100%) rename completion.h => zathura/completion.h (100%) rename config.c => zathura/config.c (100%) rename config.h => zathura/config.h (100%) rename content-type.c => zathura/content-type.c (100%) rename content-type.h => zathura/content-type.h (100%) rename css-definitions.h => zathura/css-definitions.h (100%) rename database-plain.c => zathura/database-plain.c (100%) rename database-plain.h => zathura/database-plain.h (100%) rename database-sqlite.c => zathura/database-sqlite.c (100%) rename database-sqlite.h => zathura/database-sqlite.h (100%) rename database.c => zathura/database.c (100%) rename database.h => zathura/database.h (100%) rename dbus-interface-definitions.h => zathura/dbus-interface-definitions.h (100%) rename dbus-interface.c => zathura/dbus-interface.c (100%) rename dbus-interface.h => zathura/dbus-interface.h (100%) rename document.c => zathura/document.c (100%) rename document.h => zathura/document.h (100%) rename glib-compat.h => zathura/glib-compat.h (100%) rename internal.h => zathura/internal.h (100%) rename links.c => zathura/links.c (100%) rename links.h => zathura/links.h (100%) rename macros.h => zathura/macros.h (100%) rename main.c => zathura/main.c (100%) rename marks.c => zathura/marks.c (100%) rename marks.h => zathura/marks.h (100%) rename page-widget.c => zathura/page-widget.c (100%) rename page-widget.h => zathura/page-widget.h (100%) rename page.c => zathura/page.c (100%) rename page.h => zathura/page.h (100%) rename plugin-api.h => zathura/plugin-api.h (100%) rename plugin.c => zathura/plugin.c (100%) rename plugin.h => zathura/plugin.h (100%) rename print.c => zathura/print.c (100%) rename print.h => zathura/print.h (100%) rename render.c => zathura/render.c (100%) rename render.h => zathura/render.h (100%) rename shortcuts.c => zathura/shortcuts.c (100%) rename shortcuts.h => zathura/shortcuts.h (100%) rename synctex.c => zathura/synctex.c (100%) rename synctex.h => zathura/synctex.h (100%) rename {synctex => zathura/synctex}/LICENSE (100%) rename {synctex => zathura/synctex}/Makefile (100%) rename {synctex => zathura/synctex}/synctex_parser.c (100%) rename {synctex => zathura/synctex}/synctex_parser.h (100%) rename {synctex => zathura/synctex}/synctex_parser_utils.c (100%) rename {synctex => zathura/synctex}/synctex_parser_utils.h (100%) rename {synctex => zathura/synctex}/synctex_parser_version.txt (100%) rename types.c => zathura/types.c (100%) rename types.h => zathura/types.h (100%) rename utils.c => zathura/utils.c (100%) rename utils.h => zathura/utils.h (100%) rename version.h.in => zathura/version.h.in (100%) rename zathura.c => zathura/zathura.c (100%) rename zathura.h => zathura/zathura.h (100%) diff --git a/Makefile b/Makefile index 49363f3..fe97a08 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,7 @@ include config.mk include colors.mk include common.mk -OSOURCE = $(filter-out css-definitions.c, $(filter-out dbus-interface-definitions.c, $(wildcard *.c))) -HEADER = $(wildcard *.h) $(wildcard synctex/*.h) -HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h +OSOURCE = $(filter-out ${PROJECT}/css-definitions.c, $(filter-out ${PROJECT}/dbus-interface-definitions.c, $(wildcard ${PROJECT}/*.c))) ifneq (${WITH_SQLITE},0) INCS += $(SQLITE_INC) @@ -29,10 +27,10 @@ LIBS += $(SYNCTEX_LIB) else INCS += $(ZLIB_INC) LIBS += $(ZLIB_LIB) -SOURCE += $(wildcard synctex/*.c) +SOURCE += $(wildcard ${PROJECT}/synctex/*.c) ifeq (,$(findstring -Isynctex,${CPPFLAGS})) -CPPFLAGS += -Isynctex +CPPFLAGS += -I${PROJECT}/synctex endif ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS})) CPPFLAGS += -DSYNCTEX_VERBOSE=0 @@ -53,8 +51,17 @@ ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS})) CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\" endif -OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o css-definitions.o -DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS)) +OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${SOURCE:.c=.o}) \ + ${BUILDDIR_RELEASE}/${PROJECT}/css-definitions.o \ + ${BUILDDIR_RELEASE}/${PROJECT}/dbus-interface-definitions.o +OBJECTS_DEBUG = $(addprefix ${BUILDDIR_DEBUG}/,${SOURCE:.c=.o}) \ + ${BUILDDIR_DEBUG}/${PROJECT}/css-definitions.o \ + ${BUILDDIR_DEBUG}/${PROJECT}/dbus-interface-definitions.o +OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o}) \ + ${BUILDDIR_GCOV}/${PROJECT}/css-definitions.o \ + ${BUILDDIR_GCOV}/${PROJECT}/dbus-interface-definitions.o +HEADER = $(wildcard ${PROJECT}/*.h) $(wildcard synctex/*.h) +HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h all: options ${PROJECT} po build-manpages @@ -75,72 +82,114 @@ options: @echo "DFLAGS = ${DFLAGS}" @echo "CC = ${CC}" -version.h: version.h.in config.mk +${PROJECT}/version.h: ${PROJECT}/version.h.in config.mk $(QUIET)sed -e 's/ZVMAJOR/${ZATHURA_VERSION_MAJOR}/' \ -e 's/ZVMINOR/${ZATHURA_VERSION_MINOR}/' \ -e 's/ZVREV/${ZATHURA_VERSION_REV}/' \ -e 's/ZVAPI/${ZATHURA_API_VERSION}/' \ - -e 's/ZVABI/${ZATHURA_ABI_VERSION}/' version.h.in > version.h.tmp - $(QUIET)mv version.h.tmp version.h + -e 's/ZVABI/${ZATHURA_ABI_VERSION}/' ${PROJECT}/version.h.in > version.h.tmp + $(QUIET)mv version.h.tmp ${PROJECT}/version.h -dbus-interface-definitions.c: data/org.pwmt.zathura.xml +${PROJECT}/dbus-interface-definitions.c: data/org.pwmt.zathura.xml $(QUIET)echo '#include "dbus-interface-definitions.h"' > $@.tmp $(QUIET)echo 'const char* DBUS_INTERFACE_XML =' >> $@.tmp $(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/org.pwmt.zathura.xml >> $@.tmp $(QUIET)echo ';' >> $@.tmp $(QUIET)mv $@.tmp $@ -css-definitions.c: data/zathura.css_t +${PROJECT}/css-definitions.c: data/zathura.css_t $(QUIET)echo '#include "css-definitions.h"' > $@.tmp $(QUIET)echo 'const char* CSS_TEMPLATE_INDEX =' >> $@.tmp $(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' $< >> $@.tmp $(QUIET)echo ';' >> $@.tmp $(QUIET)mv $@.tmp $@ -%.o: %.c - $(call colorecho,CC,$<) - $(QUIET) mkdir -p $(shell dirname .depend/$@.dep) - $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep +# release build -%.do: %.c - $(call colorecho,CC,$<) - $(QUIET) mkdir -p $(shell dirname .depend/$@.dep) - $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep - -${OBJECTS} ${DOBJECTS}: config.mk version.h \ +${OBJECTS}: config.mk ${PROJECT}/version.h \ .version-checks/GIRARA .version-checks/GLIB .version-checks/GTK +${BUILDDIR_RELEASE}/%.o: %.c + $(call colorecho,CC,$<) + @mkdir -p ${DEPENDDIR}/$(dir $(abspath $@)) + @mkdir -p $(dir $(abspath $@)) + $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep + ${PROJECT}: ${OBJECTS} $(call colorecho,CC,$@) - $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS} + @mkdir -p ${BUILDDIR_RELEASE}/${BINDIR} + $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \ + -o ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} ${OBJECTS} ${LIBS} + +# debug build + +${OBJECTS_DEBUG}: config.mk ${PROJECT}/version.h \ + .version-checks/GIRARA .version-checks/GLIB .version-checks/GTK + +${BUILDDIR_DEBUG}/%.o: %.c + $(call colorecho,CC,$<) + @mkdir -p ${DEPENDDIR}/$(dir $(abspath $@)) + @mkdir -p $(dir $(abspath $@)) + $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} \ + -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep + +${PROJECT}-debug: ${OBJECTS_DEBUG} + $(call colorecho,CC,$@) + @mkdir -p ${BUILDDIR_DEBUG}/${BINDIR} + $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \ + -o ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} ${OBJECTS} ${LIBS} + +debug: ${PROJECT}-debug + +# gcov build + +${OBJECTS_GCOV}: config.mk ${PROJECT}/version.h \ + .version-checks/GIRARA .version-checks/GLIB .version-checks/GTK + +${BUILDDIR_GCOV}/%.o: %.c + $(call colorecho,CC,$<) + @mkdir -p ${DEPENDDIR}/$(dir $(abspath $@)) + @mkdir -p $(dir $(abspath $@)) + $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} \ + -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep + +${PROJECT}-gcov: ${OBJECTS_GCOV} + $(call colorecho,CC,$@) + @mkdir -p ${BUILDDIR_GCOV}/${BINDIR} + $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} ${GCOV_CFLAGS} ${GCOV_LDFLAGS} \ + -o ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} ${OBJECTS} ${LIBS} + +gcov: options ${PROJECT}-gcov + $(QUIET)${MAKE} -C tests run-gcov + $(call colorecho,LCOV,"Analyse data") + $(QUIET)${LCOV_EXEC} ${LCOV_FLAGS} + $(call colorecho,LCOV,"Generate report") + $(QUIET)${GENHTML_EXEC} ${GENHTML_FLAGS} + +# clean clean: - $(QUIET)rm -rf ${PROJECT} \ - ${OBJECTS} \ + $(QUIET)rm -rf \ + ${BUILDDIR} \ ${TARFILE} \ ${TARDIR} \ - ${DOBJECTS} \ - ${PROJECT}-debug \ - .depend \ ${PROJECT}.pc \ version.h \ version.h.tmp \ - dbus-interface-definitions.c \ - dbus-interface-definitions.c.tmp \ - css-definitions.c \ - css-definitions.c.tmp \ - *gcda *gcno $(PROJECT).info gcov *.tmp \ + ${PROJECT}/dbus-interface-definitions.c \ + ${PROJECT}/dbus-interface-definitions.c.tmp \ + ${PROJECT}/css-definitions.c \ + ${PROJECT}/css-definitions.c.tmp \ + *gcda \ + *gcno \ + $(PROJECT).info \ + gcov \ + *.tmp \ .version-checks $(QUIET)$(MAKE) -C tests clean $(QUIET)$(MAKE) -C po clean $(QUIET)$(MAKE) -C doc clean -${PROJECT}-debug: ${DOBJECTS} - $(call colorecho,CC,$@) - $(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS} - -debug: ${PROJECT}-debug - ${PROJECT}.pc: ${PROJECT}.pc.in config.mk $(QUIET)echo project=${PROJECT} > ${PROJECT}.pc $(QUIET)echo version=${VERSION} >> ${PROJECT}.pc @@ -170,12 +219,6 @@ dist: clean build-manpages doc: $(QUIET)make -C doc -gcov: clean - $(QUIET)CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" LDFLAGS="${LDFLAGS} -fprofile-arcs" ${MAKE} $(PROJECT) - $(QUIET)CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" LDFLAGS="${LDFLAGS} -fprofile-arcs" ${MAKE} -C tests run - $(QUIET)lcov --directory . --capture --output-file $(PROJECT).info - $(QUIET)genhtml --output-directory gcov $(PROJECT).info - po: $(QUIET)${MAKE} -C po diff --git a/config.mk b/config.mk index aa6a943..4b97885 100644 --- a/config.mk +++ b/config.mk @@ -50,6 +50,12 @@ LIBDIR ?= ${PREFIX}/lib INCLUDEDIR ?= ${PREFIX}/include DBUSINTERFACEDIR ?= ${PREFIX}/share/dbus-1/interfaces VIMFTPLUGINDIR ?= ${PREFIX}/share/vim/addons/ftplugin +DEPENDDIR ?= .depend +BUILDDIR ?= build +BUILDDIR_RELEASE ?= ${BUILDDIR}/release +BUILDDIR_DEBUG ?= ${BUILDDIR}/debug +BUILDDIR_GCOV ?= ${BUILDDIR}/gcov +BINDIR ?= bin # plugin directory PLUGINDIR ?= ${LIBDIR}/zathura @@ -111,6 +117,16 @@ SFLAGS ?= -s # msgfmt MSGFMT ?= msgfmt +# gcov & lcov +GCOV_CFLAGS=-fprofile-arcs -ftest-coverage +GCOV_LDFLAGS=-fprofile-arcs +LCOV_OUTPUT=gcov +LCOV_EXEC=lcov +LCOV_FLAGS=--base-directory . --directory ${BUILDDIR_GCOV} --capture --rc \ + lcov_branch_coverage=1 --output-file ${BUILDDIR_GCOV}/$(PROJECT).info +GENHTML_EXEC=genhtml +GENHTML_FLAGS=--rc lcov_branch_coverage=1 --output-directory ${LCOV_OUTPUT} ${BUILDDIR_GCOV}/$(PROJECT).info + # valgrind VALGRIND = valgrind VALGRIND_ARGUMENTS = --tool=memcheck --leak-check=yes --leak-resolution=high \ diff --git a/tests/Makefile b/tests/Makefile index 6b79136..21df56e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,82 +1,144 @@ # See LICENSE file for license and copyright information include ../config.mk +include ../colors.mk include ../common.mk + include config.mk PROJECT = tests SOURCE = tests.c $(wildcard test_*.c) -OBJECTS = ${SOURCE:.c=.o} +OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${SOURCE:.c=.o}) +OBJECTS_DEBUG = $(addprefix ${BUILDDIR_DEBUG}/,${SOURCE:.c=.o}) +OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o}) -ZOSOURCE = $(filter-out ../main.c,$(wildcard ../*.c)) +ZATHURA_OBJECTS = \ + $(filter-out ../${BUILDDIR_RELEASE}/zathura/main.o, $(wildcard ../${BUILDDIR_RELEASE}/zathura/*.o)) ifneq (${WITH_SQLITE},0) -INCS += $(SQLITE_INC) -LIBS += $(SQLITE_LIB) -ZSOURCE += $(ZOSOURCE) -ifeq (,$(findstring -DWITH_SQLITE,${CPPFLAGS})) +INCS += $(SQLITE_INC) +LIBS += $(SQLITE_LIB) CPPFLAGS += -DWITH_SQLITE -endif else -ZSOURCE = $(filter-out ../database-sqlite.c,$(ZOSOURCE)) +SOURCE = $(filter-out database-sqlite.c,$(OSOURCE)) endif ifneq ($(WITH_MAGIC),0) -INCS += $(MAGIC_INC) -LIBS += $(MAGIC_LIB) +INCS += $(MAGIC_INC) +LIBS += $(MAGIC_LIB) CPPFLAGS += -DWITH_MAGIC endif ifneq ($(WITH_SYSTEM_SYNCTEX),0) -INCS += $(SYNCTEX_INC) -LIBS += $(SYNCTEX_LIB) else -INCS += $(ZLIB_INC) +ZATHURA_OBJECTS += $(wildcard ../${BUILDDIR_RELEASE}/zathura/synctex/*.o) LIBS += $(ZLIB_LIB) -ZSOURCE += $(wildcard ../synctex/*.c) -CPPFLAGS += -I../synctex - -ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS})) -CPPFLAGS += -DSYNCTEX_VERBOSE=0 -endif -endif ifeq (,$(findstring -Isynctex,${CPPFLAGS})) -CPPFLAGS += -Isynctex +CPPFLAGS += -I${PROJECT}/synctex endif ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS})) CPPFLAGS += -DSYNCTEX_VERBOSE=0 endif +endif -ZOBJECTS = ${ZSOURCE:.c=.o} +ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),) +VALGRIND_ARGUMENTS += --suppressions=${VALGRIND_SUPPRESSION_FILE} +endif + +ifeq (,$(findstring -DZATHURA_PLUGINDIR,${CPPFLAGS})) +CPPFLAGS += -DZATHURA_PLUGINDIR=\"${PLUGINDIR}\" +endif +ifeq (,$(findstring -DGETTEXT_PACKAGE,${CPPFLAGS})) +CPPFLAGS += -DGETTEXT_PACKAGE=\"${PROJECT}\" +endif +ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS})) +CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\" +endif all: ${PROJECT} -run: ${PROJECT} - $(QUIET)./${PROJECT} - -options: - @echo ${PROJECT} build options: - @echo "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "DFLAGS = ${DFLAGS}" - @echo "CC = ${CC}" - -%.o: %.c - $(ECHO) CC $< - @mkdir -p .depend - $(QUIET)${CC} -c -I.. ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep +# release ${PROJECT}: options ${OBJECTS} - $(QUIET)make -C .. - $(ECHO) CC -o $@ - $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${ZOBJECTS} ${LIBS} + @echo "zathura objects: ${ZATHURA_OBJECTS}" + $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura + $(call colorecho,CC,$@) + $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ \ + ${OBJECTS} ${ZATHURA_OBJECTS} ${LIBS} ${ZATHURA_RELEASE} -${OBJECTS}: ../config.mk +${OBJECTS}: config.mk ../config.mk ../zathura/version.h + +${BUILDDIR_RELEASE}/%.o: %.c + $(call colorecho,CC,$<) + @mkdir -p ${DEPENDDIR}/$(dir $(abspath $@)) + @mkdir -p $(dir $(abspath $@)) + $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} \ + -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep + +run: ${PROJECT} + $(QUIET)${FIU_EXEC} ./${PROJECT} + +# debug + +debug: options ${PROJECT}-debug + +${PROJECT}-debug: ${OBJECTS_DEBUG} + $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura-debug + $(call colorecho,CC,$@) + $(QUIET)${CC} ${LDFLAGS} -o $@ \ + ${OBJECTS_DEBUG} ${ZATHURA_OBJECTS_DEBUG} ${LIBS} ${ZATHURA_DEBUG} + +${OBJECTS_DEBUG}: config.mk ../config.mk ../zathura/version.h + +${BUILDDIR_DEBUG}/%.o: %.c + @mkdir -p ${DEPENDDIR}/$(dir $(abspath $@)) + @mkdir -p $(dir $(abspath $@)) + $(call colorecho,CC,$<) + $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} \ + -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep + +run-debug: ${PROJECT}-debug + $(QUIET)${FIU_EXEC} ./${PROJECT}-debug + +# gcov + +gcov: options ${PROJECT}-gcov + +${PROJECT}-gcov: options ${OBJECTS_GCOV} + $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura-gcov + $(call colorecho,CC,$@) + $(QUIET)${CC} ${LDFLAGS} ${GCOV_LDFLAGS} -o $@ \ + ${OBJECTS_GCOV} ${ZATHURA_OBJECTS_GCOV} ${LIBS} ${ZATHURA_GCOV} + +${OBJECTS_GCOV}: config.mk ../config.mk ../zathura/version.h + +${BUILDDIR_GCOV}/%.o: %.c + @mkdir -p ${DEPENDDIR}/$(dir $(abspath $@)) + @mkdir -p $(dir $(abspath $@)) + $(call colorecho,CC,$<) + $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} ${DFLAGS} ${GCOV_DFLAGS} \ + -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep + +run-gcov: ${PROJECT}-gcov + $(QUIET)${FIU_EXEC} ./${PROJECT}-gcov + +../zathura/version.h: + $(MAKE) -C .. zathura/version.h + +valgrind: ${PROJECT}-debug + $(QUIET)G_SLICE=always-malloc G_DEBUG=gc-friendly ${FIU_EXEC} ${VALGRIND} ${VALGRIND_ARGUMENTS} ./${PROJECT}-debug clean: - $(QUIET)rm -rf ${OBJECTS} ${PROJECT} *.gcno *.gcda .depend + $(call colorecho,RM, "Clean test files") + $(QUIET)rm -rf ${PROJECT} + $(QUIET)rm -rf ${PROJECT}-debug + $(QUIET)rm -rf ${PROJECT}-gcov + $(QUIET)rm -rf ${BUILDDIR} + $(QUIET)rm -rf ${DEPENDDIR} + + $(QUIET)${MAKE} -C plugin clean .PHONY: all options clean debug run --include $(wildcard .depend/*.dep) +-include $(wildcard ${DEPENDDIR}/*.dep) diff --git a/tests/config.mk b/tests/config.mk index 12780b6..d0cf5f7 100644 --- a/tests/config.mk +++ b/tests/config.mk @@ -3,4 +3,15 @@ CHECK_INC ?= $(shell pkg-config --cflags check) CHECK_LIB ?= $(shell pkg-config --libs check) -LIBS += ${CHECK_LIB} +INCS += ${CHECK_INC} ${FIU_INC} -I../zathura +LIBS += ${CHECK_LIB} ${FIU_LIB} + +ZATHURA_RELEASE=../${BUILDDIR_RELEASE}/${BINDIR}/zathura +ZATHURA_DEBUG=../${BUILDDIR_DEBUG}/${BINDIR}/zathura +ZATHURA_GCOV=../${BUILDDIR_GCOV}/${BINDIR}/zathura + +# valgrind +VALGRIND = valgrind +VALGRIND_ARGUMENTS = --tool=memcheck --leak-check=yes --leak-resolution=high \ + --show-reachable=yes --log-file=zathura-valgrind.log +VALGRIND_SUPPRESSION_FILE = zathura.suppression diff --git a/tests/test_document.c b/tests/test_document.c index 4cfbcc7..c5aea4a 100644 --- a/tests/test_document.c +++ b/tests/test_document.c @@ -2,7 +2,7 @@ #include -#include "../document.h" +#include "document.h" START_TEST(test_open) { fail_unless(zathura_document_open(NULL, NULL, NULL, NULL) == NULL, "Could create document", NULL); diff --git a/tests/test_session.c b/tests/test_session.c index 88b54cb..86d1b95 100644 --- a/tests/test_session.c +++ b/tests/test_session.c @@ -2,7 +2,7 @@ #include -#include "../zathura.h" +#include "zathura.h" START_TEST(test_create) { zathura_t* zathura = zathura_create(); diff --git a/tests/test_utils.c b/tests/test_utils.c index 9a098fe..10c224f 100644 --- a/tests/test_utils.c +++ b/tests/test_utils.c @@ -2,7 +2,7 @@ #include -#include "../utils.h" +#include "utils.h" START_TEST(test_file_valid_extension_null) { fail_unless(file_valid_extension(NULL, NULL) == false, NULL); diff --git a/adjustment.c b/zathura/adjustment.c similarity index 100% rename from adjustment.c rename to zathura/adjustment.c diff --git a/adjustment.h b/zathura/adjustment.h similarity index 100% rename from adjustment.h rename to zathura/adjustment.h diff --git a/bookmarks.c b/zathura/bookmarks.c similarity index 100% rename from bookmarks.c rename to zathura/bookmarks.c diff --git a/bookmarks.h b/zathura/bookmarks.h similarity index 100% rename from bookmarks.h rename to zathura/bookmarks.h diff --git a/callbacks.c b/zathura/callbacks.c similarity index 100% rename from callbacks.c rename to zathura/callbacks.c diff --git a/callbacks.h b/zathura/callbacks.h similarity index 100% rename from callbacks.h rename to zathura/callbacks.h diff --git a/commands.c b/zathura/commands.c similarity index 100% rename from commands.c rename to zathura/commands.c diff --git a/commands.h b/zathura/commands.h similarity index 100% rename from commands.h rename to zathura/commands.h diff --git a/completion.c b/zathura/completion.c similarity index 100% rename from completion.c rename to zathura/completion.c diff --git a/completion.h b/zathura/completion.h similarity index 100% rename from completion.h rename to zathura/completion.h diff --git a/config.c b/zathura/config.c similarity index 100% rename from config.c rename to zathura/config.c diff --git a/config.h b/zathura/config.h similarity index 100% rename from config.h rename to zathura/config.h diff --git a/content-type.c b/zathura/content-type.c similarity index 100% rename from content-type.c rename to zathura/content-type.c diff --git a/content-type.h b/zathura/content-type.h similarity index 100% rename from content-type.h rename to zathura/content-type.h diff --git a/css-definitions.h b/zathura/css-definitions.h similarity index 100% rename from css-definitions.h rename to zathura/css-definitions.h diff --git a/database-plain.c b/zathura/database-plain.c similarity index 100% rename from database-plain.c rename to zathura/database-plain.c diff --git a/database-plain.h b/zathura/database-plain.h similarity index 100% rename from database-plain.h rename to zathura/database-plain.h diff --git a/database-sqlite.c b/zathura/database-sqlite.c similarity index 100% rename from database-sqlite.c rename to zathura/database-sqlite.c diff --git a/database-sqlite.h b/zathura/database-sqlite.h similarity index 100% rename from database-sqlite.h rename to zathura/database-sqlite.h diff --git a/database.c b/zathura/database.c similarity index 100% rename from database.c rename to zathura/database.c diff --git a/database.h b/zathura/database.h similarity index 100% rename from database.h rename to zathura/database.h diff --git a/dbus-interface-definitions.h b/zathura/dbus-interface-definitions.h similarity index 100% rename from dbus-interface-definitions.h rename to zathura/dbus-interface-definitions.h diff --git a/dbus-interface.c b/zathura/dbus-interface.c similarity index 100% rename from dbus-interface.c rename to zathura/dbus-interface.c diff --git a/dbus-interface.h b/zathura/dbus-interface.h similarity index 100% rename from dbus-interface.h rename to zathura/dbus-interface.h diff --git a/document.c b/zathura/document.c similarity index 100% rename from document.c rename to zathura/document.c diff --git a/document.h b/zathura/document.h similarity index 100% rename from document.h rename to zathura/document.h diff --git a/glib-compat.h b/zathura/glib-compat.h similarity index 100% rename from glib-compat.h rename to zathura/glib-compat.h diff --git a/internal.h b/zathura/internal.h similarity index 100% rename from internal.h rename to zathura/internal.h diff --git a/links.c b/zathura/links.c similarity index 100% rename from links.c rename to zathura/links.c diff --git a/links.h b/zathura/links.h similarity index 100% rename from links.h rename to zathura/links.h diff --git a/macros.h b/zathura/macros.h similarity index 100% rename from macros.h rename to zathura/macros.h diff --git a/main.c b/zathura/main.c similarity index 100% rename from main.c rename to zathura/main.c diff --git a/marks.c b/zathura/marks.c similarity index 100% rename from marks.c rename to zathura/marks.c diff --git a/marks.h b/zathura/marks.h similarity index 100% rename from marks.h rename to zathura/marks.h diff --git a/page-widget.c b/zathura/page-widget.c similarity index 100% rename from page-widget.c rename to zathura/page-widget.c diff --git a/page-widget.h b/zathura/page-widget.h similarity index 100% rename from page-widget.h rename to zathura/page-widget.h diff --git a/page.c b/zathura/page.c similarity index 100% rename from page.c rename to zathura/page.c diff --git a/page.h b/zathura/page.h similarity index 100% rename from page.h rename to zathura/page.h diff --git a/plugin-api.h b/zathura/plugin-api.h similarity index 100% rename from plugin-api.h rename to zathura/plugin-api.h diff --git a/plugin.c b/zathura/plugin.c similarity index 100% rename from plugin.c rename to zathura/plugin.c diff --git a/plugin.h b/zathura/plugin.h similarity index 100% rename from plugin.h rename to zathura/plugin.h diff --git a/print.c b/zathura/print.c similarity index 100% rename from print.c rename to zathura/print.c diff --git a/print.h b/zathura/print.h similarity index 100% rename from print.h rename to zathura/print.h diff --git a/render.c b/zathura/render.c similarity index 100% rename from render.c rename to zathura/render.c diff --git a/render.h b/zathura/render.h similarity index 100% rename from render.h rename to zathura/render.h diff --git a/shortcuts.c b/zathura/shortcuts.c similarity index 100% rename from shortcuts.c rename to zathura/shortcuts.c diff --git a/shortcuts.h b/zathura/shortcuts.h similarity index 100% rename from shortcuts.h rename to zathura/shortcuts.h diff --git a/synctex.c b/zathura/synctex.c similarity index 100% rename from synctex.c rename to zathura/synctex.c diff --git a/synctex.h b/zathura/synctex.h similarity index 100% rename from synctex.h rename to zathura/synctex.h diff --git a/synctex/LICENSE b/zathura/synctex/LICENSE similarity index 100% rename from synctex/LICENSE rename to zathura/synctex/LICENSE diff --git a/synctex/Makefile b/zathura/synctex/Makefile similarity index 100% rename from synctex/Makefile rename to zathura/synctex/Makefile diff --git a/synctex/synctex_parser.c b/zathura/synctex/synctex_parser.c similarity index 100% rename from synctex/synctex_parser.c rename to zathura/synctex/synctex_parser.c diff --git a/synctex/synctex_parser.h b/zathura/synctex/synctex_parser.h similarity index 100% rename from synctex/synctex_parser.h rename to zathura/synctex/synctex_parser.h diff --git a/synctex/synctex_parser_utils.c b/zathura/synctex/synctex_parser_utils.c similarity index 100% rename from synctex/synctex_parser_utils.c rename to zathura/synctex/synctex_parser_utils.c diff --git a/synctex/synctex_parser_utils.h b/zathura/synctex/synctex_parser_utils.h similarity index 100% rename from synctex/synctex_parser_utils.h rename to zathura/synctex/synctex_parser_utils.h diff --git a/synctex/synctex_parser_version.txt b/zathura/synctex/synctex_parser_version.txt similarity index 100% rename from synctex/synctex_parser_version.txt rename to zathura/synctex/synctex_parser_version.txt diff --git a/types.c b/zathura/types.c similarity index 100% rename from types.c rename to zathura/types.c diff --git a/types.h b/zathura/types.h similarity index 100% rename from types.h rename to zathura/types.h diff --git a/utils.c b/zathura/utils.c similarity index 100% rename from utils.c rename to zathura/utils.c diff --git a/utils.h b/zathura/utils.h similarity index 100% rename from utils.h rename to zathura/utils.h diff --git a/version.h.in b/zathura/version.h.in similarity index 100% rename from version.h.in rename to zathura/version.h.in diff --git a/zathura.c b/zathura/zathura.c similarity index 100% rename from zathura.c rename to zathura/zathura.c diff --git a/zathura.h b/zathura/zathura.h similarity index 100% rename from zathura.h rename to zathura/zathura.h From c1e05c92f45fd2840f29d93bb3110519e2efabba Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Fri, 7 Nov 2014 16:01:29 +0100 Subject: [PATCH 2/4] Update test Makefile --- tests/Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 21df56e..dbcae71 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -61,11 +61,10 @@ all: ${PROJECT} # release ${PROJECT}: options ${OBJECTS} - @echo "zathura objects: ${ZATHURA_OBJECTS}" $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura $(call colorecho,CC,$@) $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ \ - ${OBJECTS} ${ZATHURA_OBJECTS} ${LIBS} ${ZATHURA_RELEASE} + ${OBJECTS} ${ZATHURA_OBJECTS} ${LIBS} ${OBJECTS}: config.mk ../config.mk ../zathura/version.h @@ -87,7 +86,7 @@ ${PROJECT}-debug: ${OBJECTS_DEBUG} $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura-debug $(call colorecho,CC,$@) $(QUIET)${CC} ${LDFLAGS} -o $@ \ - ${OBJECTS_DEBUG} ${ZATHURA_OBJECTS_DEBUG} ${LIBS} ${ZATHURA_DEBUG} + ${OBJECTS_DEBUG} ${ZATHURA_OBJECTS_DEBUG} ${LIBS} ${OBJECTS_DEBUG}: config.mk ../config.mk ../zathura/version.h @@ -109,7 +108,7 @@ ${PROJECT}-gcov: options ${OBJECTS_GCOV} $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura-gcov $(call colorecho,CC,$@) $(QUIET)${CC} ${LDFLAGS} ${GCOV_LDFLAGS} -o $@ \ - ${OBJECTS_GCOV} ${ZATHURA_OBJECTS_GCOV} ${LIBS} ${ZATHURA_GCOV} + ${OBJECTS_GCOV} ${ZATHURA_OBJECTS_GCOV} ${LIBS} ${OBJECTS_GCOV}: config.mk ../config.mk ../zathura/version.h @@ -137,8 +136,6 @@ clean: $(QUIET)rm -rf ${BUILDDIR} $(QUIET)rm -rf ${DEPENDDIR} - $(QUIET)${MAKE} -C plugin clean - .PHONY: all options clean debug run -include $(wildcard ${DEPENDDIR}/*.dep) From e96c96f2764440d11fbaf7a1a283600d1f9f4dcd Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Fri, 7 Nov 2014 18:08:59 +0100 Subject: [PATCH 3/4] Update Makefile --- Makefile | 8 +++----- tests/.gitignore | 2 ++ tests/Makefile | 10 ++++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index fe97a08..17ccb94 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o}) \ ${BUILDDIR_GCOV}/${PROJECT}/css-definitions.o \ ${BUILDDIR_GCOV}/${PROJECT}/dbus-interface-definitions.o HEADER = $(wildcard ${PROJECT}/*.h) $(wildcard synctex/*.h) -HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h +HEADERINST = $(addprefix ${PROJECT}/,version.h document.h macros.h page.h types.h plugin-api.h links.h) all: options ${PROJECT} po build-manpages @@ -171,6 +171,7 @@ gcov: options ${PROJECT}-gcov clean: $(QUIET)rm -rf \ ${BUILDDIR} \ + ${DEPENDDIR} \ ${TARFILE} \ ${TARDIR} \ ${PROJECT}.pc \ @@ -180,11 +181,8 @@ clean: ${PROJECT}/dbus-interface-definitions.c.tmp \ ${PROJECT}/css-definitions.c \ ${PROJECT}/css-definitions.c.tmp \ - *gcda \ - *gcno \ $(PROJECT).info \ gcov \ - *.tmp \ .version-checks $(QUIET)$(MAKE) -C tests clean $(QUIET)$(MAKE) -C po clean @@ -260,7 +258,7 @@ install-appdata: install: all install-headers install-manpages install-dbus install-appdata $(call colorecho,INSTALL,"executeable file") $(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin - $(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin + $(QUIET)install -m 755 ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} ${DESTDIR}${PREFIX}/bin $(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX} $(call colorecho,INSTALL,"desktop file") $(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX} diff --git a/tests/.gitignore b/tests/.gitignore index 2b29f27..75c5b11 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1 +1,3 @@ tests +tests-gcov +tests-debug diff --git a/tests/Makefile b/tests/Makefile index dbcae71..d035fc7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -14,6 +14,10 @@ OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o}) ZATHURA_OBJECTS = \ $(filter-out ../${BUILDDIR_RELEASE}/zathura/main.o, $(wildcard ../${BUILDDIR_RELEASE}/zathura/*.o)) +ZATHURA_OBJECTS_DEBUG = \ + $(filter-out ../${BUILDDIR_DEBUG}/zathura/main.o, $(wildcard ../${BUILDDIR_DEBUG}/zathura/*.o)) +ZATHURA_OBJECTS_GCOV= \ + $(filter-out ../${BUILDDIR_GCOV}/zathura/main.o, $(wildcard ../${BUILDDIR_GCOV}/zathura/*.o)) ifneq (${WITH_SQLITE},0) INCS += $(SQLITE_INC) @@ -31,11 +35,13 @@ endif ifneq ($(WITH_SYSTEM_SYNCTEX),0) else -ZATHURA_OBJECTS += $(wildcard ../${BUILDDIR_RELEASE}/zathura/synctex/*.o) +ZATHURA_OBJECTS += $(wildcard ../${BUILDDIR_RELEASE}/zathura/synctex/*.o) +ZATHURA_OBJECTS_DEBUG += $(wildcard ../${BUILDDIR_DEBUG}/zathura/synctex/*.o) +ZATHURA_OBJECTS_GCOV += $(wildcard ../${BUILDDIR_GCOV}/zathura/synctex/*.o) LIBS += $(ZLIB_LIB) ifeq (,$(findstring -Isynctex,${CPPFLAGS})) -CPPFLAGS += -I${PROJECT}/synctex +CPPFLAGS += -I../zathura/synctex endif ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS})) CPPFLAGS += -DSYNCTEX_VERBOSE=0 From f408b3a7755ea6fd8d2a189be8aa1303603b174d Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Fri, 7 Nov 2014 22:05:03 +0100 Subject: [PATCH 4/4] Update Makefiles and fix dependencies --- Makefile | 14 ++++++---- tests/Makefile | 76 ++++++++++++++++++++++++-------------------------- 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index 17ccb94..fcfd913 100644 --- a/Makefile +++ b/Makefile @@ -115,12 +115,16 @@ ${BUILDDIR_RELEASE}/%.o: %.c @mkdir -p $(dir $(abspath $@)) $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep -${PROJECT}: ${OBJECTS} +${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}: ${OBJECTS} $(call colorecho,CC,$@) @mkdir -p ${BUILDDIR_RELEASE}/${BINDIR} $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \ -o ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} ${OBJECTS} ${LIBS} +${PROJECT}: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} + +release: ${PROJECT} + # debug build ${OBJECTS_DEBUG}: config.mk ${PROJECT}/version.h \ @@ -133,13 +137,13 @@ ${BUILDDIR_DEBUG}/%.o: %.c $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} \ -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep -${PROJECT}-debug: ${OBJECTS_DEBUG} +${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}: ${OBJECTS_DEBUG} $(call colorecho,CC,$@) @mkdir -p ${BUILDDIR_DEBUG}/${BINDIR} $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \ -o ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} ${OBJECTS} ${LIBS} -debug: ${PROJECT}-debug +debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} # gcov build @@ -153,13 +157,13 @@ ${BUILDDIR_GCOV}/%.o: %.c $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} \ -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep -${PROJECT}-gcov: ${OBJECTS_GCOV} +${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}: ${OBJECTS_GCOV} $(call colorecho,CC,$@) @mkdir -p ${BUILDDIR_GCOV}/${BINDIR} $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} ${GCOV_CFLAGS} ${GCOV_LDFLAGS} \ -o ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} ${OBJECTS} ${LIBS} -gcov: options ${PROJECT}-gcov +gcov: options ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} $(QUIET)${MAKE} -C tests run-gcov $(call colorecho,LCOV,"Analyse data") $(QUIET)${LCOV_EXEC} ${LCOV_FLAGS} diff --git a/tests/Makefile b/tests/Makefile index d035fc7..940f1bc 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -52,26 +52,10 @@ ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),) VALGRIND_ARGUMENTS += --suppressions=${VALGRIND_SUPPRESSION_FILE} endif -ifeq (,$(findstring -DZATHURA_PLUGINDIR,${CPPFLAGS})) -CPPFLAGS += -DZATHURA_PLUGINDIR=\"${PLUGINDIR}\" -endif -ifeq (,$(findstring -DGETTEXT_PACKAGE,${CPPFLAGS})) -CPPFLAGS += -DGETTEXT_PACKAGE=\"${PROJECT}\" -endif -ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS})) -CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\" -endif - -all: ${PROJECT} +all: release # release -${PROJECT}: options ${OBJECTS} - $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura - $(call colorecho,CC,$@) - $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ \ - ${OBJECTS} ${ZATHURA_OBJECTS} ${LIBS} - ${OBJECTS}: config.mk ../config.mk ../zathura/version.h ${BUILDDIR_RELEASE}/%.o: %.c @@ -81,19 +65,21 @@ ${BUILDDIR_RELEASE}/%.o: %.c $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} \ -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep -run: ${PROJECT} - $(QUIET)${FIU_EXEC} ./${PROJECT} +${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}: ${OBJECTS} + $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. ${BUILDDIR_RELEASE}/${BINDIR}/zathura + $(call colorecho,CC,$@) + @mkdir -p ${BUILDDIR_RELEASE}/${BINDIR} + $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \ + -o ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} \ + ${OBJECTS} ${ZATHURA_OBJECTS} ${LIBS} + +release: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} + +run: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} + $(QUIET)${FIU_EXEC} ./${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} # debug -debug: options ${PROJECT}-debug - -${PROJECT}-debug: ${OBJECTS_DEBUG} - $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura-debug - $(call colorecho,CC,$@) - $(QUIET)${CC} ${LDFLAGS} -o $@ \ - ${OBJECTS_DEBUG} ${ZATHURA_OBJECTS_DEBUG} ${LIBS} - ${OBJECTS_DEBUG}: config.mk ../config.mk ../zathura/version.h ${BUILDDIR_DEBUG}/%.o: %.c @@ -103,19 +89,21 @@ ${BUILDDIR_DEBUG}/%.o: %.c $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} \ -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep -run-debug: ${PROJECT}-debug - $(QUIET)${FIU_EXEC} ./${PROJECT}-debug +${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}: ${OBJECTS_DEBUG} + $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. ${BUILDDIR_DEBUG}/${BINDIR}/zathura + $(call colorecho,CC,$@) + @mkdir -p ${BUILDDIR_DEBUG}/${BINDIR} + $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \ + -o ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} \ + ${OBJECTS} ${ZATHURA_OBJECTS_DEBUG} ${LIBS} + +debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} + +run-debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} + $(QUIET)${FIU_EXEC} ./${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} # gcov -gcov: options ${PROJECT}-gcov - -${PROJECT}-gcov: options ${OBJECTS_GCOV} - $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. zathura-gcov - $(call colorecho,CC,$@) - $(QUIET)${CC} ${LDFLAGS} ${GCOV_LDFLAGS} -o $@ \ - ${OBJECTS_GCOV} ${ZATHURA_OBJECTS_GCOV} ${LIBS} - ${OBJECTS_GCOV}: config.mk ../config.mk ../zathura/version.h ${BUILDDIR_GCOV}/%.o: %.c @@ -125,8 +113,18 @@ ${BUILDDIR_GCOV}/%.o: %.c $(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} ${DFLAGS} ${GCOV_DFLAGS} \ -o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep -run-gcov: ${PROJECT}-gcov - $(QUIET)${FIU_EXEC} ./${PROJECT}-gcov +${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}: ${OBJECTS_GCOV} + $(QUIET)${MAKE} WITH_LIBFIU=1 -C .. ${BUILDDIR_GCOV}/${BINDIR}/zathura + $(call colorecho,CC,$@) + @mkdir -p ${BUILDDIR_GCOV}/${BINDIR} + $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} ${GCOV_CFLAGS} ${GCOV_LDFLAGS} \ + -o ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} \ + ${OBJECTS} ${ZATHURA_OBJECTS_GCOV} ${LIBS} + +gcov: ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} + +run-gcov: gcov + $(QUIET)${FIU_EXEC} ./${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} ../zathura/version.h: $(MAKE) -C .. zathura/version.h