• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Makefile for the gettext-runtime/man subdirectory of GNU gettext
2## Copyright (C) 2001-2003, 2006, 2009, 2013-2014, 2018-2019 Free Software Foundation,
3## 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 <https://www.gnu.org/licenses/>.
17
18## Process this file with automake to produce Makefile.in.
19
20VERSION = @VERSION@
21
22AUTOMAKE_OPTIONS = 1.11 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)
41notrans_man_MANS = $(man_MAN3) $(man_MAN3LINK)
42
43man_HTML1GEN = gettext.1.html ngettext.1.html
44man_HTML1IN = gettext.1.html.in ngettext.1.html.in
45man_HTML1OTHER = envsubst.1.html
46man_HTML1 = $(man_HTML1GEN) $(man_HTML1OTHER)
47man_HTML3 = gettext.3.html ngettext.3.html \
48textdomain.3.html bindtextdomain.3.html bind_textdomain_codeset.3.html
49man_HTML = $(man_HTML1) $(man_HTML3)
50
51EXTRA_DIST += help2man $(man_aux) $(man_MAN1IN) $(man_MAN1OTHER) \
52$(man_MAN3) $(man_MAN3IN) $(man_MAN3LINK) \
53$(man_HTML1IN) $(man_HTML1OTHER) $(man_HTML3)
54CLEANFILES = $(man_MAN1GEN) $(man_HTML1GEN)
55MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) \
56$(man_HTML1IN) $(man_HTML1OTHER) $(man_HTML3)
57
58PERL = @PERL@
59RM = rm -f
60
61# help2man 1.24 or newer.
62HELP2MAN = $(PERL) -w -- $(srcdir)/help2man
63
64# groff 1.17 or newer.
65MAN2HTML = groff -mandoc -Thtml
66# Some versions of groff -Thtml map '\-' to '&minus;' = U+2212, which yields
67# the wrong result when copy&pasting command-line options and such.
68# Also remove 'CreationDate:' lines, for reproducible builds.
69MAN2HTML_POSTPROCESS = sed -e 's/\&minus;/-/g' -e '/CreationDate:/d'
70
71UPDATEMODE =
72
73
74gt_man2html = \
75	if test -f $${srcdir}$$m; then \
76	  $(MAN2HTML) $${srcdir}$$m > t-$@ && \
77	  $(MAN2HTML_POSTPROCESS) < t-$@ > t2-$@ && \
78	  mv t2-$@ $@; \
79	  rm -f t-$@ t2-$@; \
80	fi
81
82
83# We distribute both the man pages and their HTML equivalent.
84# The user can generate the parts, via
85#   make man
86#   make html
87
88all-local: html-local
89install-data-local: install-html
90installdirs-local: installdirs-html
91uninstall-local: uninstall-html
92
93
94# Man pages.
95
96# The progname.x files contain some extra information not found in the
97# "progname --help" output.  Each progname.1 depends on the source,
98# not the binary; we don't need to regenerate the binary when any
99# source file changes, only the main one.
100
101$(man_MAN1GEN): Makefile
102	srcdir=''; \
103	test -f ./$@.in || srcdir=$(srcdir)/; \
104	if test -f $${srcdir}$@.in; then \
105	  sed -e 's|@''localedir''@|$(localedir)|g' $${srcdir}$@.in > t-$@ && \
106	  mv t-$@ $@; \
107	fi
108
109gettext.1: gettext.1.in
110ngettext.1: ngettext.1.in
111
112$(man_MAN1IN) $(man_MAN1OTHER): help2man $(top_srcdir)/../.version
113	progname=`echo $@ | sed -e 's/\.in$$//' -e 's/\.1$$//'`; \
114	IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" \
115	  ../src/$${progname}$(EXEEXT) $(srcdir)/$${progname}.x $@
116
117gettext.1.in: gettext.x ../src/gettext.c
118ngettext.1.in: ngettext.x ../src/ngettext.c
119envsubst.1: envsubst.x ../src/envsubst.c
120
121$(man_MAN3): $(top_srcdir)/../.version
122	sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/$@.in > t-$@ && \
123	mv t-$@ $@
124
125gettext.3: gettext.3.in
126ngettext.3: ngettext.3.in
127textdomain.3: textdomain.3.in
128bindtextdomain.3: bindtextdomain.3.in
129bind_textdomain_codeset.3: bind_textdomain_codeset.3.in
130
131
132# Man pages in HTML format.
133
134html-local: $(man_HTML)
135
136$(man_HTML1GEN): Makefile
137	srcdir=''; \
138	test -f ./$@.in || srcdir=$(srcdir)/; \
139	if test -f $${srcdir}$@.in; then \
140	  sed -e 's|@''localedir''@|$(localedir)|g' $${srcdir}$@.in > t-$@ && \
141	  mv t-$@ $@; \
142	fi
143
144gettext.1.html: gettext.1.html.in
145ngettext.1.html: ngettext.1.html.in
146
147$(man_HTML1IN):
148	srcdir=''; \
149	progname=`echo $@ | sed -e 's/\.1\.html\.in$$//'`; \
150	m=$${progname}.1.in; \
151	test -f ./$$m || srcdir=$(srcdir)/; \
152	$(gt_man2html)
153
154gettext.1.html.in: gettext.1.in
155ngettext.1.html.in: ngettext.1.in
156
157$(man_HTML1OTHER):
158	srcdir=''; \
159	progname=`echo $@ | sed -e 's/\.1\.html$$//'`; \
160	m=$${progname}.1; \
161	test -f ./$$m || srcdir=$(srcdir)/; \
162	$(gt_man2html)
163
164envsubst.1.html: envsubst.1
165
166$(man_HTML3):
167	srcdir=''; \
168	progname=`echo $@ | sed -e 's/\.3\.html$$//'`; \
169	m=$${progname}.3.in; \
170	test -f ./$$m || srcdir=$(srcdir)/; \
171	$(gt_man2html)
172
173gettext.3.html: gettext.3.in
174ngettext.3.html: ngettext.3.in
175textdomain.3.html: textdomain.3.in
176bindtextdomain.3.html: bindtextdomain.3.in
177bind_textdomain_codeset.3.html: bind_textdomain_codeset.3.in
178
179install-html-local:
180	$(MKDIR_P) $(DESTDIR)$(htmldir)
181	for file in $(man_HTML); do \
182	  if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
183	  $(INSTALL_DATA) $$dir/$$file $(DESTDIR)$(htmldir)/$$file; \
184	done
185
186installdirs-html:
187	$(MKDIR_P) $(DESTDIR)$(htmldir)
188
189uninstall-html:
190	for file in $(man_HTML); do \
191	  $(RM) $(DESTDIR)$(htmldir)/$$file; \
192	done
193