xref: /netbsd-src/external/gpl2/gettext/dist/gettext-runtime/man/Makefile.am (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1## Makefile for the gettext-runtime/man subdirectory of GNU gettext
2## Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
3##
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2, or (at your option)
7## any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software Foundation,
16## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18## Process this file with automake to produce Makefile.in.
19
20VERSION = @VERSION@
21
22AUTOMAKE_OPTIONS = 1.2 gnits
23EXTRA_DIST =
24
25# A manual page for each of the bin_PROGRAMS in src/Makefile.am.
26
27man_aux = gettext.x ngettext.x envsubst.x
28
29# Likewise, plus additional manual pages for the libintl functions.
30
31man_MAN1GEN = gettext.1 ngettext.1
32man_MAN1IN = gettext.1.in ngettext.1.in
33man_MAN1OTHER = envsubst.1
34man_MAN1 = $(man_MAN1GEN) $(man_MAN1OTHER)
35man_MAN3 = gettext.3 ngettext.3 \
36textdomain.3 bindtextdomain.3 bind_textdomain_codeset.3
37man_MAN3IN = gettext.3.in ngettext.3.in \
38textdomain.3.in bindtextdomain.3.in bind_textdomain_codeset.3.in
39man_MAN3LINK = dgettext.3 dcgettext.3 dngettext.3 dcngettext.3
40man_MANS = $(man_MAN1) $(man_MAN3) $(man_MAN3LINK)
41
42man_HTMLGEN = gettext.1.html ngettext.1.html
43man_HTMLIN = gettext.1.html.in ngettext.1.html.in
44man_HTMLOTHER = \
45envsubst.1.html \
46gettext.3.html ngettext.3.html \
47textdomain.3.html bindtextdomain.3.html bind_textdomain_codeset.3.html
48man_HTML = $(man_HTMLGEN) $(man_HTMLOTHER)
49
50EXTRA_DIST += help2man $(man_aux) $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) $(man_MAN3IN) $(man_MAN3LINK) $(man_HTMLIN) $(man_HTMLOTHER)
51CLEANFILES = $(man_MAN1GEN) $(man_HTMLGEN)
52MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) $(man_HTMLIN) $(man_HTMLOTHER)
53
54PERL = @PERL@
55RM = rm -f
56
57# help2man 1.24 or newer.
58HELP2MAN = $(PERL) -w -- $(srcdir)/help2man
59
60# groff 1.17 or newer.
61MAN2HTML = groff -mandoc -Thtml
62
63
64# We distribute both the man pages and their HTML equivalent.
65# The user can generate the parts, via
66#   make man
67#   make html
68
69all-local: html-local
70install-data-local: install-html
71installdirs-local: installdirs-html
72uninstall-local: uninstall-html
73
74
75# Man pages.
76
77# The progname.x files contain some extra information not found in the
78# "progname --help" output.
79
80gettext.1: gettext.1.in Makefile
81	sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f gettext.1.in; then echo .; else echo $(srcdir); fi`/gettext.1.in > t-$@
82	mv t-$@ $@
83ngettext.1: ngettext.1.in Makefile
84	sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f ngettext.1.in; then echo .; else echo $(srcdir); fi`/ngettext.1.in > t-$@
85	mv t-$@ $@
86
87gettext.1.in: gettext.x
88	IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/gettext$(EXEEXT) $(srcdir)/gettext.x gettext.1.in
89ngettext.1.in: ngettext.x
90	IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/ngettext$(EXEEXT) $(srcdir)/ngettext.x ngettext.1.in
91
92envsubst.1: envsubst.x
93	$(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/envsubst$(EXEEXT) $(srcdir)/envsubst.x envsubst.1
94
95# Depend on version.sh to get version number changes.
96$(man_MAN1IN) $(man_MAN1OTHER): help2man $(top_srcdir)/../version.sh
97
98# Update them also during "make dist", in order to propagate added command
99# line options that were added, even if version.sh didn't change.
100UPDATEMODE =
101update-man1:
102	$(MAKE) $(man_MAN1IN) $(man_MAN1OTHER) UPDATEMODE=--update
103	$(MAKE)
104# Hidden from automake, but really activated. Works around an automake-1.5 bug.
105#distdir: update-man1
106
107gettext.3: gettext.3.in $(top_srcdir)/../version.sh
108	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/gettext.3.in > t-$@
109	mv t-$@ $@
110ngettext.3: ngettext.3.in $(top_srcdir)/../version.sh
111	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/ngettext.3.in > t-$@
112	mv t-$@ $@
113textdomain.3: textdomain.3.in $(top_srcdir)/../version.sh
114	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/textdomain.3.in > t-$@
115	mv t-$@ $@
116bindtextdomain.3: bindtextdomain.3.in $(top_srcdir)/../version.sh
117	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/bindtextdomain.3.in > t-$@
118	mv t-$@ $@
119bind_textdomain_codeset.3: bind_textdomain_codeset.3.in $(top_srcdir)/../version.sh
120	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/bind_textdomain_codeset.3.in > t-$@
121	mv t-$@ $@
122
123
124# Man pages in HTML format.
125
126html-local: $(man_HTML)
127
128gettext.1.html: gettext.1.html.in Makefile
129	sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f gettext.1.html.in; then echo .; else echo $(srcdir); fi`/gettext.1.html.in > t-$@
130	mv t-$@ $@
131ngettext.1.html: ngettext.1.html.in Makefile
132	sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f ngettext.1.html.in; then echo .; else echo $(srcdir); fi`/ngettext.1.html.in > t-$@
133	mv t-$@ $@
134
135gettext.1.html.in: gettext.1.in
136	$(MAN2HTML) `if test -f gettext.1.in; then echo .; else echo $(srcdir); fi`/gettext.1.in | sed -e '/CreationDate:/d' > t-$@
137	mv t-$@ $@
138ngettext.1.html.in: ngettext.1.in
139	$(MAN2HTML) `if test -f ngettext.1.in; then echo .; else echo $(srcdir); fi`/ngettext.1.in | sed -e '/CreationDate:/d' > t-$@
140	mv t-$@ $@
141
142envsubst.1.html: envsubst.1
143	$(MAN2HTML) `if test -f envsubst.1; then echo .; else echo $(srcdir); fi`/envsubst.1 | sed -e '/CreationDate:/d' > t-$@
144	mv t-$@ $@
145
146gettext.3.html: gettext.3.in
147	$(MAN2HTML) $(srcdir)/gettext.3.in | sed -e '/CreationDate:/d' > t-$@
148	mv t-$@ $@
149ngettext.3.html: ngettext.3.in
150	$(MAN2HTML) $(srcdir)/ngettext.3.in | sed -e '/CreationDate:/d' > t-$@
151	mv t-$@ $@
152textdomain.3.html: textdomain.3.in
153	$(MAN2HTML) $(srcdir)/textdomain.3.in | sed -e '/CreationDate:/d' > t-$@
154	mv t-$@ $@
155bindtextdomain.3.html: bindtextdomain.3.in
156	$(MAN2HTML) $(srcdir)/bindtextdomain.3.in | sed -e '/CreationDate:/d' > t-$@
157	mv t-$@ $@
158bind_textdomain_codeset.3.html: bind_textdomain_codeset.3.in
159	$(MAN2HTML) $(srcdir)/bind_textdomain_codeset.3.in | sed -e '/CreationDate:/d' > t-$@
160	mv t-$@ $@
161
162install-html-local:
163	$(mkdir_p) $(DESTDIR)$(htmldir)
164	for file in $(man_HTML); do \
165	  if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
166	  $(INSTALL_DATA) $$dir/$$file $(DESTDIR)$(htmldir)/$$file; \
167	done
168
169installdirs-html:
170	$(mkdir_p) $(DESTDIR)$(htmldir)
171
172uninstall-html:
173	for file in $(man_HTML); do \
174	  $(RM) $(DESTDIR)$(htmldir)/$$file; \
175	done
176