Imported Upstream version 1.22.4
[platform/upstream/groff.git] / contrib / mom / mom.am
1 # Copyright (C) 2002-2018 Free Software Foundation, Inc.
2 #      Written by Werner Lemberg (wl@gnu.org)
3 #      Automake migration by Bertrand Garrigues
4 #
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
11 # (at your option) any later version.
12 #
13 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
14 # 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 generated .pdf
24 MOM_TFLAG = -M$(mom_srcdir)
25 MOM_KFLAG = -k -p -e -t
26 MOMPDFMOM = \
27   GROFF_COMMAND_PREFIX= \
28   GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
29   PDFMOM_BIN_PATH="$(top_builddir)" \
30   $(PDFMOMBIN) $(FFLAG) $(TFLAG) $(MOM_TFLAG) $(MOM_KFLAG)
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 if INSTALL_SHIPPED_HTML
44 MOMHTMLDOCFILES=\
45   contrib/mom/momdoc/stylesheet.css \
46   contrib/mom/momdoc/appendices.html \
47   contrib/mom/momdoc/color.html \
48   contrib/mom/momdoc/cover.html \
49   contrib/mom/momdoc/definitions.html \
50   contrib/mom/momdoc/docelement.html \
51   contrib/mom/momdoc/docprocessing.html \
52   contrib/mom/momdoc/goodies.html \
53   contrib/mom/momdoc/graphical.html \
54   contrib/mom/momdoc/headfootpage.html \
55   contrib/mom/momdoc/images.html \
56   contrib/mom/momdoc/inlines.html \
57   contrib/mom/momdoc/intro.html \
58   contrib/mom/momdoc/letters.html \
59   contrib/mom/momdoc/macrolist.html \
60   contrib/mom/momdoc/rectoverso.html \
61   contrib/mom/momdoc/refer.html \
62   contrib/mom/momdoc/reserved.html \
63   contrib/mom/momdoc/tables-of-contents.html \
64   contrib/mom/momdoc/toc.html \
65   contrib/mom/momdoc/typesetting.html \
66   contrib/mom/momdoc/using.html \
67   contrib/mom/momdoc/version-2.html
68 momhtmldir = $(htmldocdir)/mom
69 momhtml_DATA = $(MOMHTMLDOCFILES)
70 endif
71
72 # Files installed in $(examplesdir)/mom.  MOMEXAMPLEFILES are located
73 # in the source tree, while MOMPROCESSEDEXAMPLEFILES are generated in
74 # the build tree.
75 MOMEXAMPLEFILES=\
76   contrib/mom/examples/letter.mom \
77   contrib/mom/examples/mom-pdf.mom \
78   contrib/mom/examples/mon_premier_doc.mom \
79   contrib/mom/examples/sample_docs.mom \
80   contrib/mom/examples/typesetting.mom \
81   contrib/mom/examples/README.txt \
82   contrib/mom/examples/README-fr.txt \
83   contrib/mom/examples/elvis_syntax \
84   contrib/mom/examples/elvis_syntax.new \
85   contrib/mom/examples/penguin.ps \
86   contrib/mom/examples/penguin.pdf \
87   contrib/mom/examples/mom.vim \
88   contrib/mom/examples/slide-demo.mom
89 if BUILD_EXAMPLES
90 momexampledir = $(exampledir)/mom
91 dist_momexample_DATA = $(MOMEXAMPLEFILES)
92 else
93 EXTRA_DIST += $(MOMEXAMPLEFILES)
94 endif
95
96 if BUILD_PDFEXAMPLES
97 MOMPROCESSEDEXAMPLEFILES = \
98   contrib/mom/examples/letter.pdf \
99   contrib/mom/examples/mom-pdf.pdf \
100   contrib/mom/examples/mon_premier_doc.pdf \
101   contrib/mom/examples/sample_docs.pdf \
102   contrib/mom/examples/typesetting.pdf \
103   contrib/mom/examples/slide-demo.pdf
104 momprocessedexampledir = $(exampledir)/mom
105 nodist_momprocessedexample_DATA = $(MOMPROCESSEDEXAMPLEFILES)
106
107 if HAVE_PDFTOOLS
108 # Small test suite on mom examples
109 mom_TESTS = contrib/mom/examples/tests-mom.sh
110 TESTS += $(mom_TESTS)
111 contrib/mom/examples/tests-mom.sh: $(top_builddir)/config.status \
112         $(MOMPROCESSEDEXAMPLEFILES)  $(top_srcdir)/contrib/mom/examples/test-mom.sh.in
113         sed -e "s|[@]abs_top_builddir[@]|$(abs_top_builddir)|g" \
114             -e "s|[@]groff_have_urw_fonts[@]|$(groff_have_urw_fonts)|g" \
115                 $(top_srcdir)/contrib/mom/examples/test-mom.sh.in > $@
116         chmod +x $@
117 MOSTLYCLEANFILES += $(mom_TESTS)
118 endif
119 endif
120 EXTRA_DIST += contrib/mom/examples/test-mom.sh.in
121
122 # For this list of files we add a symlink from $(exampledir)/mom to $(pdfdocdir)
123 PDFDOCFILE = mom-pdf.pdf
124
125 EXTRA_DIST += $(MOMHTMLDOCFILES) $(MOMEXAMPLEFILES) \
126   contrib/mom/BUGS \
127   contrib/mom/ChangeLog \
128   contrib/mom/NEWS \
129   contrib/mom/TODO \
130   contrib/mom/copyright \
131   contrib/mom/groff_mom.7.man
132
133 MOSTLYCLEANFILES += \
134   $(MOMPROCESSEDEXAMPLEFILES) \
135   penguin.ps \
136   penguin.pdf
137
138 # Rule to generated .pdf files from .mom files
139 SUFFIXES += .mom .pdf
140 .mom.pdf:
141         $(GROFF_V)$(MKDIR_P) `dirname $@` \
142         && LC_ALL=C $(MOMPDFMOM) $< >$@
143
144 $(MOMPROCESSEDEXAMPLEFILES): $(MOMNORMALFILES) \
145   groff troff gropdf pdfmom penguin.ps penguin.pdf \
146   gnu.eps font/devpdf/build_font_files
147
148 penguin.ps:
149         cp $(mom_srcdir)/examples/penguin.ps $@
150 penguin.pdf:
151         cp $(mom_srcdir)/examples/penguin.pdf $@
152
153 install-data-hook: install_mom
154 install_mom:
155 if BUILD_PDFEXAMPLES
156         for f in $(PDFDOCFILE); do \
157           $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
158           ln -s $(exampledir)/mom/$$f $(DESTDIR)$(pdfdocdir)/$$f; \
159         done
160 endif
161
162 uninstall_groffdirs: uninstall_mom
163 uninstall_mom:
164         for f in $(PDFDOCFILE); do \
165           $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
166         done
167         if test -d $(DESTDIR)$(exampledir)/mom; then \
168           rmdir $(DESTDIR)$(exampledir)/mom; \
169         fi
170         if test -d $(DESTDIR)$(htmldocdir)/mom; then \
171           rmdir $(DESTDIR)$(htmldocdir)/mom; \
172         fi
173
174
175 ########################################################################
176 ### Emacs settings
177 # Local Variables:
178 # mode: makefile-automake
179 # End:
180 # vim: set filetype=automake: