diff --git a/src/Makefile b/src/Makefile index 11b1fd369..c0de3aa71 100644 --- a/src/Makefile +++ b/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