3bbbc9ae835201846e742e0a976a8ad2f76167a7
[platform/upstream/groff.git] / contrib / mom / mom.am
1 # Copyright (C) 2002-2020 Free Software Foundation, Inc.
2 #      Written by Werner Lemberg <wl@gnu.org>
3 #      Automake migration by Bertrand Garrigues
4 #        <bertrand.garrigues@laposte.net>
5 #
6 # This file is part of groff.
7 #
8 # groff is free software; you can redistribute it and/or modify it under
9 # the terms of the GNU General Public License as published by the Free
10 # Software Foundation, either version 3 of the License, or (at your
11 # option) any later version.
12 #
13 # groff is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 # for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 mom_srcdir = $(top_srcdir)/contrib/mom
22
23 # pdfmom command used to generate .pdf
24 #
25 # Use '-K utf8', not '-k', in case 'configure' didn't find uchardet.
26 MOMPDFMOM = \
27   GROFF_COMMAND_PREFIX= \
28   GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
29   PDFMOM_BIN_PATH="$(top_builddir)" \
30   $(PDFMOMBIN) $(FFLAG) $(MFLAG) -M$(mom_srcdir) -K utf8 -p -e -t
31
32 man7_MANS += contrib/mom/groff_mom.7
33
34 # Files installed in $(tmacdir).
35 # MOMNORMALFILES are located in the source tree.
36 MOMNORMALFILES = \
37   contrib/mom/mom.tmac \
38   contrib/mom/om.tmac
39 momtmacdir = $(tmacdir)
40 dist_momtmac_DATA = $(MOMNORMALFILES)
41
42 # Files installed in htmldocdir/mom
43 MOMHTMLDOCFILES=\
44   contrib/mom/momdoc/stylesheet.css \
45   contrib/mom/momdoc/appendices.html \
46   contrib/mom/momdoc/color.html \
47   contrib/mom/momdoc/cover.html \
48   contrib/mom/momdoc/definitions.html \
49   contrib/mom/momdoc/docelement.html \
50   contrib/mom/momdoc/docprocessing.html \
51   contrib/mom/momdoc/goodies.html \
52   contrib/mom/momdoc/graphical.html \
53   contrib/mom/momdoc/headfootpage.html \
54   contrib/mom/momdoc/images.html \
55   contrib/mom/momdoc/inlines.html \
56   contrib/mom/momdoc/intro.html \
57   contrib/mom/momdoc/letters.html \
58   contrib/mom/momdoc/macrolist.html \
59   contrib/mom/momdoc/rectoverso.html \
60   contrib/mom/momdoc/refer.html \
61   contrib/mom/momdoc/reserved.html \
62   contrib/mom/momdoc/tables-of-contents.html \
63   contrib/mom/momdoc/toc.html \
64   contrib/mom/momdoc/typesetting.html \
65   contrib/mom/momdoc/using.html \
66   contrib/mom/momdoc/version-2.html
67 momhtmldir = $(htmldocdir)/mom
68 momhtml_DATA = $(MOMHTMLDOCFILES)
69
70 # Files installed in $(examplesdir)/mom.  MOMEXAMPLEFILES are located
71 # in the source tree, while MOMPROCESSEDEXAMPLEFILES are generated in
72 # the build tree.
73 MOMEXAMPLEFILES=\
74   contrib/mom/examples/letter.mom \
75   contrib/mom/examples/mom-pdf.mom \
76   contrib/mom/examples/mon_premier_doc.mom \
77   contrib/mom/examples/sample_docs.mom \
78   contrib/mom/examples/typesetting.mom \
79   contrib/mom/examples/README.txt \
80   contrib/mom/examples/README-fr.txt \
81   contrib/mom/examples/elvis_syntax \
82   contrib/mom/examples/elvis_syntax.new \
83   contrib/mom/examples/penguin.ps \
84   contrib/mom/examples/penguin.pdf \
85   contrib/mom/examples/mom.vim \
86   contrib/mom/examples/slide-demo.mom \
87   contrib/mom/examples/copyright-default.mom \
88   contrib/mom/examples/copyright-chapter.mom
89 momexampledir = $(exampledir)/mom
90 dist_momexample_DATA = $(MOMEXAMPLEFILES)
91
92 if USE_GROPDF
93 MOMPROCESSEDEXAMPLEFILES = \
94   contrib/mom/examples/letter.pdf \
95   contrib/mom/examples/mom-pdf.pdf \
96   contrib/mom/examples/mon_premier_doc.pdf \
97   contrib/mom/examples/sample_docs.pdf \
98   contrib/mom/examples/slide-demo.pdf \
99   contrib/mom/examples/copyright-default.pdf \
100   contrib/mom/examples/copyright-chapter.pdf
101 if HAVE_URW_FONTS
102 MOMPROCESSEDEXAMPLEFILES += contrib/mom/examples/typesetting.pdf
103 endif
104 momprocessedexampledir = $(exampledir)/mom
105 nodist_momprocessedexample_DATA = $(MOMPROCESSEDEXAMPLEFILES)
106 endif
107
108 mom_test_template = contrib/mom/examples/test-mom.sh.in
109
110 # Small test suite on mom examples
111 mom_TESTS = contrib/mom/examples/tests-mom.sh
112 TESTS += $(mom_TESTS)
113 contrib/mom/examples/tests-mom.sh: \
114   $(top_builddir)/config.status \
115   $(MOMPROCESSEDEXAMPLEFILES) \
116   $(top_srcdir)/$(mom_test_template)
117         $(AM_V_GEN)sed \
118           -e "s|[@]abs_top_builddir[@]|$(abs_top_builddir)|g" \
119           -e "s|[@]groff_have_urw_fonts[@]|$(groff_have_urw_fonts)|g" \
120           $(top_srcdir)/$(mom_test_template) > $@ \
121         && chmod +x $@
122 MOSTLYCLEANFILES += $(mom_TESTS)
123 EXTRA_DIST += $(mom_test_template)
124
125 # For this list of files we add a symlink from $(exampledir)/mom to $(pdfdocdir)
126 PDFDOCFILE = mom-pdf.pdf
127
128 EXTRA_DIST += $(MOMHTMLDOCFILES) $(MOMEXAMPLEFILES) \
129   contrib/mom/BUGS \
130   contrib/mom/ChangeLog \
131   contrib/mom/NEWS \
132   contrib/mom/TODO \
133   contrib/mom/copyright \
134   contrib/mom/groff_mom.7.man
135
136 MOSTLYCLEANFILES += \
137   $(MOMPROCESSEDEXAMPLEFILES) \
138   penguin.ps \
139   penguin.pdf
140
141 # rule to generate .pdf files from .mom files
142 SUFFIXES += .mom .pdf
143 .mom.pdf:
144         $(GROFF_V)$(MKDIR_P) `dirname $@` \
145         && LC_ALL=C $(MOMPDFMOM) $< >$@
146
147 $(MOMPROCESSEDEXAMPLEFILES): $(MOMNORMALFILES) \
148   groff troff gropdf pdfmom penguin.ps penguin.pdf font/devpdf/stamp
149
150 penguin.ps:
151         $(AM_V_at)cp $(mom_srcdir)/examples/penguin.ps $@
152 penguin.pdf:
153         $(AM_V_at)cp $(mom_srcdir)/examples/penguin.pdf $@
154
155 install-data-hook: install_mom
156 install_mom:
157 if USE_GROPDF
158         for f in $(PDFDOCFILE); do \
159           $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
160           ln -s $(exampledir)/mom/$$f $(DESTDIR)$(pdfdocdir)/$$f; \
161         done
162 endif
163
164 uninstall_groffdirs: uninstall_mom
165 uninstall_mom:
166         for f in $(PDFDOCFILE); do \
167           $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
168         done
169         -rmdir $(DESTDIR)$(pdfdocdir)
170         if test -d $(DESTDIR)$(exampledir)/mom; then \
171           rmdir $(DESTDIR)$(exampledir)/mom; \
172         fi
173         if test -d $(DESTDIR)$(htmldocdir)/mom; then \
174           rmdir $(DESTDIR)$(htmldocdir)/mom; \
175         fi
176
177
178 # Local Variables:
179 # fill-column: 72
180 # mode: makefile-automake
181 # End:
182 # vim: set autoindent filetype=automake textwidth=72: