mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-16 01:15:51 +01:00
Enable colors in Makefile
This commit is contained in:
parent
89113e3d93
commit
f148a9aed7
4 changed files with 52 additions and 16 deletions
36
Makefile
36
Makefile
|
@ -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 colors.mk
|
||||||
include common.mk
|
include common.mk
|
||||||
|
|
||||||
PROJECT = zathura
|
PROJECT = zathura
|
||||||
|
@ -75,12 +76,12 @@ dbus-interface-definitions.c: data/org.pwmt.zathura.xml
|
||||||
$(QUIET)mv dbus-interface-definitions.c.tmp dbus-interface-definitions.c
|
$(QUIET)mv dbus-interface-definitions.c.tmp dbus-interface-definitions.c
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(ECHO) CC $<
|
$(call colorecho,CC,$<)
|
||||||
@mkdir -p .depend
|
$(QUIET) mkdir -p .depend
|
||||||
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
||||||
|
|
||||||
%.do: %.c
|
%.do: %.c
|
||||||
$(ECHO) CC $<
|
$(call colorecho,CC,$<)
|
||||||
@mkdir -p .depend
|
@mkdir -p .depend
|
||||||
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ ${OBJECTS} ${DOBJECTS}: config.mk version.h \
|
||||||
.version-checks/GIRARA .version-checks/GLIB .version-checks/GTK
|
.version-checks/GIRARA .version-checks/GLIB .version-checks/GTK
|
||||||
|
|
||||||
${PROJECT}: ${OBJECTS}
|
${PROJECT}: ${OBJECTS}
|
||||||
$(ECHO) CC -o $@
|
$(call colorecho,CC,$@)
|
||||||
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
|
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -113,7 +114,7 @@ endif
|
||||||
$(QUIET)$(MAKE) -C doc clean
|
$(QUIET)$(MAKE) -C doc clean
|
||||||
|
|
||||||
${PROJECT}-debug: ${DOBJECTS}
|
${PROJECT}-debug: ${DOBJECTS}
|
||||||
$(ECHO) CC -o $@
|
$(call colorecho,CC,$@)
|
||||||
$(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
|
$(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
|
||||||
|
|
||||||
debug: ${PROJECT}-debug
|
debug: ${PROJECT}-debug
|
||||||
|
@ -143,6 +144,7 @@ dist: clean build-manpages
|
||||||
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/tests
|
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/tests
|
||||||
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/po
|
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/po
|
||||||
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/doc
|
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/doc
|
||||||
|
|
||||||
$(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS \
|
$(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS \
|
||||||
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \
|
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \
|
||||||
${PROJECT}.desktop version.h.in \
|
${PROJECT}.desktop version.h.in \
|
||||||
|
@ -188,7 +190,7 @@ build-manpages:
|
||||||
$(QUIET)${MAKE} -C doc man
|
$(QUIET)${MAKE} -C doc man
|
||||||
|
|
||||||
install-manpages: build-manpages
|
install-manpages: build-manpages
|
||||||
$(ECHO) installing manual pages
|
$(call colorecho,INSTALL,"man pages")
|
||||||
$(QUIET)mkdir -m 755 -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
|
$(QUIET)mkdir -m 755 -p ${DESTDIR}${MANPREFIX}/man1 ${DESTDIR}${MANPREFIX}/man5
|
||||||
ifneq "$(wildcard ./doc/_build/man/${PROJECT}.1)" ""
|
ifneq "$(wildcard ./doc/_build/man/${PROJECT}.1)" ""
|
||||||
$(QUIET)install -m 644 ./doc/_build/man/${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
|
$(QUIET)install -m 644 ./doc/_build/man/${PROJECT}.1 ${DESTDIR}${MANPREFIX}/man1
|
||||||
|
@ -198,42 +200,44 @@ ifneq "$(wildcard ./doc/_build/man/${PROJECT}rc.5)" ""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install-headers: ${PROJECT}.pc
|
install-headers: ${PROJECT}.pc
|
||||||
$(ECHO) installing header files
|
$(call colorecho,INSTALL,"header files")
|
||||||
$(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/${PROJECT}
|
$(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/${PROJECT}
|
||||||
$(QUIET)install -m 644 ${HEADERINST} ${DESTDIR}${INCLUDEDIR}/${PROJECT}
|
$(QUIET)install -m 644 ${HEADERINST} ${DESTDIR}${INCLUDEDIR}/${PROJECT}
|
||||||
$(ECHO) installing pkgconfig file
|
|
||||||
|
$(call colorecho,INSTALL,"pkgconfig file")
|
||||||
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
|
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
|
||||||
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
|
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
|
||||||
|
|
||||||
install-dbus:
|
install-dbus:
|
||||||
$(ECHO) installing D-Bus interface definitions
|
$(call colorecho,INSTALL,"D-Bus interface definitions")
|
||||||
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
|
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
|
||||||
$(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR)
|
$(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR)
|
||||||
|
|
||||||
install: all install-headers install-manpages install-dbus
|
install: all install-headers install-manpages install-dbus
|
||||||
$(ECHO) installing executable file
|
$(call colorecho,INSTALL,"executeable file")
|
||||||
$(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin
|
$(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin
|
||||||
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
|
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
|
||||||
$(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX}
|
$(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX}
|
||||||
$(ECHO) installing desktop file
|
$(call colorecho,INSTALL,"desktop file")
|
||||||
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
|
$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}
|
||||||
$(MAKE) -C po install
|
$(MAKE) -C po install
|
||||||
|
|
||||||
uninstall-headers:
|
uninstall-headers:
|
||||||
$(ECHO) removing header files
|
$(call colorecho,UNINSTALL,"header files")
|
||||||
$(QUIET)rm -rf ${DESTDIR}${INCLUDEDIR}/${PROJECT}
|
$(QUIET)rm -rf ${DESTDIR}${INCLUDEDIR}/${PROJECT}
|
||||||
$(ECHO) removing pkgconfig file
|
$(call colorecho,UNINSTALL,"pkgconfig file")
|
||||||
$(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc
|
$(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc
|
||||||
|
|
||||||
uninstall: uninstall-headers
|
uninstall: uninstall-headers
|
||||||
$(ECHO) removing executable file
|
$(ECHO) removing executable file
|
||||||
|
$(call colorecho,UNINSTALL,"executeable")
|
||||||
$(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
|
$(QUIET)rm -f ${DESTDIR}${PREFIX}/bin/${PROJECT}
|
||||||
$(ECHO) removing manual pages
|
$(call colorecho,UNINSTALL,"man pages")
|
||||||
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
|
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man1/${PROJECT}.1
|
||||||
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
|
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
|
||||||
$(ECHO) removing desktop file
|
$(call colorecho,UNINSTALL,"desktop file")
|
||||||
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
|
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
|
||||||
$(ECHO) removing D-Bus interface definitions
|
$(call colorecho,UNINSTALL,"D-Bus interface definitions")
|
||||||
$(QUIET)rm -f $(DESTDIR)$(DBUSINTERFACEDIR)/org.pwmt.zathura.xml
|
$(QUIET)rm -f $(DESTDIR)$(DBUSINTERFACEDIR)/org.pwmt.zathura.xml
|
||||||
$(MAKE) -C po uninstall
|
$(MAKE) -C po uninstall
|
||||||
|
|
||||||
|
|
25
colors.mk
Normal file
25
colors.mk
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# See LICENSE file for license and copyright information
|
||||||
|
#
|
||||||
|
|
||||||
|
TPUT ?= /usr/bin/tput
|
||||||
|
TPUT_AVAILABLE ?= $(shell ${TPUT} -V 2>/dev/null)
|
||||||
|
|
||||||
|
ifdef TPUT_AVAILABLE
|
||||||
|
ifeq ($(COLOR),1)
|
||||||
|
COLOR_NORMAL = `$(TPUT) sgr0`
|
||||||
|
COLOR_ACTION = `$(TPUT) bold``$(TPUT) setaf 3`
|
||||||
|
COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2`
|
||||||
|
COLOR_BRACKET = `$(TPUT) setaf 4`
|
||||||
|
define colorecho
|
||||||
|
@echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL)
|
||||||
|
endef
|
||||||
|
else
|
||||||
|
define colorecho
|
||||||
|
@echo " [$1]" $2
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
define colorecho
|
||||||
|
@echo " [$1]" $2
|
||||||
|
endef
|
||||||
|
endif
|
|
@ -104,3 +104,5 @@ VALGRIND_SUPPRESSION_FILE = zathura.suppression
|
||||||
# set to something != 0 if you want verbose build output
|
# set to something != 0 if you want verbose build output
|
||||||
VERBOSE ?= 0
|
VERBOSE ?= 0
|
||||||
|
|
||||||
|
# colors
|
||||||
|
COLOR ?= 1
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#
|
#
|
||||||
include ../config.mk
|
include ../config.mk
|
||||||
include ../common.mk
|
include ../common.mk
|
||||||
|
include ../colors.mk
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
ifeq ($(shell which $(SPHINX_BIN) >/dev/null 2>&1; echo $$?), 1)
|
ifeq ($(shell which $(SPHINX_BIN) >/dev/null 2>&1; echo $$?), 1)
|
||||||
|
@ -14,15 +15,19 @@ init:
|
||||||
$(QUIET)mkdir -p $(SPHINX_BUILDDIR)/
|
$(QUIET)mkdir -p $(SPHINX_BUILDDIR)/
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
$(call colorecho,RM,doc/$(SPHINX_BUILDDIR))
|
||||||
$(QUIET)rm -rf $(SPHINX_BUILDDIR)/
|
$(QUIET)rm -rf $(SPHINX_BUILDDIR)/
|
||||||
|
|
||||||
html: doxygen
|
html: doxygen
|
||||||
|
$(call colorecho,DOC,"Build HTML documentation")
|
||||||
$(QUIET)$(SPHINX_BIN) -b html $(SPHINX_OPTS) $(SPHINX_BUILDDIR)/html
|
$(QUIET)$(SPHINX_BIN) -b html $(SPHINX_OPTS) $(SPHINX_BUILDDIR)/html
|
||||||
|
|
||||||
man: doxygen
|
man: doxygen
|
||||||
|
$(call colorecho,DOC,"Build man pages")
|
||||||
$(QUIET)$(SPHINX_BIN) -b man $(SPHINX_OPTS) $(SPHINX_BUILDDIR)/man
|
$(QUIET)$(SPHINX_BIN) -b man $(SPHINX_OPTS) $(SPHINX_BUILDDIR)/man
|
||||||
|
|
||||||
doxygen: init
|
doxygen: init
|
||||||
|
$(call colorecho,DOC,"Run doxygen")
|
||||||
$(QUIET)$(DOXYGEN_BIN) Doxyfile
|
$(QUIET)$(DOXYGEN_BIN) Doxyfile
|
||||||
|
|
||||||
.PHONY: clean html man
|
.PHONY: clean html man
|
||||||
|
|
Loading…
Reference in a new issue