doc: update Manthey name+email
[autoconf.git] / man / local.mk
blobcdecc0952456cad590e0882953e2c22c350dcc16
1 # Make Autoconf man pages.
3 # Copyright (C) 2001, 2004-2017, 2020-2021 Free Software Foundation,
4 # Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 dist_man_MANS = \
20 man/autoconf.1 \
21 man/autoheader.1 \
22 man/autom4te.1 \
23 man/autoreconf.1 \
24 man/autoscan.1 \
25 man/autoupdate.1 \
26 man/ifnames.1
28 EXTRA_DIST += $(dist_man_MANS:.1=.w) $(dist_man_MANS:.1=.x) man/common.x
30 # Each manpage depends on:
31 # - its .w and .x files and its source script in bin/
32 # - common.x for the SEE ALSO list
33 # - lib/Autom4te/ChannelDefs.pm which contains additional --help text
34 # (not included in _all_ the manpages, but it's easier to have them
35 # all depend on it)
36 # - .version and configure.ac for version information
38 # We ship the manpages in tarball releases so people can build from
39 # them without having help2man installed. For this to work correctly,
40 # the manpages cannot have declared dependencies on any file that is
41 # not also shipped in the tarball. To avoid concurrency bugs, those
42 # files plus the Makefile must in fact be sufficient to generate the
43 # manpages. See the automake manual, section 'Errors with distclean',
44 # for further discussion.
46 binsrcdir = $(top_srcdir)/bin
47 channeldefs_pm = lib/Autom4te/ChannelDefs.pm
48 man_common_dep = $(top_srcdir)/man/common.x \
49 $(top_srcdir)/$(channeldefs_pm) \
50 $(top_srcdir)/.version \
51 $(top_srcdir)/configure.ac
53 man/autoconf.1: $(common_dep) man/autoconf.w man/autoconf.x $(binsrcdir)/autoconf.in
54 man/autoheader.1: $(common_dep) man/autoheader.w man/autoheader.x $(binsrcdir)/autoheader.in
55 man/autom4te.1: $(common_dep) man/autom4te.w man/autom4te.x $(binsrcdir)/autom4te.in
56 man/autoreconf.1: $(common_dep) man/autoreconf.w man/autoreconf.x $(binsrcdir)/autoreconf.in
57 man/autoscan.1: $(common_dep) man/autoscan.w man/autoscan.x $(binsrcdir)/autoscan.in
58 man/autoupdate.1: $(common_dep) man/autoupdate.w man/autoupdate.x $(binsrcdir)/autoupdate.in
59 man/ifnames.1: $(common_dep) man/ifnames.w man/ifnames.x $(binsrcdir)/ifnames.in
61 # To generate the manpages, we use help2man, but we don't have it run
62 # the built script that corresponds to the manpage. Instead it runs
63 # the .w file listed above, which is a wrapper around
64 # build-aux/help-extract.pl, which parses the *source* of the script
65 # and extracts the help and version text. This means that the built
66 # script doesn't need to exist to create the manpage. If it did,
67 # we would have a concurrency bug, since we can't declare a dependency
68 # on the built script, as discussed above.
69 # We use a suffix rule describing the manpage as built from its .w file
70 # so that we can use $(<F) to name the executable to be run, which avoids
71 # an extra subshell and sed invocation.
73 remove_time_stamp = 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
74 SUFFIXES += .w .1
76 .w.1:
77 @echo "Updating man page $@"
78 $(MKDIR_P) $(@D)
79 PATH="$(top_srcdir)/man$(PATH_SEPARATOR)$$PATH"; \
80 PERL="$(PERL)"; \
81 PACKAGE_NAME="$(PACKAGE_NAME)"; \
82 VERSION="$(VERSION)"; \
83 RELEASE_YEAR="$(RELEASE_YEAR)"; \
84 top_srcdir="$(top_srcdir)"; \
85 channeldefs_pm="$(channeldefs_pm)"; \
86 export PATH PERL PACKAGE_NAME VERSION RELEASE_YEAR; \
87 export top_srcdir channeldefs_pm; \
88 $(HELP2MAN) \
89 --include=$(srcdir)/$*.x \
90 --include=$(srcdir)/man/common.x \
91 --source='$(PACKAGE_STRING)' \
92 --output=$@.t $(<F)
93 if $(SED) $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
94 $(SED) $(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
95 touch $@; \
96 else \
97 mv $@.t $@; \
99 rm -f $@.t $@a.t
102 MOSTLYCLEANFILES += $(dist_man_MANS:=.t) $(dist_man_MANS:=a.t)
103 MAINTAINERCLEANFILES += $(dist_man_MANS)
105 # To satisfy 'distcleancheck', we need to delete built manpages in
106 # 'distclean' when the build and source directories are not the same.
107 # We know we are in this case when 'man/common.x' doesn't exist.
108 distclean-local: distclean-local-man
109 distclean-local-man:
110 test -f man/common.x || rm -f $(dist_man_MANS)