summaryrefslogtreecommitdiff
path: root/man/Makefile.am
blob: 7b04d10ae4b6b4475740ef00ced5704d77f21563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# $Id: Makefile.am 5243 2013-03-20 23:05:29Z karl $
# Makefile.am for texinfo/man.
#
# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
# 2012, 2013 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# These are generated using help2man.
man_MANS = install-info.1 makeinfo.1 texindex.1 texi2dvi.1

# These require the build in info/, thus can't do if we failed to find a
# terminal library.
if HAVE_TERMLIBS
man_MANS += info.1 infokey.1
endif

# These are hand-written.
man_MANS += info.5 texinfo.5

# This is generated by pod2man, but let's just run it by hand.
man_MANS += pod2texi.1

# These are just .so's to the common program.
man_MANS += texi2any.1 texi2pdf.1 pdftexi2dvi.1

EXTRA_DIST = $(man_MANS) ginfo.h2m

# Maintainers should be able to regenerate.
MAINTAINERCLEANFILES = $(man_MANS)

# 
# Use the programs built in our distribution, taking account of possible
# cross-compiling.  makeinfo needs a bunch of our included modules.
tpdir = $(top_srcdir)/tp
MAKEINFO = $(PERL) -I "$(tpdir)" "$(tpdir)"/texi2any.pl
#
tplibdir = $(tpdir)/maintain/lib
mi_perl5lib_path = "$(tpdir):$(tplibdir)/libintl-perl/lib:$(tplibdir)/Unicode-EastAsianWidth/lib:$(tplibdir)/Text-Unidecode/lib"
mi_perl5lib = PERL5LIB=$(mi_perl5lib_path); export PERL5LIB

# Set up the variables.  makeinfo is no longer a .exe(cutable).
man_rule_0 = \
  exe_ext="$(EXEEXT)" \
  && program=`expr '/$@' : '.*/\(.*\)\.1'` \
  && case $$program in \
         makeinfo) dir=tp; $(mi_perl5lib); exe_ext="";; \
            info*) dir=info; test $$program != info || program=g$$program;; \
    *install-info) dir=install-info; program=g$$program;; \
                *) dir=util;; esac \
  && dir="$(top_builddir)/$(native_tools)/$$dir" \
  && h2m="$(srcdir)/$$program.h2m"

# Update the man page for a binary program; set up the variables,
# make sure the binary is up-to-date and then generate the man page.
man_rule_bin = echo "Updating man page $@" \
  && $(man_rule_0) \
  && echo cd "$$dir" '&&' $(MAKE) $(AM_MAKEFLAGS) $$program$$exe_ext \
  &&     (cd "$$dir"  &&  $(MAKE) $(AM_MAKEFLAGS) $$program$$exe_ext) \
  && echo $(HELP2MAN) --name=\""$$name"\" -I "$$h2m" "$$dir/$$program" -o '$@'\
  &&      $(HELP2MAN) --name="$$name"     -I "$$h2m" "$$dir/$$program" -o '$@'


# Using help2man depends on the package version number.
common_mandeps = $(top_srcdir)/configure.ac

# for Info, we have an additional help2man file since the standard
# SEE ALSO text from help2man does not fit.
info.1: $(top_srcdir)/info/info.c $(srcdir)/ginfo.h2m \
                  $(common_mandeps)
	@name="read Info documents" && $(man_rule_bin)

infokey.1: $(top_srcdir)/info/infokey.c $(common_mandeps)
	@name="compile customizations for Info" && $(man_rule_bin)

install-info.1: $(top_srcdir)/install-info/install-info.c \
                          $(common_mandeps)
	@name="update info/dir entries" && $(man_rule_bin)

# Here we need some postprocessing to avoid man misformatting.
makeinfo.1: $(tpdir)/texi2any.pl $(common_mandeps)
	@name="translate Texinfo documents" && $(man_rule_bin)
	mv $@ $@.tmp
	sed '/^\.IP$$/N;/\nAlso/s/I//;/\nThe/s/I//' $@.tmp >$@
	rm $@.tmp

texindex.1: $(top_srcdir)/util/texindex.c $(common_mandeps)
	@name="sort Texinfo index files" && $(man_rule_bin)

# 
# For texi2dvi, do not depend on the current user's settings.
texi2dvi_envvars = unset TEXI2DVI_BUILD_MODE; unset TEXI2DVI_BUILD_DIRECTORY

texi2dvi.1: $(top_srcdir)/util/texi2dvi $(common_mandeps)
	$(texi2dvi_envvars); $(HELP2MAN) \
	  --name="convert Texinfo documents to DVI or PDF" \
	  $(top_srcdir)/util/texi2dvi >$@