add verbose build output

This commit is contained in:
Sebastian Ramacher 2011-08-31 16:41:07 +02:00
parent a66f2dd53a
commit 36749e1266
4 changed files with 55 additions and 42 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
*.swp *.swp
.depend .depend
zathura zathura
zathura-debug

View File

@ -1,6 +1,7 @@
# See LICENSE file for license and copyright information # See LICENSE file for license and copyright information
include config.mk include config.mk
include common.mk
PROJECT = zathura PROJECT = zathura
SOURCE = $(shell find . -iname "*.c") SOURCE = $(shell find . -iname "*.c")
@ -17,37 +18,37 @@ options:
@echo "CC = ${CC}" @echo "CC = ${CC}"
%.o: %.c %.o: %.c
@echo CC $< $(ECHO) CC $<
@mkdir -p .depend @mkdir -p .depend
@${CC} -c ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep $(QUIET)${CC} -c ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
%.do: %.c %.do: %.c
@echo CC $< $(ECHO) CC $<
@mkdir -p .depend @mkdir -p .depend
@${CC} -c ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep $(QUIET)${CC} -c ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
${OBJECTS}: config.mk ${OBJECTS}: config.mk
${DOBJECTS}: config.mk ${DOBJECTS}: config.mk
${PROJECT}: ${OBJECTS} ${PROJECT}: ${OBJECTS}
@echo CC -o $@ $(ECHO) CC -o $@
@${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS} $(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
clean: clean:
@rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \ $(QUIET)rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \
${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc ${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc
${PROJECT}-debug: ${DOBJECTS} ${PROJECT}-debug: ${DOBJECTS}
@echo CC -o ${PROJECT}-debug $(ECHO) CC -o $@
@${CC} ${LDFLAGS} -o ${PROJECT}-debug ${DOBJECTS} ${LIBS} $(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
debug: ${PROJECT}-debug debug: ${PROJECT}-debug
${PROJECT}.pc: ${PROJECT}.pc.in config.mk ${PROJECT}.pc: ${PROJECT}.pc.in config.mk
@echo project=${PROJECT} > ${PROJECT}.pc $(QUIET)echo project=${PROJECT} > ${PROJECT}.pc
@echo version=${VERSION} >> ${PROJECT}.pc $(QUIET)echo version=${VERSION} >> ${PROJECT}.pc
@echo includedir=${PREFIX}/include >> ${PROJECT}.pc $(QUIET)echo includedir=${PREFIX}/include >> ${PROJECT}.pc
@cat ${PROJECT}.pc.in >> ${PROJECT}.pc $(QUIET)cat ${PROJECT}.pc.in >> ${PROJECT}.pc
valgrind: debug valgrind: debug
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes \ valgrind --tool=memcheck --leak-check=yes --show-reachable=yes \
@ -57,41 +58,40 @@ gdb: debug
cgdb ${PROJECT}-debug cgdb ${PROJECT}-debug
dist: clean dist: clean
@${MAKE} -p ${PROJECT}-${VERSION} $(QUIET)${MAKE} -p ${PROJECT}-${VERSION}
@cp -R LICENSE Makefile config.mk README \ $(QUIET)cp -R LICENSE Makefile config.mk README \
${PROJECT}.1 ${SOURCE} ${PROJECT}-${VERSION} \ ${PROJECT}.1 ${SOURCE} ${PROJECT}-${VERSION} \
${PROJECT}.pc.in ${PROJECT}.pc.in
@tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION} $(QUIET)tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION}
@gzip ${PROJECT}-${VERSION}.tar $(QUIET)gzip ${PROJECT}-${VERSION}.tar
@rm -rf ${PROJECT}-${VERSION} $(QUIET)rm -rf ${PROJECT}-${VERSION}
install: all ${PROJECT}.pc install: all ${PROJECT}.pc
@echo installing executable file $(ECHO) installing executable file
@mkdir -p ${DESTDIR}${PREFIX}/bin $(QUIET)mkdir -p ${DESTDIR}${PREFIX}/bin
@cp -f ${PROJECT} ${DESTDIR}${PREFIX}/bin $(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
@chmod 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin/${PROJECT} $(ECHO) installing header file
@echo installing header file $(QUIET)mkdir -p ${DESTDIR}${PREFIX}/include/${PROJECT}
@mkdir -p ${DESTDIR}${PREFIX}/include/${PROJECT} $(QUIET)cp -f document.h ${DESTDIR}${PREFIX}/include/${PROJECT}
@cp -f document.h ${DESTDIR}${PREFIX}/include/${PROJECT} $(QUIET)cp -f zathura.h ${DESTDIR}${PREFIX}/include/${PROJECT}
@cp -f zathura.h ${DESTDIR}${PREFIX}/include/${PROJECT} $(ECHO) installing manual page
@echo installing manual page $(QUIET)mkdir -p ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1 $(QUIET)sed "s/VERSION/${VERSION}/g" < ${PROJECT}.1 > ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
@sed "s/VERSION/${VERSION}/g" < ${PROJECT}.1 > ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1 $(QUIET)chmod 644 ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1 $(ECHO) installing pkgconfig file
@echo installing pkgconfig file $(QUIET)mkdir -p ${DESTDIR}${PREFIX}/lib/pkgconfig
@mkdir -p ${DESTDIR}${PREFIX}/lib/pkgconfig $(QUIET)cp -f ${PROJECT}.pc ${DESTDIR}${PREFIX}/lib/pkgconfig
@cp -f ${PROJECT}.pc ${DESTDIR}${PREFIX}/lib/pkgconfig
uninstall: uninstall:
@echo removing executable file $(ECHO) removing executable file
@rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT} $(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
@echo removing header file $(ECHO) removing header file
@rm -f ${DESTDIR}${PREFIX}/include/${PROJECT}/document.h $(QUIET)rm -f ${DESTDIR}${PREFIX}/include/${PROJECT}/document.h
@rm -f ${DESTDIR}${PREFIX}/include/${PROJECT}/zathura.h $(QUIET)rm -f ${DESTDIR}${PREFIX}/include/${PROJECT}/zathura.h
@echo removing manual page $(ECHO) removing manual page
@rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1 $(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
@echo removing pkgconfig file $(ECHO) removing pkgconfig file
@rm -f ${DESTDIR}${PREFIX}/lib/pkgconfig $(QUIET)rm -f ${DESTDIR}${PREFIX}/lib/pkgconfig
-include $(wildcard .depend/*.dep) -include $(wildcard .depend/*.dep)

9
common.mk Normal file
View File

@ -0,0 +1,9 @@
# See LICENSE file for license and copyright information
ifeq "$(VERBOSE)" "0"
ECHO=@echo
QUIET=@
else
ECHO=@\#
QUIET=
endif

View File

@ -31,3 +31,6 @@ CC ?= gcc
# strip # strip
SFLAGS ?= -s SFLAGS ?= -s
# set to something != 0 if you want verbose build output
VERBOSE ?= 0