diff --git a/Makefile b/Makefile index 5374527d..94c9c63e 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ include i3-nagbar/i3-nagbar.mk include i3bar/i3bar.mk include i3-dump-log/i3-dump-log.mk include docs/docs.mk +include man/man.mk real-all: $(ALL_TARGETS) @@ -35,7 +36,6 @@ dist: distclean mkdir i3-${VERSION}/docs # Pre-generate documentation $(MAKE) docs - $(MAKE) -C i3bar/doc # Cleanup τεχ output files find docs -regex ".*\.\(aux\|out\|log\|toc\|bm\|dvi\|log\)" -exec rm '{}' \; find docs -maxdepth 1 -type f ! \( -name "*.xcf" -or -name "*.svg" \) -exec cp '{}' i3-${VERSION}/docs \; @@ -44,15 +44,13 @@ dist: distclean find i3-input -maxdepth 1 -type f \( -name "*.c" -or -name "*.h" -or -name "Makefile" \) -exec cp '{}' i3-${VERSION}/i3-input \; sed -e 's/^GIT_VERSION:=\(.*\)/GIT_VERSION:=$(shell /bin/echo '${GIT_VERSION}' | sed 's/\\/\\\\/g')/g;s/^VERSION:=\(.*\)/VERSION:=${VERSION}/g' common.mk > i3-${VERSION}/common.mk # Pre-generate a manpage to allow distributors to skip this step and save some dependencies - $(MAKE) -C man + $(MAKE) mans cp man/*.1 i3-${VERSION}/man/ - cp i3bar/doc/*.1 i3-${VERSION}/i3bar/doc/ tar cfj i3-${VERSION}.tar.bz2 i3-${VERSION} rm -rf i3-${VERSION} clean: $(CLEAN_TARGETS) (which lcov >/dev/null 2>&1 && lcov -d . --zerocounters) || true - $(MAKE) -C man clean distclean: clean $(DISTCLEAN_TARGETS) diff --git a/common.mk b/common.mk index 2f550cff..941da7d2 100644 --- a/common.mk +++ b/common.mk @@ -147,6 +147,7 @@ ifeq ($(V),0) # echo-ing vars V_ASCIIDOC = echo ASCIIDOC $@; +V_A2X = echo A2X $@; endif # Always remake the following targets diff --git a/i3bar/doc/Makefile b/i3bar/doc/Makefile deleted file mode 100644 index 69566750..00000000 --- a/i3bar/doc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: i3bar.1 - -i3bar.1: i3bar.man - echo "A2X i3bar" - a2x --no-xmllint -f manpage i3bar.man -clean: - rm -f i3bar.xml i3bar.1 i3bar.html - -distclean: clean diff --git a/man/Makefile b/man/Makefile index ff08dc57..e4cee0cc 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,15 +1,7 @@ -A2M:=a2x -f manpage --asciidoc-opts="-f asciidoc.conf" - -all: i3.1 i3-msg.1 i3-input.1 i3-nagbar.1 i3-config-wizard.1 i3-migrate-config-to-v4.1 i3-sensible-editor.1 i3-sensible-pager.1 i3-sensible-terminal.1 i3-dump-log.1 - -%.1: %.man asciidoc.conf - ${A2M} $< +all: + $(MAKE) -C .. mans clean: - for file in $$(echo i3 i3-msg i3-input i3-nagbar i3-wsbar i3-config-wizard i3-migrate-config-to-v4 i3-sensible-editor i3-sensible-pager i3-sensible-terminal i3-dump-log); \ - do \ - rm -f $${file}.1 $${file}.html $${file}.xml; \ - done + $(MAKE) -C .. clean-mans -distclean: clean - rm -f *.1 +.PHONY: all clean diff --git a/i3bar/doc/i3bar.man b/man/i3bar.man similarity index 100% rename from i3bar/doc/i3bar.man rename to man/i3bar.man diff --git a/man/man.mk b/man/man.mk new file mode 100644 index 00000000..f999dc78 --- /dev/null +++ b/man/man.mk @@ -0,0 +1,32 @@ +DISTCLEAN_TARGETS += clean-mans + +A2X = a2x + +A2X_MAN_CALL = $(V_A2X)$(A2X) -f manpage --asciidoc-opts="-f man/asciidoc.conf" $(A2X_FLAGS) $< + +MANS_1 = \ + man/i3.1 \ + man/i3bar.1 \ + man/i3-msg.1 \ + man/i3-input.1 \ + man/i3-nagbar.1 \ + man/i3-config-wizard.1 \ + man/i3-migrate-config-to-v4.1 \ + man/i3-sensible-editor.1 \ + man/i3-sensible-pager.1 \ + man/i3-sensible-terminal.1 \ + man/i3-dump-log.1 + +MANS = \ + $(MANS_1) + +mans: $(MANS) + +$(MANS_1): %.1: %.man man/asciidoc.conf + $(A2X_MAN_CALL) + +clean-mans: + for file in $(notdir $(MANS)); \ + do \ + rm -f man/$${file} man/$${file%.*}.html man/$${file%.*}.xml; \ + done