zathura/Makefile

103 lines
3 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
PROJECT = zathura
SOURCE = $(shell find . -iname "*.c")
2010-11-17 22:51:15 +01:00
OBJECTS = $(patsubst %.c, %.o, $(SOURCE))
DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
ifneq "$(NEEDS_DL)" "0"
LIBS += -ldl
endif
all: options ${PROJECT}
options:
@echo ${PROJECT} build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LIBS = ${LIBS}"
@echo "DFLAGS = ${DFLAGS}"
@echo "CC = ${CC}"
%.o: %.c
2011-08-31 16:41:07 +02:00
$(ECHO) CC $<
2011-04-19 18:53:41 +02:00
@mkdir -p .depend
2011-08-31 16:41:07 +02:00
$(QUIET)${CC} -c ${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-08-31 16:41:07 +02:00
$(QUIET)${CC} -c ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
2010-11-10 19:18:01 +01:00
${OBJECTS}: config.mk
${DOBJECTS}: config.mk
${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 \
${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc
${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
$(QUIET)echo includedir=${PREFIX}/include >> ${PROJECT}.pc
$(QUIET)cat ${PROJECT}.pc.in >> ${PROJECT}.pc
valgrind: debug
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes \
./${PROJECT}-debug
gdb: debug
cgdb ${PROJECT}-debug
dist: clean
2011-08-31 16:43:35 +02:00
$(QUIET)mkdir -p ${PROJECT}-${VERSION}
2011-08-31 16:41:07 +02:00
$(QUIET)cp -R LICENSE Makefile config.mk README \
2011-08-31 16:43:35 +02:00
${PROJECT}.1 ${SOURCE} ${PROJECT}.pc.in \
${PROJECT}-${VERSION}
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
install: all ${PROJECT}.pc
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
$(ECHO) installing header file
$(QUIET)mkdir -p ${DESTDIR}${PREFIX}/include/${PROJECT}
$(QUIET)cp -f document.h ${DESTDIR}${PREFIX}/include/${PROJECT}
$(QUIET)cp -f zathura.h ${DESTDIR}${PREFIX}/include/${PROJECT}
$(ECHO) installing manual page
$(QUIET)mkdir -p ${DESTDIR}${MANPREFIX}/man1
$(QUIET)sed "s/VERSION/${VERSION}/g" < ${PROJECT}.1 > ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(QUIET)chmod 644 ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(ECHO) installing pkgconfig file
$(QUIET)mkdir -p ${DESTDIR}${PREFIX}/lib/pkgconfig
$(QUIET)cp -f ${PROJECT}.pc ${DESTDIR}${PREFIX}/lib/pkgconfig
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}
$(ECHO) removing header file
$(QUIET)rm -f ${DESTDIR}${PREFIX}/include/${PROJECT}/document.h
$(QUIET)rm -f ${DESTDIR}${PREFIX}/include/${PROJECT}/zathura.h
$(ECHO) removing manual page
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
$(ECHO) removing pkgconfig file
$(QUIET)rm -f ${DESTDIR}${PREFIX}/lib/pkgconfig
2011-04-18 11:31:57 +02:00
2011-04-19 18:53:41 +02:00
-include $(wildcard .depend/*.dep)
2011-04-18 11:31:57 +02:00
.PHONY: all options clean debug valgrind gdb dist install uninstall