From 58422d1a4a82ba48e045a9603bd5ee7916f6c922 Mon Sep 17 00:00:00 2001 From: Adam Spragg Date: Tue, 28 Jun 2022 17:37:18 +0100 Subject: doc: Generate the man page from markdown Because who wants to hand-write groff markup these days? This adds pandoc(1) as a build-dependency. It uses PHP Markdown Extra definition lists, which pandoc uses for e.g. command option/explanation lists. Because this definition list format is non-standard it might not render as intended on many markdown viewers, but pandoc generates "better" man page output with it. --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 364825c..f284f5a 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ DOCS := \ LICENSE.GPLv2 \ NEWS \ README \ - metastore.txt \ + metastore.md \ examples \ metastore_COMP := CC @@ -85,7 +85,7 @@ SLL_EXT := .a ### Default target -all: libs bins +all: libs bins man1/metastore.1 bins: $(BINS) libs: $(LIBS) @@ -315,9 +315,10 @@ $(SDEP): $(SRCS) $(PROJ_DIR)Makefile fi \ done) >>$(SDEP) -$(DOCS_DIR)%.txt: $(MANS_DIR)/man1/%.1 - @echo " GROFF $@" - $(HIDE)groff -mandoc -Kutf8 -Tutf8 $^ | col -bx >$@ +$(MANS_DIR)man1/metastore.1: $(DOCS_DIR)metastore.md + @mkdir -p $(MANS_DIR)man1 + @echo " PANDOC $@" + $(HIDE)pandoc -s --shift-heading-level=-1 -f markdown -t man $^ >$@ ### Rules for phony targets @@ -327,10 +328,12 @@ clean: $(HIDE)$(RM) $(addprefix $(BINS_DIR),$(BINS)) \ $(addprefix $(LIBS_DIR),$(LIBS_ALL_FILES)) \ $(addprefix $(OBJS_DIR),$(OBJS)) \ + $(addprefix $(MANS_DIR),$(MANS)) \ $(SDEP) distclean: clean $(HIDE)(find \ + $(MANS_DIR) \ $(OBJS_DIR) \ $(LIBS_DIR) \ $(BINS_DIR) \ -- cgit v1.2.1