Imported Upstream version 1.22.3
[platform/upstream/groff.git] / contrib / mom / Makefile.sub
1 # -*- makefile -*-
2 # Copyright (C) 2002-2014  Free Software Foundation, Inc.
3 #      Written by Werner Lemberg (wl@gnu.org)
4 #
5 # This file is part of groff.
6 #
7 # groff is free software; you can redistribute it and/or modify it under
8 # the terms of the GNU General Public License as published by the Free
9 # Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 # for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 # These may be overridden if cross-compiling.
21 GROFFBIN=$(top_builddir)/src/roff/groff/groff
22 GROFF_BIN_PATH=`echo $(groff_bin_dirs) | sed -e 's|  *|$(SH_SEP)|g'`
23 PDFMOMBIN=$(top_builddir)/src/devices/gropdf/pdfmom
24
25 groff_bin_dirs=\
26   $(top_builddir)/src/roff/groff \
27   $(top_builddir)/src/roff/troff \
28   $(top_builddir)/src/devices/grops \
29   $(top_builddir)/src/devices/gropdf
30
31 FFLAG=-F$(top_builddir)/font -F$(top_srcdir)/font
32 TFLAG=-M$(top_builddir)/tmac -M$(top_srcdir)/tmac -M$(srcdir)
33 KFLAG=-k
34
35 GROFF=\
36   GROFF_COMMAND_PREFIX= \
37   GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
38   $(GROFFBIN) $(FFLAG) $(TFLAG)
39
40 PDFMOM=\
41   GROFF_COMMAND_PREFIX= \
42   GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
43   PDFMOM_BIN_PATH="$(top_builddir)/src/devices/gropdf" \
44   $(PDFMOMBIN) $(FFLAG) $(TFLAG) $(KFLAG)
45
46 MAN7=\
47   groff_mom.n
48
49 NORMALFILES=\
50   mom.tmac
51
52 # These files are processed with `strip.sed'.
53 STRIPFILES=\
54   om.tmac
55
56 HTMLDOCFILES=\
57   momdoc/stylesheet.css \
58   momdoc/appendices.html \
59   momdoc/color.html \
60   momdoc/cover.html \
61   momdoc/definitions.html \
62   momdoc/docelement.html \
63   momdoc/docprocessing.html \
64   momdoc/goodies.html \
65   momdoc/graphical.html \
66   momdoc/headfootpage.html \
67   momdoc/images.html \
68   momdoc/inlines.html \
69   momdoc/intro.html \
70   momdoc/letters.html \
71   momdoc/macrolist.html \
72   momdoc/rectoverso.html \
73   momdoc/refer.html \
74   momdoc/reserved.html \
75   momdoc/tables-of-contents.html \
76   momdoc/toc.html \
77   momdoc/typesetting.html \
78   momdoc/using.html \
79   momdoc/version-2.html
80
81 EXAMPLEFILES=\
82   examples/letter.mom \
83   examples/mom-pdf.mom \
84   examples/sample_docs.mom \
85   examples/typesetting.mom \
86   examples/README.txt \
87   examples/elvis_syntax \
88   examples/elvis_syntax.new \
89   examples/penguin.ps \
90   examples/penguin.pdf \
91   examples/mom.vim
92
93 PROCESSEDEXAMPLEFILES=\
94   examples/letter.pdf \
95   examples/mom-pdf.pdf \
96   examples/sample_docs.pdf \
97   examples/typesetting.pdf
98
99 HTMLDOCFILES_=`echo $(HTMLDOCFILES) | sed 's|momdoc/||g'`
100 EXAMPLEFILES_=`echo $(EXAMPLEFILES) | sed 's|examples/||g'`
101 PROCESSEDEXAMPLEFILES_=`echo $(PROCESSEDEXAMPLEFILES) | sed 's|examples/||g'`
102 PDFDOCFILE=mom-pdf.pdf
103
104 MOSTLYCLEANADD=\
105   stamp-strip \
106   penguin.ps \
107   penguin.pdf \
108   $(PROCESSEDEXAMPLEFILES) \
109   examples/stamp \
110   om.tmac-s
111
112 RM=rm -f
113
114 #.SUFFIXES: .mom .ps
115 #.mom.ps:
116 #       $(GROFF) -Tps -mom $< >$@
117
118 .SUFFIXES: .mom .pdf
119 .mom.pdf:
120         LC_ALL=C $(PDFMOM) $< >$@
121
122 all: stamp-strip $(make_pdfexamples)
123
124 $(PROCESSEDEXAMPLEFILES): penguin.ps penguin.pdf examples/stamp
125
126 pdfexamples: $(PROCESSEDEXAMPLEFILES)
127
128 penguin.ps:
129         cp $(srcdir)/examples/penguin.ps .
130 penguin.pdf:
131         cp $(srcdir)/examples/penguin.pdf .
132
133 examples/stamp:
134         -test -d examples || $(mkinstalldirs) examples
135         touch $@
136
137 install_data: install_always \
138               $(make_install_pdfdoc) $(make_install_shipped_htmldoc) \
139               $(make_install_examples)
140
141 install_always: stamp-strip $(NORMALFILES)
142         -test -d $(DESTDIR)$(tmacdir) || $(mkinstalldirs) $(DESTDIR)$(tmacdir)
143         for f in $(NORMALFILES); do \
144           $(RM) $(DESTDIR)$(tmacdir)/$$f; \
145           $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(tmacdir)/$$f; \
146         done
147         for f in $(STRIPFILES); do \
148           $(RM) $(DESTDIR)$(tmacdir)/$$f; \
149           $(INSTALL_DATA) $$f-s $(DESTDIR)$(tmacdir)/$$f; \
150         done
151
152 install_pdfdoc:
153 # Since this uses examples/, it's in install_pdfexamples
154
155 install_shipped_htmldoc: install_always $(HTMLDOCFILES)
156         -test -d $(DESTDIR)$(htmldocdir)/mom \
157           || $(mkinstalldirs) $(DESTDIR)$(htmldocdir)/mom
158         for f in $(HTMLDOCFILES_); do \
159           $(RM) $(DESTDIR)$(htmldocdir)/mom/$$f; \
160           $(INSTALL_DATA) $(srcdir)/momdoc/$$f \
161             $(DESTDIR)$(htmldocdir)/mom/$$f; \
162         done
163
164
165 install_examples: install_examples_always $(make_install_pdfexamples)
166
167 install_examples_always: $(EXAMPLEFILES)
168         -test -d $(DESTDIR)$(exampledir)/mom \
169           || $(mkinstalldirs) $(DESTDIR)$(exampledir)/mom
170         for f in $(EXAMPLEFILES_); do \
171           $(RM) $(DESTDIR)$(exampledir)/mom/$$f; \
172           $(INSTALL_DATA) $(srcdir)/examples/$$f \
173             $(DESTDIR)$(exampledir)/mom/$$f; \
174         done
175
176 install_pdfexamples: install_examples_always $(PROCESSEDEXAMPLEFILES)
177         for f in $(PROCESSEDEXAMPLEFILES_); do \
178           $(RM) $(DESTDIR)$(exampledir)/mom/$$f; \
179           $(INSTALL_DATA) examples/$$f $(DESTDIR)$(exampledir)/mom/$$f; \
180         done
181         -test -d $(DESTDIR)$(pdfdocdir) \
182           || $(mkinstalldirs) $(DESTDIR)$(pdfdocdir)
183         for f in $(PDFDOCFILE); do \
184           $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
185           ln -s $(exampledir)/mom/$$f $(DESTDIR)$(pdfdocdir)/$$f; \
186         done
187
188 stamp-strip: $(STRIPFILES)
189         for f in $(STRIPFILES); do \
190           $(RM) $$f-s; \
191           LANG=C LC_ALL=C \
192             sed -f $(top_srcdir)/tmac/strip.sed $(srcdir)/$$f >$$f-s; \
193         done
194         touch $@
195
196 uninstall_sub: uninstall_always \
197                 $(make_uninstall_pdfdoc) $(make_uninstall_shipped_htmldoc) \
198                 $(make_uninstall_examples)
199
200 uninstall_always:
201         -for f in $(NORMALFILES) $(STRIPFILES); do \
202           $(RM) $(DESTDIR)$(tmacdir)/$$f; \
203         done
204
205 uninstall_pdfdoc: uninstall_always
206 # Since that used examples/, it's in uninstall_pdfexamples
207
208 uninstall_shipped_htmldoc: uninstall_always
209         -for f in $(HTMLDOCFILES_); do \
210           $(RM) $(DESTDIR)$(htmldocdir)/mom/$$f; \
211         done
212         -test -d $(DESTDIR)$(htmldocdir)/mom && \
213           rmdir $(DESTDIR)$(htmldocdir)/mom
214
215 uninstall_examples: uninstall_examples_always $(make_uninstall_pdfexamples)
216         -test -d $(DESTDIR)$(exampledir)/mom && \
217           rmdir $(DESTDIR)$(exampledir)/mom
218
219 uninstall_examples_always:
220         -for f in $(EXAMPLEFILES_); do \
221           $(RM) $(DESTDIR)$(exampledir)/mom/$$f; \
222         done
223
224 uninstall_pdfexamples: uninstall_examples_always
225         -for f in $(PDFDOCFILE); do \
226           $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
227         done
228         -for f in $(PROCESSEDEXAMPLEFILES_); do \
229           $(RM) $(DESTDIR)$(exampledir)/mom/$$f; \
230         done