From 30307754144066c7aab62821574a2058d0886ef6 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 6 Feb 2016 00:01:42 +0000 Subject: [PATCH] Cleanup doc manpages generation --- doc/manpages/{commands => commands.asciidoc} | 0 doc/manpages/{execeval => execeval.asciidoc} | 0 .../{expansions => expansions.asciidoc} | 0 doc/manpages/{faces => faces.asciidoc} | 0 .../{highlighters => highlighters.asciidoc} | 0 doc/manpages/{hooks => hooks.asciidoc} | 0 doc/manpages/{options => options.asciidoc} | 0 .../{registers => registers.asciidoc} | 0 .../{shortcuts => shortcuts.asciidoc} | 0 src/Makefile | 27 ++++++------------- 10 files changed, 8 insertions(+), 19 deletions(-) rename doc/manpages/{commands => commands.asciidoc} (100%) rename doc/manpages/{execeval => execeval.asciidoc} (100%) rename doc/manpages/{expansions => expansions.asciidoc} (100%) rename doc/manpages/{faces => faces.asciidoc} (100%) rename doc/manpages/{highlighters => highlighters.asciidoc} (100%) rename doc/manpages/{hooks => hooks.asciidoc} (100%) rename doc/manpages/{options => options.asciidoc} (100%) rename doc/manpages/{registers => registers.asciidoc} (100%) rename doc/manpages/{shortcuts => shortcuts.asciidoc} (100%) diff --git a/doc/manpages/commands b/doc/manpages/commands.asciidoc similarity index 100% rename from doc/manpages/commands rename to doc/manpages/commands.asciidoc diff --git a/doc/manpages/execeval b/doc/manpages/execeval.asciidoc similarity index 100% rename from doc/manpages/execeval rename to doc/manpages/execeval.asciidoc diff --git a/doc/manpages/expansions b/doc/manpages/expansions.asciidoc similarity index 100% rename from doc/manpages/expansions rename to doc/manpages/expansions.asciidoc diff --git a/doc/manpages/faces b/doc/manpages/faces.asciidoc similarity index 100% rename from doc/manpages/faces rename to doc/manpages/faces.asciidoc diff --git a/doc/manpages/highlighters b/doc/manpages/highlighters.asciidoc similarity index 100% rename from doc/manpages/highlighters rename to doc/manpages/highlighters.asciidoc diff --git a/doc/manpages/hooks b/doc/manpages/hooks.asciidoc similarity index 100% rename from doc/manpages/hooks rename to doc/manpages/hooks.asciidoc diff --git a/doc/manpages/options b/doc/manpages/options.asciidoc similarity index 100% rename from doc/manpages/options rename to doc/manpages/options.asciidoc diff --git a/doc/manpages/registers b/doc/manpages/registers.asciidoc similarity index 100% rename from doc/manpages/registers rename to doc/manpages/registers.asciidoc diff --git a/doc/manpages/shortcuts b/doc/manpages/shortcuts.asciidoc similarity index 100% rename from doc/manpages/shortcuts rename to doc/manpages/shortcuts.asciidoc diff --git a/src/Makefile b/src/Makefile index c689d683..382a7a6e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,16 +20,8 @@ endif sources := $(wildcard *.cc) objects := $(addprefix ., $(sources:.cc=$(suffix).o)) deps := $(addprefix ., $(sources:.cc=$(suffix).d)) -docs := ../doc/manpages/commands \ - ../doc/manpages/execeval \ - ../doc/manpages/expansions \ - ../doc/manpages/faces \ - ../doc/manpages/highlighters \ - ../doc/manpages/hooks \ - ../doc/manpages/options \ - ../doc/manpages/registers \ - ../doc/manpages/shortcuts -mandocs := $(addsuffix .gz,$(docs)) +docs := $(wildcard ../doc/manpages/*.asciidoc) +mandocs := $(docs:.asciidoc=.gz) PREFIX ?= /usr/local DESTDIR ?= # root dir @@ -86,15 +78,12 @@ kak : $(objects) # Generate the editor's documentation pages # Since `a2x` won't generate man pages if some sections are missing (which we don't need), # we generate the pages, patch them and then compress them -$(mandocs): $(docs) - @for f in $^; do \ - pagename="$${f##*/}"; pagename="$${pagename%.*}"; \ - $(A2X) -f manpage "$$f"; \ - sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$${pagename^^}\"," \ - -e "/^\.SH \"NAME\"/,+1d" "$${f}.1"; \ - gzip -f "$${f}.1"; \ - mv "$${f}.1.gz" "$${f/.1/}.gz"; \ - done +../doc/manpages/%.gz: ../doc/manpages/%.asciidoc + $(A2X) -f manpage $< + sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$(basename $(notdir $<))\"," \ + -e "/^\.SH \"NAME\"/,+1d" $(@:.gz=.1) + gzip -f $(@:.gz=.1) + mv $(@:.gz=.1.gz) $@ test: cd ../test && ./run