2009-12-26 14:30:50 +01:00
|
|
|
# See LICENSE file for license and copyright information
|
2009-08-11 23:18:50 +02:00
|
|
|
|
2009-12-26 14:30:50 +01:00
|
|
|
include config.mk
|
2011-08-31 16:41:07 +02:00
|
|
|
include common.mk
|
2009-08-11 23:18:50 +02:00
|
|
|
|
2009-12-26 14:30:50 +01:00
|
|
|
PROJECT = zathura
|
2012-03-04 15:56:54 +01:00
|
|
|
OSOURCE = $(shell find . -maxdepth 1 -iname "*.c" -a ! -iname "database-sqlite.c")
|
2012-03-01 03:04:09 +01:00
|
|
|
HEADER = $(shell find . -maxdepth 1 -iname "*.h")
|
2009-12-26 14:30:50 +01:00
|
|
|
|
2012-03-04 15:56:54 +01:00
|
|
|
ifneq (${WITH_SQLITE},0)
|
2011-10-10 23:46:50 +02:00
|
|
|
INCS += $(SQLITE_INC)
|
|
|
|
LIBS += $(SQLITE_LIB)
|
2012-03-01 03:04:09 +01:00
|
|
|
SOURCE = $(OSOURCE) database-sqlite.c
|
2012-03-04 15:56:54 +01:00
|
|
|
CPPFLAGS += -DWITH_SQLITE
|
2011-10-10 23:46:50 +02:00
|
|
|
endif
|
|
|
|
|
2012-03-07 16:15:06 +01:00
|
|
|
ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),)
|
|
|
|
VALGRIND_ARGUMENTS += --suppressions=${VALGRIND_SUPPRESSION_FILE}
|
|
|
|
endif
|
|
|
|
|
2012-03-01 03:04:09 +01:00
|
|
|
OBJECTS = $(patsubst %.c, %.o, $(SOURCE))
|
|
|
|
DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
|
|
|
|
|
2009-12-26 14:30:50 +01:00
|
|
|
all: options ${PROJECT}
|
|
|
|
|
|
|
|
options:
|
2010-01-28 13:57:54 +01:00
|
|
|
@echo ${PROJECT} build options:
|
2009-12-26 14:30:50 +01:00
|
|
|
@echo "CFLAGS = ${CFLAGS}"
|
2010-03-12 18:23:41 +01:00
|
|
|
@echo "LIBS = ${LIBS}"
|
2009-12-26 14:30:50 +01:00
|
|
|
@echo "DFLAGS = ${DFLAGS}"
|
|
|
|
@echo "CC = ${CC}"
|
|
|
|
|
2012-02-25 15:21:00 +01:00
|
|
|
version.h: version.h.in config.mk
|
|
|
|
$(QUIET)sed 's/ZVMAJOR/${ZATHURA_VERSION_MAJOR}/' < version.h.in | \
|
|
|
|
sed 's/ZVMINOR/${ZATHURA_VERSION_MINOR}/' | \
|
|
|
|
sed 's/ZVREV/${ZATHURA_VERSION_REV}/' | \
|
|
|
|
sed 's/ZVAPI/${ZATHURA_API_VERSION}/' > version.h
|
|
|
|
|
2009-12-26 14:30:50 +01:00
|
|
|
%.o: %.c
|
2011-08-31 16:41:07 +02:00
|
|
|
$(ECHO) CC $<
|
2011-04-19 18:53:41 +02:00
|
|
|
@mkdir -p .depend
|
2011-11-11 16:14:29 +01:00
|
|
|
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
%.do: %.c
|
2011-08-31 16:41:07 +02:00
|
|
|
$(ECHO) CC $<
|
2011-04-19 18:53:41 +02:00
|
|
|
@mkdir -p .depend
|
2011-11-11 16:14:29 +01:00
|
|
|
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
2009-12-26 14:30:50 +01:00
|
|
|
|
2012-02-25 15:21:00 +01:00
|
|
|
${OBJECTS}: config.mk version.h
|
|
|
|
${DOBJECTS}: config.mk version.h
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
${PROJECT}: ${OBJECTS}
|
2011-08-31 16:41:07 +02:00
|
|
|
$(ECHO) CC -o $@
|
|
|
|
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
|
2009-08-11 23:18:50 +02:00
|
|
|
|
|
|
|
clean:
|
2011-08-31 16:41:07 +02:00
|
|
|
$(QUIET)rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \
|
2012-02-25 15:21:00 +01:00
|
|
|
${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \
|
|
|
|
*gcda *gcno $(PROJECT).info gcov
|
2012-02-08 15:36:08 +01:00
|
|
|
$(QUIET)make -C tests clean
|
2012-03-04 18:35:16 +01:00
|
|
|
$(QUIET)make -C po clean
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
${PROJECT}-debug: ${DOBJECTS}
|
2011-08-31 16:41:07 +02:00
|
|
|
$(ECHO) CC -o $@
|
|
|
|
$(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
|
2009-08-11 23:18:50 +02:00
|
|
|
|
2009-12-26 14:30:50 +01:00
|
|
|
debug: ${PROJECT}-debug
|
2009-08-11 23:18:50 +02:00
|
|
|
|
2011-07-10 20:14:31 +02:00
|
|
|
${PROJECT}.pc: ${PROJECT}.pc.in config.mk
|
2011-08-31 16:41:07 +02:00
|
|
|
$(QUIET)echo project=${PROJECT} > ${PROJECT}.pc
|
|
|
|
$(QUIET)echo version=${VERSION} >> ${PROJECT}.pc
|
2012-02-25 15:21:00 +01:00
|
|
|
$(QUIET)echo apiversion=${ZATHHRA_API_VERSION} >> ${PROJECT}.pc
|
2011-08-31 16:41:07 +02:00
|
|
|
$(QUIET)echo includedir=${PREFIX}/include >> ${PROJECT}.pc
|
2012-02-14 16:30:15 +01:00
|
|
|
$(QUIET)echo plugindir=${PLUGINDIR} >> ${PROJECT}.pc
|
2012-02-21 14:30:08 +01:00
|
|
|
$(QUIET)echo GTK_VERSION=${ZATHURA_GTK_VERSION} >> ${PROJECT}.pc
|
2011-08-31 16:41:07 +02:00
|
|
|
$(QUIET)cat ${PROJECT}.pc.in >> ${PROJECT}.pc
|
2011-07-10 20:14:31 +02:00
|
|
|
|
2009-09-12 11:19:51 +02:00
|
|
|
valgrind: debug
|
2012-03-07 16:15:06 +01:00
|
|
|
$(QUIET)G_SLICE=always-malloc G_DEBUG=gc-friendly ${VALGRIND} ${VALGRIND_ARGUMENTS} \
|
|
|
|
./${PROJECT}-debug
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
gdb: debug
|
2012-03-06 21:09:58 +01:00
|
|
|
$(QUIET)cgdb ${PROJECT}-debug
|
2009-12-26 14:30:50 +01:00
|
|
|
|
2012-02-21 19:14:27 +01:00
|
|
|
test: ${OBJECTS}
|
2012-02-21 19:05:35 +01:00
|
|
|
$(QUIET)make -C tests run
|
2012-01-28 19:54:10 +01:00
|
|
|
|
2009-12-26 14:30:50 +01:00
|
|
|
dist: clean
|
2011-08-31 16:43:35 +02:00
|
|
|
$(QUIET)mkdir -p ${PROJECT}-${VERSION}
|
2012-02-20 22:23:11 +01:00
|
|
|
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/tests
|
2012-03-04 18:35:16 +01:00
|
|
|
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/po
|
2012-02-20 22:23:11 +01:00
|
|
|
$(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS Doxyfile \
|
2012-03-01 03:04:09 +01:00
|
|
|
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \
|
2012-03-04 15:56:54 +01:00
|
|
|
${PROJECT}.desktop version.h.in database-sqlite.c \
|
2011-08-31 16:43:35 +02:00
|
|
|
${PROJECT}-${VERSION}
|
2012-02-21 22:00:19 +01:00
|
|
|
$(QUIET)cp tests/Makefile tests/config.mk tests/*.c \
|
2012-02-20 22:23:11 +01:00
|
|
|
${PROJECT}-${VERSION}/tests
|
2012-03-04 18:35:16 +01:00
|
|
|
$(QUIET)cp po/Makefile po/*.po ${PROJECT}-${VERSION}/po
|
2011-08-31 16:41:07 +02:00
|
|
|
$(QUIET)tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION}
|
|
|
|
$(QUIET)gzip ${PROJECT}-${VERSION}.tar
|
|
|
|
$(QUIET)rm -rf ${PROJECT}-${VERSION}
|
2009-08-11 23:18:50 +02:00
|
|
|
|
2012-02-20 22:23:11 +01:00
|
|
|
doc:
|
2012-02-08 15:19:05 +01:00
|
|
|
$(QUIET)doxygen Doxyfile
|
|
|
|
|
2012-02-08 22:14:56 +01:00
|
|
|
gcov: clean
|
2012-03-07 15:29:35 +01:00
|
|
|
$(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
|
2012-02-08 22:14:56 +01:00
|
|
|
$(QUIET)lcov --directory . --capture --output-file $(PROJECT).info
|
|
|
|
$(QUIET)genhtml --output-directory gcov $(PROJECT).info
|
|
|
|
|
2012-03-07 15:29:35 +01:00
|
|
|
po:
|
|
|
|
$(QUIET)${MAKE} -C po
|
|
|
|
|
|
|
|
install: all ${PROJECT}.pc po
|
2011-08-31 16:41:07 +02:00
|
|
|
$(ECHO) installing executable file
|
|
|
|
$(QUIET)mkdir -p ${DESTDIR}${PREFIX}/bin
|
|
|
|
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
|
2011-10-28 23:38:04 +02:00
|
|
|
$(ECHO) installing header files
|
2011-08-31 16:41:07 +02:00
|
|
|
$(QUIET)mkdir -p ${DESTDIR}${PREFIX}/include/${PROJECT}
|
2012-03-01 03:04:09 +01:00
|
|
|
$(QUIET)install -m 644 zathura.h document.h version.h ${DESTDIR}${PREFIX}/include/${PROJECT}
|
2011-10-28 23:38:04 +02:00
|
|
|
$(ECHO) installing manual pages
|
2011-08-31 16:41:07 +02:00
|
|
|
$(QUIET)mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
2012-03-05 19:58:07 +01:00
|
|
|
$(QUIET)set -e && if which rst2man > /dev/null ; then \
|
2012-02-18 11:37:39 +01:00
|
|
|
mkdir -p ${DESTDIR}${MANPREFIX}/man1 ; \
|
|
|
|
sed "s/VERSION/${VERSION}/g" < ${PROJECT}.1.rst > ${PROJECT}-v.1.rst ; \
|
|
|
|
rst2man ${PROJECT}-v.1.rst > ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1 ; \
|
|
|
|
rm -f ${PROJECT}-v.1.rst ; \
|
2012-02-18 12:22:37 +01:00
|
|
|
mkdir -p ${DESTDIR}${MANPREFIX}/man5 ; \
|
|
|
|
sed "s/VERSION/${VERSION}/g" < ${PROJECT}rc.5.rst > ${PROJECT}rc-v.5.rst ; \
|
|
|
|
rst2man ${PROJECT}rc-v.5.rst > ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5 ; \
|
|
|
|
rm -f ${PROJECT}rc-v.5.rst ; \
|
2012-03-06 14:12:14 +01:00
|
|
|
chmod 644 ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1 ; \
|
|
|
|
chmod 644 ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5 ; \
|
2011-09-29 16:06:39 +02:00
|
|
|
fi
|
|
|
|
$(QUIET)mkdir -p ${DESTDIR}${DESKTOPPREFIX}
|
|
|
|
$(ECHO) installing desktop file
|
|
|
|
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
|
2011-08-31 16:41:07 +02:00
|
|
|
$(ECHO) installing pkgconfig file
|
|
|
|
$(QUIET)mkdir -p ${DESTDIR}${PREFIX}/lib/pkgconfig
|
|
|
|
$(QUIET)cp -f ${PROJECT}.pc ${DESTDIR}${PREFIX}/lib/pkgconfig
|
2012-03-04 18:35:16 +01:00
|
|
|
$(MAKE) -C po install
|
2009-08-11 23:18:50 +02:00
|
|
|
|
|
|
|
uninstall:
|
2011-08-31 16:41:07 +02:00
|
|
|
$(ECHO) removing executable file
|
|
|
|
$(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
|
2011-10-28 23:38:04 +02:00
|
|
|
$(ECHO) removing header files
|
|
|
|
$(QUIET)rm -rf ${DESTDIR}${PREFIX}/include/${PROJECT}
|
|
|
|
$(ECHO) removing manual pages
|
2011-08-31 16:41:07 +02:00
|
|
|
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
|
2011-09-29 16:06:39 +02:00
|
|
|
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
|
|
|
|
$(ECHO) removing desktop file
|
|
|
|
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
|
2011-08-31 16:41:07 +02:00
|
|
|
$(ECHO) removing pkgconfig file
|
2011-10-05 11:28:17 +02:00
|
|
|
$(QUIET)rm -f ${DESTDIR}${PREFIX}/lib/pkgconfig/${PROJECT}.pc
|
2012-03-07 15:32:11 +01:00
|
|
|
$(MAKE) -C po install
|
2011-04-18 11:31:57 +02:00
|
|
|
|
2011-04-19 18:53:41 +02:00
|
|
|
-include $(wildcard .depend/*.dep)
|
2011-04-19 21:54:24 +02:00
|
|
|
|
2012-03-07 15:29:35 +01:00
|
|
|
.PHONY: all options clean doc debug valgrind gdb dist doc install uninstall test \
|
|
|
|
po
|