2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00
Files
criu/scripts/nmk/Documentation/Makefile
Takashi Iwai 0493724c8e Documentation: Allow to use asciidoctor for formatting man pages
Since asciidoc is based on Phyton 2, we want to move to alternative,
and a promising one is asciidoctor.  This patch allows to use
asciidoctor for formatting man pages instead of asiidoc, by passing
a make option, USE_ASCIIDOCTOR=yes.

Although asciidoctor is almost compatible with asciidoc, it can
produce a man page directly from a text file without XML, which is
more efficiently.  So in asciidoctor mode, we don't require xmlto.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2019-04-20 20:25:26 -07:00

51 lines
1.1 KiB
Makefile

ifneq ($(USE_ASCIIDOCTOR),)
ASCIIDOC := asciidoctor
XMLTO :=
else
ASCIIDOC := asciidoc
XMLTO := xmlto
endif
PS2PDF := ps2pdf
SRC += nmk.txt
XMLS := $(patsubst %.txt,%.xml,$(SRC))
MANS := $(patsubst %.txt,%.8,$(SRC))
GROFF := groff
PAPER := $(shell paperconf 2>/dev/null || echo letter)
GROFF_OPTS := -Tps -t -dpaper=$(PAPER) -P-p$(PAPER) -man -msafer -rC1 -rD1 -rS11
PSS := $(MANS:%.8=%.ps)
PDFS := $(MANS:%.8=%.pdf)
ps: $(PSS)
pdf: $(PDFS)
all: check $(MANS)
.PHONY: all ps pdf check clean
check:
$(Q) for B in $(ASCIIDOC) $(XMLTO); do \
$$B --version > /dev/null || exit 1; \
done
%.8: %.txt
$(call msg-gen, $@)
ifneq ($(USE_ASCIIDOCTOR),)
$(Q) $(ASCIIDOC) -b manpage -d manpage -o $@ $<
else
$(Q) $(ASCIIDOC) -b docbook -d manpage -o $(patsubst %.8,%.xml,$@) $<
$(Q) $(XMLTO) man --skip-validation $(patsubst %.8,%.xml,$@) 2>/dev/null
endif
%.ps: %.8
$(call msg-gen, $@)
$(Q) $(GROFF) $(GROFF_OPTS) $^ > $@
%.pdf: %.ps
$(call msg-gen, $@)
$(Q) $(PS2PDF) $< $@
clean:
$(call msg-clean, "docs")
$(Q) $(RM) $(XMLS) $(MANS) $(PSS) $(PDFS)