zathura/tests/Makefile

146 lines
4.4 KiB
Makefile
Raw Normal View History

2012-01-28 19:54:10 +01:00
# See LICENSE file for license and copyright information
include ../config.mk
2014-11-07 15:57:46 +01:00
include ../colors.mk
2012-01-28 19:54:10 +01:00
include ../common.mk
2014-11-07 15:57:46 +01:00
2012-01-28 19:54:10 +01:00
include config.mk
PROJECT = tests
SOURCE = tests.c $(wildcard test_*.c)
2014-11-07 15:57:46 +01:00
OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${SOURCE:.c=.o})
OBJECTS_DEBUG = $(addprefix ${BUILDDIR_DEBUG}/,${SOURCE:.c=.o})
OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o})
2012-01-28 19:54:10 +01:00
2014-11-07 15:57:46 +01:00
ZATHURA_OBJECTS = \
$(filter-out ../${BUILDDIR_RELEASE}/zathura/main.o, $(wildcard ../${BUILDDIR_RELEASE}/zathura/*.o))
2014-11-07 18:08:59 +01:00
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))
2012-01-28 19:54:10 +01:00
ifneq (${WITH_SQLITE},0)
2014-11-07 15:57:46 +01:00
INCS += $(SQLITE_INC)
LIBS += $(SQLITE_LIB)
CPPFLAGS += -DWITH_SQLITE
else
2014-11-07 15:57:46 +01:00
SOURCE = $(filter-out database-sqlite.c,$(OSOURCE))
2012-01-28 19:54:10 +01:00
endif
ifneq ($(WITH_MAGIC),0)
2014-11-07 15:57:46 +01:00
INCS += $(MAGIC_INC)
LIBS += $(MAGIC_LIB)
CPPFLAGS += -DWITH_MAGIC
endif
ifneq ($(WITH_SYSTEM_SYNCTEX),0)
else
2014-11-07 18:08:59 +01:00
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)
2014-11-07 15:57:46 +01:00
ifeq (,$(findstring -Isynctex,${CPPFLAGS}))
2014-11-07 18:08:59 +01:00
CPPFLAGS += -I../zathura/synctex
2014-11-07 15:57:46 +01:00
endif
ifeq (,$(findstring -DSYNCTEX_VERBOSE=0,${CPPFLAGS}))
CPPFLAGS += -DSYNCTEX_VERBOSE=0
endif
endif
2014-11-07 15:57:46 +01:00
ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),)
VALGRIND_ARGUMENTS += --suppressions=${VALGRIND_SUPPRESSION_FILE}
endif
2014-11-07 22:05:03 +01:00
all: release
2012-01-28 19:54:10 +01:00
2014-11-07 15:57:46 +01:00
# release
${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
2014-11-07 22:05:03 +01:00
${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}
2012-01-28 19:54:10 +01:00
2014-11-07 22:05:03 +01:00
release: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
2012-01-28 19:54:10 +01:00
2014-11-07 22:05:03 +01:00
run: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
$(QUIET)${FIU_EXEC} ./${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
2012-01-28 19:54:10 +01:00
2014-11-07 22:05:03 +01:00
# debug
2014-11-07 15:57:46 +01:00
${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
2014-11-07 22:05:03 +01:00
${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}
2014-11-07 15:57:46 +01:00
2014-11-07 22:05:03 +01:00
debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
2012-01-28 19:54:10 +01:00
2014-11-07 22:05:03 +01:00
run-debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
$(QUIET)${FIU_EXEC} ./${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
2014-11-07 15:57:46 +01:00
2014-11-07 22:05:03 +01:00
# gcov
2014-11-07 15:57:46 +01:00
${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
2014-11-07 22:05:03 +01:00
${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}
2014-11-07 15:57:46 +01:00
../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
2012-01-28 19:54:10 +01:00
clean:
2014-11-07 15:57:46 +01:00
$(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
2012-01-28 19:54:10 +01:00
2014-11-07 15:57:46 +01:00
-include $(wildcard ${DEPENDDIR}/*.dep)