Browse code

doc: Use generic rules for man/html generation

Prior to this patch, the Makefile.am needs to be modified multiple
places to add a new man or HTML page to be generated. Since it is not
too often we modify this, it is easy to miss these finer details.

This changes the man and HTML generator rules to be more generic and use
variables as many places as possible. Also moved all the lines which
should not need to be changed as much towards the bottom-half of the
file.

Signed-off-by: David Sommerseth <davids@openvpn.net>

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210630185134.144826-1-openvpn@sf.lists.topphemmelig.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22604.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

David Sommerseth authored on 2021/07/01 03:51:34
Showing 1 changed files
... ...
@@ -9,11 +9,17 @@
9 9
 #  Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com>
10 10
 #
11 11
 
12
-MAINTAINERCLEANFILES = \
13
-	$(srcdir)/Makefile.in
14
-
15 12
 SUBDIRS = doxygen
16 13
 
14
+#
15
+# List of man and HTML pages we build when rst2man/rst2html is available
16
+#
17
+# NOTE: Remember to add source .rst files to $(dist_noinst_DATA) below
18
+#       This could be automated with GNU Make, but we need BSD Make support
19
+#
20
+build_man_pages = openvpn.8 openvpn-examples.5
21
+build_html_pages = openvpn.8.html openvpn-examples.5.html
22
+
17 23
 dist_doc_DATA = \
18 24
 	management-notes.txt gui-notes.txt
19 25
 
... ...
@@ -46,49 +52,41 @@ dist_noinst_DATA = \
46 46
 	man-sections/vpn-network-options.rst \
47 47
 	man-sections/windows-options.rst
48 48
 
49
-openvpn.8 :
50
-if HAVE_PYDOCUTILS
51
-	$(RST2MAN) $(srcdir)/$@.rst > $@
52
-else
53
-	@echo "Missing python-docutils - skipping man page generation"
54
-endif
55 49
 
56
-openvpn-examples.5 :
57
-if HAVE_PYDOCUTILS
58
-	$(RST2MAN) $(srcdir)/$@.rst > $@
59
-else
60
-	@echo "Missing python-docutils - skipping man page generation"
61
-endif
50
+######  GENERIC  RULES  ##########
51
+
52
+SUFFIXES = .8.rst .8 .8.html .5.rst .5 .5.html
62 53
 
54
+MAINTAINERCLEANFILES = \
55
+	$(srcdir)/Makefile.in
63 56
 
64
-openvpn.8.html:
57
+.8.rst.8 .5.rst.5 :
65 58
 if HAVE_PYDOCUTILS
66
-	$(RST2HTML) $(srcdir)/openvpn.8.rst > $@
59
+	$(RST2MAN) $< > $@
67 60
 else
68
-	@echo "Missing python-docutils - skipping man/html page generation"
61
+	@echo "Missing python-docutils - skipping man page generation ($@)"
69 62
 endif
70 63
 
71
-openvpn-examples.5.html:
64
+.8.rst.8.html .5.rst.5.html :
72 65
 if HAVE_PYDOCUTILS
73
-	$(RST2HTML) $(srcdir)/openvpn-examples.5.rst > $@
66
+	$(RST2HTML) $< > $@
74 67
 else
75
-	@echo "Missing python-docutils - skipping man/html page generation"
68
+	@echo "Missing python-docutils - skipping html page generation ($@)"
76 69
 endif
77 70
 
78 71
 
79 72
 if HAVE_PYDOCUTILS
80
-dist_noinst_DATA += openvpn.8 openvpn-examples.5
81
-dist_html_DATA = openvpn.8.html openvpn-examples.5.html
73
+dist_noinst_DATA += $(build_man_pages)
74
+dist_html_DATA = $(build_html_pages)
82 75
 
83 76
 # Failsafe - do not delete these files unless we can recreate them
84
-CLEANFILES = \
85
-	 openvpn.8 openvpn.8.html openvpn-examples.5 openvpn-examples.5.html
77
+CLEANFILES = $(build_man_pages) $(build_html_pages)
86 78
 
87 79
 endif
88 80
 
89 81
 if WIN32
90 82
 else
91
-dist_man_MANS = openvpn.8 openvpn-examples.5
83
+dist_man_MANS = $(build_man_pages)
92 84
 endif
93 85
 
94
-dist-hook : openvpn.8 openvpn.8.html openvpn-examples.5 openvpn-examples.5.html
86
+dist-hook : $(build_man_pages) $(build_html_pages)