build: improve make man

This improves `make man` in the following ways:

  * The recently added `osbuild-manifest.5` man-page is now generated
    as well.

  * The target now honors `SRCDIR` and `BUILDDIR` variables.

  * Any newly added man-page is now automatically picked up and
    generated as well.

  * The output directory structure now mirrors the input directory
    structure.
This commit is contained in:
David Rheinsberg 2020-03-07 15:22:00 +01:00 committed by Lars Karlitski
parent d5b990bac0
commit bc88508487

View file

@ -17,6 +17,8 @@
BUILDDIR ?= .
SRCDIR ?= .
RST2MAN ?= rst2man
#
# Automatic Variables
#
@ -88,9 +90,14 @@ $(BUILDDIR)/%/:
# deployments to our website, as well as package manager scripts.
#
MANPAGES_RST = $(wildcard $(SRCDIR)/docs/*.[0123456789].rst)
MANPAGES_TROFF = $(patsubst $(SRCDIR)/%.rst,$(BUILDDIR)/%,$(MANPAGES_RST))
$(MANPAGES_TROFF): $(BUILDDIR)/docs/%: $(SRCDIR)/docs/%.rst | $(BUILDDIR)/docs/
$(RST2MAN) "$<" "$@"
.PHONY: man
man:
rst2man docs/osbuild.1.rst osbuild.1
man: $(MANPAGES_TROFF)
#
# Building packages