zathura/Makefile

245 lines
7.8 KiB
Makefile
Raw Normal View History

# See LICENSE file for license and copyright information
2009-08-11 23:18:50 +02:00
include config.mk
2011-08-31 16:41:07 +02:00
include common.mk
2009-08-11 23:18:50 +02:00
2012-03-18 19:38:17 +01:00
PROJECT = zathura
OSOURCE = $(filter-out dbus-interface-definitions.c, $(wildcard *.c))
2012-03-18 19:38:17 +01:00
HEADER = $(wildcard *.h)
2012-05-28 12:43:22 +02:00
HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h
ifneq (${WITH_SQLITE},0)
2011-10-10 23:46:50 +02:00
INCS += $(SQLITE_INC)
LIBS += $(SQLITE_LIB)
SOURCE = $(OSOURCE)
CPPFLAGS += -DWITH_SQLITE
else
SOURCE = $(filter-out database-sqlite.c,$(OSOURCE))
2011-10-10 23:46:50 +02:00
endif
ifneq ($(WITH_MAGIC),0)
INCS += $(MAGIC_INC)
LIBS += $(MAGIC_LIB)
CPPFLAGS += -DWITH_MAGIC
endif
2012-03-07 16:15:06 +01:00
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
OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o
DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS))
all: options ${PROJECT} po build-manpages
# pkg-config based version checks
2014-01-01 16:50:19 +01:00
.version-checks/%: config.mk
$(QUIET)test $($(*)_VERSION_CHECK) -eq 0 || \
pkg-config --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \
echo "The minium required version of $(*) is $($(*)_MIN_VERSION)" && \
false \
)
@mkdir -p .version-checks
$(QUIET)touch $@
2012-03-16 13:32:09 +01:00
options:
@echo ${PROJECT} build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LIBS = ${LIBS}"
@echo "DFLAGS = ${DFLAGS}"
@echo "CC = ${CC}"
version.h: 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
dbus-interface-definitions.c: data/org.pwmt.zathura.xml
$(QUIET)echo '#include "dbus-interface-definitions.h"' > dbus-interface-definitions.c.tmp
$(QUIET)echo 'const char* DBUS_INTERFACE_XML =' >> dbus-interface-definitions.c.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/org.pwmt.zathura.xml >> dbus-interface-definitions.c.tmp
$(QUIET)echo ';' >> dbus-interface-definitions.c.tmp
$(QUIET)mv dbus-interface-definitions.c.tmp dbus-interface-definitions.c
%.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
%.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
${OBJECTS} ${DOBJECTS}: config.mk version.h \
.version-checks/GIRARA .version-checks/GLIB .version-checks/GTK
${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:
$(QUIET)rm -rf ${PROJECT} \
${OBJECTS} \
${PROJECT}-${VERSION}.tar.gz \
${DOBJECTS} \
${PROJECT}-debug \
.depend \
${PROJECT}.pc \
doc \
version.h \
version.h.tmp \
dbus-interface-definitions.c \
dbus-interface-definitions.c.tmp \
*gcda *gcno $(PROJECT).info gcov *.tmp \
.version-checks
ifneq "$(wildcard ${RSTTOMAN})" ""
$(QUIET)rm -f zathura.1 zathurarc.5
endif
$(QUIET)$(MAKE) -C tests clean
$(QUIET)$(MAKE) -C po clean
${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
debug: ${PROJECT}-debug
2009-08-11 23:18:50 +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-03-21 11:47:29 +01:00
$(QUIET)echo apiversion=${ZATHURA_API_VERSION} >> ${PROJECT}.pc
2012-03-21 16:23:29 +01:00
$(QUIET)echo abiversion=${ZATHURA_ABI_VERSION} >> ${PROJECT}.pc
$(QUIET)echo includedir=${INCLUDEDIR} >> ${PROJECT}.pc
2012-02-14 16:30:15 +01:00
$(QUIET)echo plugindir=${PLUGINDIR} >> ${PROJECT}.pc
$(QUIET)echo GTK_VERSION=${ZATHURA_GTK_VERSION} >> ${PROJECT}.pc
2011-08-31 16:41:07 +02:00
$(QUIET)cat ${PROJECT}.pc.in >> ${PROJECT}.pc
valgrind: debug
2012-03-07 16:15:06 +01:00
$(QUIET)G_SLICE=always-malloc G_DEBUG=gc-friendly ${VALGRIND} ${VALGRIND_ARGUMENTS} \
./${PROJECT}-debug
gdb: debug
2012-03-06 21:09:58 +01:00
$(QUIET)cgdb ${PROJECT}-debug
test: ${OBJECTS}
$(QUIET)make -C tests run
2012-01-28 19:54:10 +01:00
dist: clean build-manpages
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 \
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \
${PROJECT}.desktop version.h.in \
${PROJECT}.1 ${PROJECT}rc.5 \
2011-08-31 16:43:35 +02:00
${PROJECT}-${VERSION}
$(QUIET)cp -r data ${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
$(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
po:
$(QUIET)${MAKE} -C po
update-po:
$(QUIET)${MAKE} -C po update-po
ifneq "$(wildcard ${RSTTOMAN})" ""
%.1 %.5: config.mk
$(QUIET)sed "s/VERSION/${VERSION}/g" < $@.rst > $@.tmp
$(QUIET)${RSTTOMAN} $@.tmp > $@.out.tmp
$(QUIET)mv $@.out.tmp $@
$(QUIET)rm $@.tmp
${PROJECT}.1: ${PROJECT}.1.rst
${PROJECT}rc.5: ${PROJECT}rc.5.rst
build-manpages: ${PROJECT}.1 ${PROJECT}rc.5
else
build-manpages:
endif
install-manpages: build-manpages
$(ECHO) installing manual pages
2012-04-17 21:51:21 +02:00
$(QUIET)mkdir -m 755 -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
ifneq "$(wildcard ${PROJECT}.1)" ""
$(QUIET)install -m 644 ${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
endif
ifneq "$(wildcard ${PROJECT}rc.5)" ""
$(QUIET)install -m 644 ${PROJECT}rc.5 ${DESTDIR}${MANPREFIX}/man5
endif
install-headers: ${PROJECT}.pc
$(ECHO) installing header files
2012-04-17 21:51:21 +02:00
$(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/${PROJECT}
2012-03-18 19:38:17 +01:00
$(QUIET)install -m 644 ${HEADERINST} ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(ECHO) installing pkgconfig file
2012-04-17 21:51:21 +02:00
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
install-dbus:
$(ECHO) installing D-Bus interface definitions
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
$(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR)
install-vimftplugin:
$(ECHO) installing Vim filetype plugin
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(VIMFTPLUGINDIR)
$(QUIET)install -m 644 data/tex_zathurasynctex.vim $(DESTDIR)$(VIMFTPLUGINDIR)
install: all install-headers install-manpages install-dbus
2011-08-31 16:41:07 +02:00
$(ECHO) installing executable file
2012-04-17 21:51:21 +02:00
$(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin
2011-08-31 16:41:07 +02:00
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
2012-04-17 21:51:21 +02:00
$(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX}
$(ECHO) installing desktop file
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
2012-03-04 18:35:16 +01:00
$(MAKE) -C po install
2009-08-11 23:18:50 +02:00
uninstall-headers:
$(ECHO) removing header files
$(QUIET)rm -rf ${DESTDIR}${INCLUDEDIR}/${PROJECT}
$(ECHO) removing pkgconfig file
$(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc
uninstall: uninstall-headers
2011-08-31 16:41:07 +02:00
$(ECHO) removing executable file
$(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
$(ECHO) removing manual pages
2011-08-31 16:41:07 +02:00
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
$(ECHO) removing desktop file
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
$(MAKE) -C po uninstall
2011-04-18 11:31:57 +02:00
2011-04-19 18:53:41 +02:00
-include $(wildcard .depend/*.dep)
.PHONY: all options clean doc debug valgrind gdb dist doc install uninstall test \
po install-headers uninstall-headers update-po install-manpages build-manpages