1# Make Autoconf man pages.
2
3# Copyright (C) 2001, 2004-2012 Free Software Foundation, Inc.
4
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18dist_man_MANS = \
19	$(srcdir)/autoconf.1 \
20	$(srcdir)/autoheader.1 \
21	$(srcdir)/autom4te.1 \
22	$(srcdir)/autoreconf.1 \
23	$(srcdir)/autoscan.1 \
24	$(srcdir)/autoupdate.1 \
25	$(srcdir)/ifnames.1 \
26	$(srcdir)/config.guess.1 \
27	$(srcdir)/config.sub.1
28
29EXTRA_DIST = $(dist_man_MANS:.1=.x) common.x
30MAINTAINERCLEANFILES = $(dist_man_MANS)
31
32# Depend on .version to get version number changes.
33common_dep = $(top_srcdir)/.version $(srcdir)/common.x
34binsrcdir = $(top_srcdir)/bin
35$(srcdir)/autoconf.1:   $(common_dep) $(binsrcdir)/autoconf.as
36$(srcdir)/autoheader.1: $(common_dep) $(binsrcdir)/autoheader.in
37$(srcdir)/autom4te.1:   $(common_dep) $(binsrcdir)/autom4te.in
38$(srcdir)/autoreconf.1: $(common_dep) $(binsrcdir)/autoreconf.in
39$(srcdir)/autoscan.1:   $(common_dep) $(binsrcdir)/autoscan.in
40$(srcdir)/autoupdate.1: $(common_dep) $(binsrcdir)/autoupdate.in
41$(srcdir)/ifnames.1:    $(common_dep) $(binsrcdir)/ifnames.in
42
43# Independent from this package.
44$(srcdir)/config.guess.1: $(top_srcdir)/build-aux/config.guess
45$(srcdir)/config.sub.1:   $(top_srcdir)/build-aux/config.sub
46
47remove_time_stamp = 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
48
49MOSTLYCLEANFILES = $(srcdir)/*.t
50
51SUFFIXES = .x .1
52
53.x.1:
54	@echo "Updating man page $@"
55	PATH="$(top_builddir)/tests$(PATH_SEPARATOR)$(top_srcdir)/build-aux$(PATH_SEPARATOR)$$PATH"; \
56	export PATH; \
57	$(HELP2MAN) \
58	    --include=$*.x \
59	    --include=$(srcdir)/common.x \
60	    --source='$(PACKAGE_STRING)' \
61	    --output=$@.t `echo '$*' | sed 's,.*/,,'`
62	if sed $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
63	   sed $(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
64		touch $@; \
65	else \
66		mv $@.t $@; \
67	fi
68	rm -f $@*.t
69