Cleanup doc manpages generation

This commit is contained in:
Maxime Coste 2016-02-06 00:01:42 +00:00
parent 8e3f403e13
commit 3030775414
10 changed files with 8 additions and 19 deletions

View File

@ -20,16 +20,8 @@ endif
sources := $(wildcard *.cc) sources := $(wildcard *.cc)
objects := $(addprefix ., $(sources:.cc=$(suffix).o)) objects := $(addprefix ., $(sources:.cc=$(suffix).o))
deps := $(addprefix ., $(sources:.cc=$(suffix).d)) deps := $(addprefix ., $(sources:.cc=$(suffix).d))
docs := ../doc/manpages/commands \ docs := $(wildcard ../doc/manpages/*.asciidoc)
../doc/manpages/execeval \ mandocs := $(docs:.asciidoc=.gz)
../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))
PREFIX ?= /usr/local PREFIX ?= /usr/local
DESTDIR ?= # root dir DESTDIR ?= # root dir
@ -86,15 +78,12 @@ kak : $(objects)
# Generate the editor's documentation pages # Generate the editor's documentation pages
# Since `a2x` won't generate man pages if some sections are missing (which we don't need), # 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 # we generate the pages, patch them and then compress them
$(mandocs): $(docs) ../doc/manpages/%.gz: ../doc/manpages/%.asciidoc
@for f in $^; do \ $(A2X) -f manpage $<
pagename="$${f##*/}"; pagename="$${pagename%.*}"; \ sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$(basename $(notdir $<))\"," \
$(A2X) -f manpage "$$f"; \ -e "/^\.SH \"NAME\"/,+1d" $(@:.gz=.1)
sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$${pagename^^}\"," \ gzip -f $(@:.gz=.1)
-e "/^\.SH \"NAME\"/,+1d" "$${f}.1"; \ mv $(@:.gz=.1.gz) $@
gzip -f "$${f}.1"; \
mv "$${f}.1.gz" "$${f/.1/}.gz"; \
done
test: test:
cd ../test && ./run cd ../test && ./run