mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 08:16:00 +01:00
Merge branch 'feature/build-system' into develop
This commit is contained in:
commit
dbf3f852c3
71 changed files with 230 additions and 93 deletions
139
Makefile
139
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 = $(addprefix ${PROJECT}/,version.h document.h macros.h page.h types.h plugin-api.h links.h)
|
||||
|
||||
all: options ${PROJECT} po build-manpages
|
||||
|
||||
|
@ -75,72 +82,116 @@ 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
|
||||
|
||||
${PROJECT}: ${OBJECTS}
|
||||
${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
|
||||
|
||||
${BUILDDIR_RELEASE}/${BINDIR}/${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}
|
||||
|
||||
${PROJECT}: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
|
||||
|
||||
release: ${PROJECT}
|
||||
|
||||
# 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
|
||||
|
||||
${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: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
|
||||
|
||||
# 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
|
||||
|
||||
${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 ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}
|
||||
$(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} \
|
||||
${DEPENDDIR} \
|
||||
${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 \
|
||||
$(PROJECT).info \
|
||||
gcov \
|
||||
.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 +221,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
|
||||
|
||||
|
@ -217,7 +262,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}
|
||||
|
|
16
config.mk
16
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 \
|
||||
|
|
2
tests/.gitignore
vendored
2
tests/.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
tests
|
||||
tests-gcov
|
||||
tests-debug
|
||||
|
|
147
tests/Makefile
147
tests/Makefile
|
@ -1,82 +1,145 @@
|
|||
# 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))
|
||||
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)
|
||||
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)
|
||||
ZATHURA_OBJECTS_DEBUG += $(wildcard ../${BUILDDIR_DEBUG}/zathura/synctex/*.o)
|
||||
ZATHURA_OBJECTS_GCOV += $(wildcard ../${BUILDDIR_GCOV}/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../zathura/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
|
||||
|
||||
all: ${PROJECT}
|
||||
all: release
|
||||
|
||||
run: ${PROJECT}
|
||||
$(QUIET)./${PROJECT}
|
||||
# release
|
||||
|
||||
options:
|
||||
@echo ${PROJECT} build options:
|
||||
@echo "CFLAGS = ${CFLAGS}"
|
||||
@echo "LDFLAGS = ${LDFLAGS}"
|
||||
@echo "DFLAGS = ${DFLAGS}"
|
||||
@echo "CC = ${CC}"
|
||||
${OBJECTS}: config.mk ../config.mk ../zathura/version.h
|
||||
|
||||
%.o: %.c
|
||||
$(ECHO) CC $<
|
||||
@mkdir -p .depend
|
||||
$(QUIET)${CC} -c -I.. ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
||||
${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}: options ${OBJECTS}
|
||||
$(QUIET)make -C ..
|
||||
$(ECHO) CC -o $@
|
||||
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${ZOBJECTS} ${LIBS}
|
||||
${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}
|
||||
|
||||
${OBJECTS}: ../config.mk
|
||||
release: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
|
||||
|
||||
run: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
|
||||
$(QUIET)${FIU_EXEC} ./${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
|
||||
|
||||
# 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
|
||||
|
||||
${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
|
||||
|
||||
${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
|
||||
|
||||
${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
|
||||
|
||||
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}
|
||||
|
||||
.PHONY: all options clean debug run
|
||||
|
||||
-include $(wildcard .depend/*.dep)
|
||||
-include $(wildcard ${DEPENDDIR}/*.dep)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <check.h>
|
||||
|
||||
#include "../document.h"
|
||||
#include "document.h"
|
||||
|
||||
START_TEST(test_open) {
|
||||
fail_unless(zathura_document_open(NULL, NULL, NULL, NULL) == NULL, "Could create document", NULL);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <check.h>
|
||||
|
||||
#include "../zathura.h"
|
||||
#include "zathura.h"
|
||||
|
||||
START_TEST(test_create) {
|
||||
zathura_t* zathura = zathura_create();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <check.h>
|
||||
|
||||
#include "../utils.h"
|
||||
#include "utils.h"
|
||||
|
||||
START_TEST(test_file_valid_extension_null) {
|
||||
fail_unless(file_valid_extension(NULL, NULL) == false, NULL);
|
||||
|
|
Loading…
Reference in a new issue