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 3 of the License, or
7## (at your option) 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, see <http://www.gnu.org/licenses/>.
16
17## Process this file with automake to produce Makefile.in.
18
19VERSION = @VERSION@
20
21AUTOMAKE_OPTIONS = 1.2 gnits
22EXTRA_DIST =
23
24# A manual page for each of the bin_PROGRAMS in src/Makefile.am.
25
26man_aux = gettext.x ngettext.x envsubst.x
27
28# Likewise, plus additional manual pages for the libintl functions.
29
30man_MAN1GEN = gettext.1 ngettext.1
31man_MAN1IN = gettext.1.in ngettext.1.in
32man_MAN1OTHER = envsubst.1
33man_MAN1 = $(man_MAN1GEN) $(man_MAN1OTHER)
34man_MAN3 = gettext.3 ngettext.3 \
35textdomain.3 bindtextdomain.3 bind_textdomain_codeset.3
36man_MAN3IN = gettext.3.in ngettext.3.in \
37textdomain.3.in bindtextdomain.3.in bind_textdomain_codeset.3.in
38man_MAN3LINK = dgettext.3 dcgettext.3 dngettext.3 dcngettext.3
39man_MANS = $(man_MAN1) $(man_MAN3) $(man_MAN3LINK)
40
41man_HTMLGEN = gettext.1.html ngettext.1.html
42man_HTMLIN = gettext.1.html.in ngettext.1.html.in
43man_HTMLOTHER = \
44envsubst.1.html \
45gettext.3.html ngettext.3.html \
46textdomain.3.html bindtextdomain.3.html bind_textdomain_codeset.3.html
47man_HTML = $(man_HTMLGEN) $(man_HTMLOTHER)
48
49EXTRA_DIST += help2man $(man_aux) $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) $(man_MAN3IN) $(man_MAN3LINK) $(man_HTMLIN) $(man_HTMLOTHER)
50CLEANFILES = $(man_MAN1GEN) $(man_HTMLGEN)
51MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) $(man_HTMLIN) $(man_HTMLOTHER)
52
53PERL = @PERL@
54RM = rm -f
55
56# help2man 1.24 or newer.
57HELP2MAN = $(PERL) -w -- $(srcdir)/help2man
58
59# groff 1.17 or newer.
60MAN2HTML = groff -mandoc -Thtml
61
62
63# We distribute both the man pages and their HTML equivalent.
64# The user can generate the parts, via
65#   make man
66#   make html
67
68all-local: html-local
69install-data-local: install-html
70installdirs-local: installdirs-html
71uninstall-local: uninstall-html
72
73
74# Man pages.
75
76# The progname.x files contain some extra information not found in the
77# "progname --help" output.
78
79gettext.1: gettext.1.in Makefile
80	sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f gettext.1.in; then echo .; else echo $(srcdir); fi`/gettext.1.in > t-$@
81	mv t-$@ $@
82ngettext.1: ngettext.1.in Makefile
83	sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f ngettext.1.in; then echo .; else echo $(srcdir); fi`/ngettext.1.in > t-$@
84	mv t-$@ $@
85
86gettext.1.in: gettext.x
87	IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/gettext$(EXEEXT) $(srcdir)/gettext.x gettext.1.in
88ngettext.1.in: ngettext.x
89	IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/ngettext$(EXEEXT) $(srcdir)/ngettext.x ngettext.1.in
90
91envsubst.1: envsubst.x
92	$(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" ../src/envsubst$(EXEEXT) $(srcdir)/envsubst.x envsubst.1
93
94# Depend on version.sh to get version number changes.
95$(man_MAN1IN) $(man_MAN1OTHER): help2man $(top_srcdir)/../version.sh
96
97# Update them also during "make dist", in order to propagate added command
98# line options that were added, even if version.sh didn't change.
99UPDATEMODE =
100update-man1:
101	$(MAKE) $(man_MAN1IN) $(man_MAN1OTHER) UPDATEMODE=--update
102	$(MAKE)
103# Hidden from automake, but really activated. Works around an automake-1.5 bug.
104#distdir: update-man1
105
106gettext.3: gettext.3.in $(top_srcdir)/../version.sh
107	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/gettext.3.in > t-$@
108	mv t-$@ $@
109ngettext.3: ngettext.3.in $(top_srcdir)/../version.sh
110	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/ngettext.3.in > t-$@
111	mv t-$@ $@
112textdomain.3: textdomain.3.in $(top_srcdir)/../version.sh
113	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/textdomain.3.in > t-$@
114	mv t-$@ $@
115bindtextdomain.3: bindtextdomain.3.in $(top_srcdir)/../version.sh
116	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/bindtextdomain.3.in > t-$@
117	mv t-$@ $@
118bind_textdomain_codeset.3: bind_textdomain_codeset.3.in $(top_srcdir)/../version.sh
119	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/bind_textdomain_codeset.3.in > t-$@
120	mv t-$@ $@
121
122
123# Man pages in HTML format.
124
125html-local: $(man_HTML)
126
127gettext.1.html: gettext.1.html.in Makefile
128	sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f gettext.1.html.in; then echo .; else echo $(srcdir); fi`/gettext.1.html.in > t-$@
129	mv t-$@ $@
130ngettext.1.html: ngettext.1.html.in Makefile
131	sed -e 's|@''localedir''@|$(localedir)|g' < `if test -f ngettext.1.html.in; then echo .; else echo $(srcdir); fi`/ngettext.1.html.in > t-$@
132	mv t-$@ $@
133
134gettext.1.html.in: gettext.1.in
135	$(MAN2HTML) `if test -f gettext.1.in; then echo .; else echo $(srcdir); fi`/gettext.1.in | sed -e '/CreationDate:/d' > t-$@
136	mv t-$@ $@
137ngettext.1.html.in: ngettext.1.in
138	$(MAN2HTML) `if test -f ngettext.1.in; then echo .; else echo $(srcdir); fi`/ngettext.1.in | sed -e '/CreationDate:/d' > t-$@
139	mv t-$@ $@
140
141envsubst.1.html: envsubst.1
142	$(MAN2HTML) `if test -f envsubst.1; then echo .; else echo $(srcdir); fi`/envsubst.1 | sed -e '/CreationDate:/d' > t-$@
143	mv t-$@ $@
144
145gettext.3.html: gettext.3.in
146	$(MAN2HTML) $(srcdir)/gettext.3.in | sed -e '/CreationDate:/d' > t-$@
147	mv t-$@ $@
148ngettext.3.html: ngettext.3.in
149	$(MAN2HTML) $(srcdir)/ngettext.3.in | sed -e '/CreationDate:/d' > t-$@
150	mv t-$@ $@
151textdomain.3.html: textdomain.3.in
152	$(MAN2HTML) $(srcdir)/textdomain.3.in | sed -e '/CreationDate:/d' > t-$@
153	mv t-$@ $@
154bindtextdomain.3.html: bindtextdomain.3.in
155	$(MAN2HTML) $(srcdir)/bindtextdomain.3.in | sed -e '/CreationDate:/d' > t-$@
156	mv t-$@ $@
157bind_textdomain_codeset.3.html: bind_textdomain_codeset.3.in
158	$(MAN2HTML) $(srcdir)/bind_textdomain_codeset.3.in | sed -e '/CreationDate:/d' > t-$@
159	mv t-$@ $@
160
161install-html-local:
162	$(mkdir_p) $(DESTDIR)$(htmldir)
163	for file in $(man_HTML); do \
164	  if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
165	  $(INSTALL_DATA) $$dir/$$file $(DESTDIR)$(htmldir)/$$file; \
166	done
167
168installdirs-html:
169	$(mkdir_p) $(DESTDIR)$(htmldir)
170
171uninstall-html:
172	for file in $(man_HTML); do \
173	  $(RM) $(DESTDIR)$(htmldir)/$$file; \
174	done
175