Skip to content

Commit 3030775

Browse files
committed
Cleanup doc manpages generation
1 parent 8e3f403 commit 3030775

10 files changed

+8
-19
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/Makefile

+8-19
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,8 @@ endif
2020
sources := $(wildcard *.cc)
2121
objects := $(addprefix ., $(sources:.cc=$(suffix).o))
2222
deps := $(addprefix ., $(sources:.cc=$(suffix).d))
23-
docs := ../doc/manpages/commands \
24-
../doc/manpages/execeval \
25-
../doc/manpages/expansions \
26-
../doc/manpages/faces \
27-
../doc/manpages/highlighters \
28-
../doc/manpages/hooks \
29-
../doc/manpages/options \
30-
../doc/manpages/registers \
31-
../doc/manpages/shortcuts
32-
mandocs := $(addsuffix .gz,$(docs))
23+
docs := $(wildcard ../doc/manpages/*.asciidoc)
24+
mandocs := $(docs:.asciidoc=.gz)
3325

3426
PREFIX ?= /usr/local
3527
DESTDIR ?= # root dir
@@ -86,15 +78,12 @@ kak : $(objects)
8678
# Generate the editor's documentation pages
8779
# Since `a2x` won't generate man pages if some sections are missing (which we don't need),
8880
# we generate the pages, patch them and then compress them
89-
$(mandocs): $(docs)
90-
@for f in $^; do \
91-
pagename="$${f##*/}"; pagename="$${pagename%.*}"; \
92-
$(A2X) -f manpage "$$f"; \
93-
sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$${pagename^^}\"," \
94-
-e "/^\.SH \"NAME\"/,+1d" "$${f}.1"; \
95-
gzip -f "$${f}.1"; \
96-
mv "$${f}.1.gz" "$${f/.1/}.gz"; \
97-
done
81+
../doc/manpages/%.gz: ../doc/manpages/%.asciidoc
82+
$(A2X) -f manpage $<
83+
sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$(basename $(notdir $<))\"," \
84+
-e "/^\.SH \"NAME\"/,+1d" $(@:.gz=.1)
85+
gzip -f $(@:.gz=.1)
86+
mv $(@:.gz=.1.gz) $@
9887

9988
test:
10089
cd ../test && ./run

0 commit comments

Comments
 (0)