1## Makefile for the gettext-tools/man subdirectory of GNU gettext 2## Copyright (C) 2001-2003, 2006-2007, 2013-2015, 2018 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 <https://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# and for each of the bin_SCRIPTS in misc/Makefile.am. 26 27man_aux = \ 28msgcmp.x msgfmt.x msgmerge.x msgunfmt.x xgettext.x \ 29msgattrib.x msgcat.x msgcomm.x msgconv.x msgen.x msgexec.x msgfilter.x \ 30msggrep.x msginit.x msguniq.x \ 31recode-sr-latin.x \ 32gettextize.x autopoint.x 33 34# Likewise. 35 36man_MAN1SRC = \ 37msgcmp.1 msgfmt.1 msgmerge.1 msgunfmt.1 xgettext.1 \ 38msgattrib.1 msgcat.1 msgcomm.1 msgconv.1 msgen.1 msgexec.1 msgfilter.1 \ 39msggrep.1 msginit.1 msguniq.1 \ 40recode-sr-latin.1 41man_MAN1MISC = \ 42gettextize.1 autopoint.1 43man_MAN1 = $(man_MAN1SRC) $(man_MAN1MISC) 44man_MANS = $(man_MAN1) 45 46man_HTML = \ 47msgcmp.1.html msgfmt.1.html msgmerge.1.html msgunfmt.1.html xgettext.1.html \ 48msgattrib.1.html msgcat.1.html msgcomm.1.html msgconv.1.html msgen.1.html \ 49msgexec.1.html msgfilter.1.html msggrep.1.html msginit.1.html msguniq.1.html \ 50recode-sr-latin.1.html \ 51gettextize.1.html autopoint.1.html 52 53EXTRA_DIST += help2man $(man_aux) $(man_MANS) $(man_HTML) 54MAINTAINERCLEANFILES = $(man_MANS) $(man_HTML) 55 56PERL = @PERL@ 57RM = rm -f 58 59# help2man 1.24 or newer. 60HELP2MAN = $(PERL) -w -- $(srcdir)/help2man 61 62# groff 1.17 or newer. 63MAN2HTML = groff -mandoc -Thtml 64# Some versions of groff -Thtml map '\-' to '−' = U+2212, which yields 65# the wrong result when copy&pasting command-line options and such. 66# Also remove 'CreationDate:' lines, for reproducible builds. 67MAN2HTML_POSTPROCESS = sed -e 's/\−/-/g' -e '/CreationDate:/d' 68 69UPDATEMODE = 70 71 72gt_man2html = \ 73 if test -f $${srcdir}$$m; then \ 74 $(MAN2HTML) $${srcdir}$$m > t-$@ && \ 75 $(MAN2HTML_POSTPROCESS) < t-$@ > t2-$@ && \ 76 mv t2-$@ $@; \ 77 rm -f t-$@ t2-$@; \ 78 fi 79 80 81# We distribute both the man pages and their HTML equivalent. 82# The user can generate the parts, via 83# make man 84# make html 85 86all-local: html-local 87install-data-local: install-html 88installdirs-local: installdirs-html 89uninstall-local: uninstall-html 90 91 92# Man pages. 93 94# The progname.x files contain some extra information not found in the 95# "progname --help" output. progname.1 depends on the source, not the 96# binary; we don't need to regenerate the binary when any source file 97# changes, only the main one. 98 99$(man_MAN1SRC): help2man $(top_srcdir)/../.version 100 progname=`echo $@ | sed -e 's/\.in$$//' -e 's/\.1$$//'`; \ 101 IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" \ 102 ../src/$${progname}$(EXEEXT) $(srcdir)/$${progname}.x $@ 103 104msgcmp.1: msgcmp.x ../src/msgcmp.c 105msgfmt.1: msgfmt.x ../src/msgfmt.c 106msgmerge.1: msgmerge.x ../src/msgmerge.c 107msgunfmt.1: msgunfmt.x ../src/msgunfmt.c 108xgettext.1: xgettext.x ../src/xgettext.c 109msgattrib.1: msgattrib.x ../src/msgattrib.c 110msgcat.1: msgcat.x ../src/msgcat.c 111msgcomm.1: msgcomm.x ../src/msgcomm.c 112msgconv.1: msgconv.x ../src/msgconv.c 113msgen.1: msgen.x ../src/msgen.c 114msgexec.1: msgexec.x ../src/msgexec.c 115msgfilter.1: msgfilter.x ../src/msgfilter.c 116msggrep.1: msggrep.x ../src/msggrep.c 117msginit.1: msginit.x ../src/msginit.c 118msguniq.1: msguniq.x ../src/msguniq.c 119recode-sr-latin.1: recode-sr-latin.x ../src/recode-sr-latin.c 120 121$(man_MAN1MISC): help2man $(top_srcdir)/../.version 122 progname=`echo $@ | sed -e 's/\.in$$//' -e 's/\.1$$//'`; \ 123 IN_HELP2MAN=1 $(SHELL) x-to-1 $(UPDATEMODE) "$(PERL)" "$(HELP2MAN)" \ 124 ../misc/$${progname}$(EXEEXT) $(srcdir)/$${progname}.x $@ 125 126gettextize.1: gettextize.x ../misc/gettextize.in 127autopoint.1: autopoint.x ../misc/autopoint.in 128 129 130# Man pages in HTML format. 131 132html-local: $(man_HTML) 133 134$(man_HTML): 135 srcdir=''; \ 136 progname=`echo $@ | sed -e 's/\.1\.html$$//'`; \ 137 m=$${progname}.1; \ 138 test -f ./$$m || srcdir=$(srcdir)/; \ 139 $(gt_man2html) 140 141msgcmp.1.html: msgcmp.1 142msgfmt.1.html: msgfmt.1 143msgmerge.1.html: msgmerge.1 144msgunfmt.1.html: msgunfmt.1 145xgettext.1.html: xgettext.1 146msgattrib.1.html: msgattrib.1 147msgcat.1.html: msgcat.1 148msgcomm.1.html: msgcomm.1 149msgconv.1.html: msgconv.1 150msgen.1.html: msgen.1 151msgexec.1.html: msgexec.1 152msgfilter.1.html: msgfilter.1 153msggrep.1.html: msggrep.1 154msginit.1.html: msginit.1 155msguniq.1.html: msguniq.1 156recode-sr-latin.1.html: recode-sr-latin.1 157gettextize.1.html: gettextize.1 158autopoint.1.html: autopoint.1 159 160install-html-local: 161 $(MKDIR_P) $(DESTDIR)$(htmldir) 162 for file in $(man_HTML); do \ 163 if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ 164 $(INSTALL_DATA) $$dir/$$file $(DESTDIR)$(htmldir)/$$file; \ 165 done 166 167installdirs-html: 168 $(MKDIR_P) $(DESTDIR)$(htmldir) 169 170uninstall-html: 171 for file in $(man_HTML); do \ 172 $(RM) $(DESTDIR)$(htmldir)/$$file; \ 173 done 174