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