From bc885084878160d9b021739d2b6b404f0e695226 Mon Sep 17 00:00:00 2001 From: David Rheinsberg Date: Sat, 7 Mar 2020 15:22:00 +0100 Subject: [PATCH] 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. --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 841136d6..1d0fbe86 100644 --- a/Makefile +++ b/Makefile @@ -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