Skip to content

Commit d5b0342

Browse files
committed
man: support bringing your own go-md2man
Set the GO_MD2MAN make variable to elide building go-md2man from vendored sources and use the specified command instead. Signed-off-by: Cory Snider <csnider@mirantis.com> (cherry picked from commit edfde78) Signed-off-by: Cory Snider <csnider@mirantis.com>
1 parent 56c5c23 commit d5b0342

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

man/Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ mandir = $(prefix)/man
33
INSTALL = install
44
INSTALL_DATA = ${INSTALL} -m 644
55

6+
# By default, the man pages are generated using a copy of go-md2man built from
7+
# the vendored sources in this directory. This behavior can be overridden by
8+
# setting the GO_MD2MAN variable to the name/path of an existing go-md2man
9+
# binary.
10+
GO_MD2MAN ?= .build/go-md2man
11+
612
ALL_PAGES := $(wildcard *.*.md)
713

814
# Determine which manual sections we are generating pages for
@@ -14,8 +20,8 @@ sections := $(sort $(foreach page,$(ALL_PAGES:.md=),$(call man_section,$(page)))
1420
# Dynamically generate pattern rules for each manual section
1521
# so make knows how to build a target like man8/dockerd.8.
1622
define MANPAGE_template
17-
man$(1)/%.$(1): %.$(1).md .build/go-md2man | man$(1)
18-
.build/go-md2man -in $$< -out $$@
23+
man$(1)/%.$(1): %.$(1).md $(if $(findstring file,$(origin GO_MD2MAN)),$(GO_MD2MAN)) | man$(1)
24+
$(GO_MD2MAN) -in $$< -out $$@
1925
endef
2026
$(foreach sec,$(sections),$(eval $(call MANPAGE_template,$(sec))))
2127

0 commit comments

Comments
 (0)