Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-runtime / man / Makefile.am
1 ## Makefile for the gettext-runtime/man subdirectory of GNU gettext
2 ## Copyright (C) 2001-2003, 2006, 2009, 2015 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 <http://www.gnu.org/licenses/>.
17
18 ## Process this file with automake to produce Makefile.in.
19
20 VERSION = @VERSION@
21
22 AUTOMAKE_OPTIONS = 1.11 gnits
23 EXTRA_DIST =
24
25 # A manual page for each of the bin_PROGRAMS in src/Makefile.am.
26
27 man_aux = gettext.x ngettext.x envsubst.x
28
29 # Likewise, plus additional manual pages for the libintl functions.
30
31 man_MAN1GEN = gettext.1 ngettext.1
32 man_MAN1IN = gettext.1.in ngettext.1.in
33 man_MAN1OTHER = envsubst.1
34 man_MAN1 = $(man_MAN1GEN) $(man_MAN1OTHER)
35 man_MAN3 = gettext.3 ngettext.3 \
36 textdomain.3 bindtextdomain.3 bind_textdomain_codeset.3
37 man_MAN3IN = gettext.3.in ngettext.3.in \
38 textdomain.3.in bindtextdomain.3.in bind_textdomain_codeset.3.in
39 man_MAN3LINK = dgettext.3 dcgettext.3 dngettext.3 dcngettext.3
40 man_MANS = $(man_MAN1)
41 notrans_man_MANS = $(man_MAN3) $(man_MAN3LINK)
42
43 man_HTML1GEN = gettext.1.html ngettext.1.html
44 man_HTML1IN = gettext.1.html.in ngettext.1.html.in
45 man_HTML1OTHER = envsubst.1.html
46 man_HTML1 = $(man_HTML1GEN) $(man_HTML1OTHER)
47 man_HTML3 = gettext.3.html ngettext.3.html \
48 textdomain.3.html bindtextdomain.3.html bind_textdomain_codeset.3.html
49 man_HTML = $(man_HTML1) $(man_HTML3)
50
51 EXTRA_DIST += help2man $(man_aux) $(man_MAN1IN) $(man_MAN1OTHER) \
52 $(man_MAN3) $(man_MAN3IN) $(man_MAN3LINK) \
53 $(man_HTML1IN) $(man_HTML1OTHER) $(man_HTML3)
54 CLEANFILES = $(man_MAN1GEN) $(man_HTML1GEN)
55 MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) \
56 $(man_HTML1IN) $(man_HTML1OTHER) $(man_HTML3)
57
58 PERL = @PERL@
59 RM = rm -f
60
61 # help2man 1.24 or newer.
62 HELP2MAN = $(PERL) -w -- $(srcdir)/help2man
63
64 # groff 1.17 or newer.
65 MAN2HTML = groff -mandoc -Thtml
66
67 UPDATEMODE =
68
69
70 gt_man2html = \
71         if test -f $${srcdir}$$m; then \
72           $(MAN2HTML) $${srcdir}$$m > t-$@ && \
73           sed -e '/CreationDate:/d' < t-$@ > t2-$@ && \
74           mv t2-$@ $@; \
75           rm -f t-$@ t2-$@; \
76         fi
77
78
79 # We distribute both the man pages and their HTML equivalent.
80 # The user can generate the parts, via
81 #   make man
82 #   make html
83
84 all-local: html-local
85 install-data-local: install-html
86 installdirs-local: installdirs-html
87 uninstall-local: uninstall-html
88
89
90 # Man pages.
91
92 # The progname.x files contain some extra information not found in the
93 # "progname --help" output.  Each progname.1 depends on the source,
94 # not the binary; we don't need to regenerate the binary when any
95 # source file changes, only the main one.
96
97 $(man_MAN1GEN): Makefile
98         srcdir=''; \
99         test -f ./$@.in || srcdir=$(srcdir)/; \
100         if test -f $${srcdir}$@.in; then \
101           sed -e 's|@''localedir''@|$(localedir)|g' $${srcdir}$@.in > t-$@ && \
102           mv t-$@ $@; \
103         fi
104
105 gettext.1: gettext.1.in
106 ngettext.1: ngettext.1.in
107
108 $(man_MAN1IN) $(man_MAN1OTHER): help2man $(top_srcdir)/../.version
109         progname=`echo $@ | sed -e 's/\.in$$//' -e 's/\.1$$//'`; \
110         IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" \
111           ../src/$${progname}$(EXEEXT) $(srcdir)/$${progname}.x $@
112
113 gettext.1.in: gettext.x ../src/gettext.c
114 ngettext.1.in: ngettext.x ../src/ngettext.c
115 envsubst.1: envsubst.x ../src/envsubst.c
116
117 $(man_MAN3): $(top_srcdir)/../.version
118         sed -e 's/@''VERSION''@/@VERSION@/g' < $(srcdir)/$@.in > t-$@ && \
119         mv t-$@ $@
120
121 gettext.3: gettext.3.in
122 ngettext.3: ngettext.3.in
123 textdomain.3: textdomain.3.in
124 bindtextdomain.3: bindtextdomain.3.in
125 bind_textdomain_codeset.3: bind_textdomain_codeset.3.in
126
127
128 # Man pages in HTML format.
129
130 html-local: $(man_HTML)
131
132 $(man_HTML1GEN): Makefile
133         srcdir=''; \
134         test -f ./$@.in || srcdir=$(srcdir)/; \
135         if test -f $${srcdir}$@.in; then \
136           sed -e 's|@''localedir''@|$(localedir)|g' $${srcdir}$@.in > t-$@ && \
137           mv t-$@ $@; \
138         fi
139
140 gettext.1.html: gettext.1.html.in
141 ngettext.1.html: ngettext.1.html.in
142
143 $(man_HTML1IN):
144         srcdir=''; \
145         progname=`echo $@ | sed -e 's/\.1\.html\.in$$//'`; \
146         m=$${progname}.1.in; \
147         test -f ./$$m || srcdir=$(srcdir)/; \
148         $(gt_man2html)
149
150 gettext.1.html.in: gettext.1.in
151 ngettext.1.html.in: ngettext.1.in
152
153 $(man_HTML1OTHER):
154         srcdir=''; \
155         progname=`echo $@ | sed -e 's/\.1\.html$$//'`; \
156         m=$${progname}.1; \
157         test -f ./$$m || srcdir=$(srcdir)/; \
158         $(gt_man2html)
159
160 envsubst.1.html: envsubst.1
161
162 $(man_HTML3):
163         srcdir=''; \
164         progname=`echo $@ | sed -e 's/\.3\.html$$//'`; \
165         m=$${progname}.3.in; \
166         test -f ./$$m || srcdir=$(srcdir)/; \
167         $(gt_man2html)
168
169 gettext.3.html: gettext.3.in
170 ngettext.3.html: ngettext.3.in
171 textdomain.3.html: textdomain.3.in
172 bindtextdomain.3.html: bindtextdomain.3.in
173 bind_textdomain_codeset.3.html: bind_textdomain_codeset.3.in
174
175 install-html-local:
176         $(MKDIR_P) $(DESTDIR)$(htmldir)
177         for file in $(man_HTML); do \
178           if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
179           $(INSTALL_DATA) $$dir/$$file $(DESTDIR)$(htmldir)/$$file; \
180         done
181
182 installdirs-html:
183         $(MKDIR_P) $(DESTDIR)$(htmldir)
184
185 uninstall-html:
186         for file in $(man_HTML); do \
187           $(RM) $(DESTDIR)$(htmldir)/$$file; \
188         done