mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-19 01:11:36 +03:00
Generate the documentation pages in the troff format
This commit introduces the `doc` target in the Makefile, which generates man pages from the `asciidoc`-formatted documentation in the `doc/manpages` directory. Before being installed into the `$(sharedir)/doc` directory, the generated raw man pages have to be striped of a few sections without which `a2x` won't convert the `asciidoc` data: the shady block of shell script in the `doc` target does just that, along with compressing the resulting man page. New dependency hereby introduced: `asciidoc`.
This commit is contained in:
parent
79abe58599
commit
985b7a188a
30
src/Makefile
30
src/Makefile
@ -20,6 +20,15 @@ endif
|
||||
sources := $(wildcard *.cc)
|
||||
objects := $(addprefix ., $(sources:.cc=$(suffix).o))
|
||||
deps := $(addprefix ., $(sources:.cc=$(suffix).d))
|
||||
docs := commands \
|
||||
execeval \
|
||||
expansions \
|
||||
faces \
|
||||
highlighters \
|
||||
hooks \
|
||||
options \
|
||||
registers \
|
||||
shortcuts \
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
DESTDIR ?= # root dir
|
||||
@ -63,20 +72,33 @@ kak : $(objects)
|
||||
.%$(suffix).o: %.cc
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF $(addprefix ., $(<:.cc=$(suffix).d)) -c -o $@ $<
|
||||
|
||||
%.1: %
|
||||
a2x -f manpage $<
|
||||
%.1.gz: %.1.txt
|
||||
a2x -f manpage $<
|
||||
gzip -f $(basename $<)
|
||||
|
||||
test:
|
||||
cd ../test && ./run
|
||||
tags:
|
||||
ctags -R
|
||||
man: ../doc/kakoune.1.txt
|
||||
a2x -f manpage $<
|
||||
gzip -fk $(basename $<)
|
||||
|
||||
man: ../doc/kakoune.1.gz
|
||||
doc: $(addsuffix .1,$(addprefix ../doc/manpages/,$(docs)))
|
||||
@for f in $^; do \
|
||||
pagename="$${f##*/}"; pagename="$${pagename%.*}"; \
|
||||
sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$${pagename^^}\"," \
|
||||
-e "/^\.SH \"NAME\"/,+1d" $$f; \
|
||||
gzip -f "$$f"; \
|
||||
mv "$${f}.gz" "$${f/.1/}.gz"; \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f .*.o .*.d kak tags
|
||||
|
||||
XDG_CONFIG_HOME ?= $(HOME)/.config
|
||||
|
||||
install: kak man
|
||||
install: kak man doc
|
||||
mkdir -p $(bindir)
|
||||
install -m 0755 kak $(bindir)
|
||||
mkdir -p $(sharedir)/rc
|
||||
|
Loading…
Reference in New Issue
Block a user