summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAdam Spragg <adam@spra.gg>2022-06-28 17:37:18 +0100
committerAdam Spragg <adam@spra.gg>2022-06-29 15:29:41 +0100
commit58422d1a4a82ba48e045a9603bd5ee7916f6c922 (patch)
tree8eab0e1cb40b187c2eebfbe004be0bb7066c9164 /Makefile
parentb46002f1c47d7716fc582269e3d943b87bbdcf9c (diff)
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.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 8 insertions, 5 deletions
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) \