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
|
2009-08-11 23:18:50 +02:00
|
|
|
|
2009-12-26 14:30:50 +01:00
|
|
|
PROJECT = zathura
|
2011-03-05 22:11:08 +01:00
|
|
|
SOURCE = $(shell find . -iname "*.c" -a ! -iwholename "*./ft*")
|
2010-11-17 22:51:15 +01:00
|
|
|
OBJECTS = $(patsubst %.c, %.o, $(SOURCE))
|
|
|
|
DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
all: options ${PROJECT}
|
2011-04-18 11:31:57 +02:00
|
|
|
${MAKE} -C ft
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
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}"
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
@echo CC $<
|
2011-04-19 18:53:41 +02:00
|
|
|
@mkdir -p .depend
|
|
|
|
@${CC} -c ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
%.do: %.c
|
|
|
|
@echo CC $<
|
2011-04-19 18:53:41 +02:00
|
|
|
@mkdir -p .depend
|
|
|
|
@${CC} -c ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
2009-12-26 14:30:50 +01:00
|
|
|
|
2010-11-10 19:18:01 +01:00
|
|
|
${OBJECTS}: config.mk
|
|
|
|
${DOBJECTS}: config.mk
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
${PROJECT}: ${OBJECTS}
|
|
|
|
@echo CC -o $@
|
2010-06-22 01:14:13 +02:00
|
|
|
@${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
|
2009-08-11 23:18:50 +02:00
|
|
|
|
|
|
|
clean:
|
2009-12-26 14:30:50 +01:00
|
|
|
@rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \
|
2011-04-19 18:53:41 +02:00
|
|
|
${DOBJECTS} ${PROJECT}-debug .depend
|
2011-04-18 11:31:57 +02:00
|
|
|
@${MAKE} -C ft clean
|
2009-12-26 14:30:50 +01:00
|
|
|
|
|
|
|
${PROJECT}-debug: ${DOBJECTS}
|
|
|
|
@echo CC -o ${PROJECT}-debug
|
2010-03-12 18:23:41 +01:00
|
|
|
@${CC} ${LDFLAGS} -o ${PROJECT}-debug ${DOBJECTS} ${LIBS}
|
2009-08-11 23:18:50 +02:00
|
|
|
|
2009-12-26 14:30:50 +01:00
|
|
|
debug: ${PROJECT}-debug
|
2011-04-18 11:31:57 +02:00
|
|
|
@${MAKE} -C ft debug
|
2009-08-11 23:18:50 +02:00
|
|
|
|
2009-09-12 11:19:51 +02:00
|
|
|
valgrind: debug
|
2009-12-26 14:30:50 +01:00
|
|
|
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes \
|
|
|
|
./${PROJECT}-debug
|
|
|
|
|
|
|
|
gdb: debug
|
|
|
|
cgdb ${PROJECT}-debug
|
|
|
|
|
|
|
|
dist: clean
|
2011-04-18 11:31:57 +02:00
|
|
|
@${MAKE} -p ${PROJECT}-${VERSION}
|
2010-11-10 19:18:01 +01:00
|
|
|
@cp -R LICENSE Makefile config.mk README \
|
2009-12-26 14:30:50 +01:00
|
|
|
${PROJECT}.1 ${SOURCE} ${PROJECT}-${VERSION}
|
|
|
|
@tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION}
|
|
|
|
@gzip ${PROJECT}-${VERSION}.tar
|
|
|
|
@rm -rf ${PROJECT}-${VERSION}
|
2009-08-11 23:18:50 +02:00
|
|
|
|
|
|
|
install: all
|
2010-08-18 08:54:52 +02:00
|
|
|
@echo installing executable file
|
2010-03-12 18:23:41 +01:00
|
|
|
@mkdir -p ${DESTDIR}${PREFIX}/bin
|
|
|
|
@cp -f ${PROJECT} ${DESTDIR}${PREFIX}/bin
|
|
|
|
@chmod 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin/${PROJECT}
|
2009-12-26 14:30:50 +01:00
|
|
|
@echo installing manual page
|
2010-03-12 18:23:41 +01:00
|
|
|
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
|
|
|
@sed "s/VERSION/${VERSION}/g" < ${PROJECT}.1 > ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
|
|
|
|
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
|
2011-04-18 11:31:57 +02:00
|
|
|
@${MAKE} -C ft install
|
2009-08-11 23:18:50 +02:00
|
|
|
|
|
|
|
uninstall:
|
2010-08-18 08:54:52 +02:00
|
|
|
@echo removing executable file
|
2011-03-19 15:24:50 +01:00
|
|
|
@rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
|
2009-12-26 14:30:50 +01:00
|
|
|
@echo removing manual page
|
2010-04-14 23:56:17 +02:00
|
|
|
@rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
|
2011-04-18 11:31:57 +02:00
|
|
|
@${MAKE} -C ft uninstall
|
|
|
|
|
2011-04-19 18:53:41 +02:00
|
|
|
-include $(wildcard .depend/*.dep)
|
2011-04-19 21:54:24 +02:00
|
|
|
|
2011-04-18 11:31:57 +02:00
|
|
|
.PHONY: all options clean debug valgrind gdb dist install uninstall
|