Imported Upstream version 1.22.4
[platform/upstream/groff.git] / tmac / tmac.am
1 # Copyright (C) 1989-2018 Free Software Foundation, Inc.
2 #      Written by James Clark (jjc@jclark.com)
3 #      Automake migration by Bertrand Garrigues
4 #
5 # Latest update: 22 Aug 2015
6 #
7 # This file is part of groff.
8 #
9 # groff is free software; you can redistribute it and/or modify it under
10 # the terms of the GNU General Public License as published by the Free
11 # Software Foundation, either version 3 of the License, or (at your
12 # option) any later version.
13 #
14 # groff is distributed in the hope that it will be useful, but WITHOUT
15 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 # for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 tmac_srcdir = $(top_srcdir)/tmac
22 tmac_builddir = $(top_builddir)/tmac
23
24 man7_MANS += \
25   tmac/groff_ms.7 \
26   tmac/groff_man.7 \
27   tmac/groff_me.7 \
28   tmac/groff_mdoc.7 \
29   tmac/groff_trace.7 \
30   tmac/groff_www.7
31
32 TMACNORMALFILES = \
33   tmac/man.tmac \
34   tmac/mandoc.tmac \
35   tmac/andoc.tmac \
36   tmac/an-old.tmac \
37   tmac/an-ext.tmac \
38   tmac/ms.tmac \
39   tmac/me.tmac \
40   tmac/mdoc.tmac \
41   tmac/pic.tmac \
42   tmac/a4.tmac \
43   tmac/papersize.tmac \
44   tmac/62bit.tmac \
45   tmac/ec.tmac \
46   tmac/safer.tmac \
47   tmac/trace.tmac \
48   tmac/ps.tmac \
49   tmac/psold.tmac \
50   tmac/pdfpic.tmac \
51   tmac/pspic.tmac \
52   tmac/psatk.tmac \
53   tmac/pdf.tmac \
54   tmac/dvi.tmac \
55   tmac/tty.tmac \
56   tmac/tty-char.tmac \
57   tmac/latin1.tmac \
58   tmac/latin2.tmac \
59   tmac/latin5.tmac \
60   tmac/latin9.tmac \
61   tmac/cp1047.tmac \
62   tmac/unicode.tmac \
63   tmac/X.tmac \
64   tmac/Xps.tmac \
65   tmac/lj4.tmac \
66   tmac/lbp.tmac \
67   tmac/html.tmac \
68   tmac/html-end.tmac \
69   tmac/devtag.tmac \
70   tmac/europs.tmac \
71   tmac/composite.tmac \
72   tmac/fallbacks.tmac \
73   tmac/eqnrc \
74   tmac/refer.tmac \
75   tmac/refer-me.tmac \
76   tmac/refer-ms.tmac \
77   tmac/troffrc \
78   tmac/troffrc-end \
79   tmac/trans.tmac \
80   tmac/hyphen.us \
81   tmac/hyphenex.us \
82   tmac/fr.tmac \
83   tmac/hyphen.fr \
84   tmac/sv.tmac \
85   tmac/hyphen.sv \
86   tmac/de.tmac \
87   tmac/den.tmac \
88   tmac/hyphen.det \
89   tmac/hyphen.den \
90   tmac/cs.tmac \
91   tmac/hyphen.cs \
92   tmac/hyphenex.cs \
93   tmac/ja.tmac \
94   tmac/zh.tmac
95 NORMALFILES = `echo $(TMACNORMALFILES) | sed -e "s|tmac/||g"`
96
97 # TMACSTRIPFILES are built from their unstripped version (-u)
98 TMACSTRIPFILES = tmac/e.tmac tmac/doc.tmac tmac/doc-old.tmac
99
100 # Files installed in tmacdir
101 dist_tmac_DATA = $(TMACNORMALFILES) tmac/an.tmac tmac/s.tmac
102 nodist_tmac_DATA = $(TMACSTRIPFILES) tmac/www.tmac
103
104 TMACMDOCFILES = \
105   tmac/doc-common \
106   tmac/doc-ditroff \
107   tmac/doc-nroff \
108   tmac/doc-syms
109 MDOCFILES = `echo $(TMACMDOCFILES) | sed -e "s|tmac/||g"`
110 mdocdir=$(tmacdir)/mdoc
111 # Files installed in mdocdir
112 nodist_mdoc_DATA = $(TMACMDOCFILES)
113
114 # Installed in localtmacdir
115 dist_localtmac_DATA = tmac/man.local tmac/mdoc.local
116
117 MOSTLYCLEANFILES += $(TMACMDOCFILES) tmac/www.tmac $(TMACSTRIPFILES) \
118    tmac/stamp-wrap \
119    tmac/*-wrap
120
121 EXTRA_DIST += \
122   tmac/fixmacros.sed \
123   tmac/groff_ms.7.man \
124   tmac/groff_man.7.man \
125   tmac/groff_me.7.man \
126   tmac/groff_mdoc.7.man \
127   tmac/groff_trace.7.man \
128   tmac/groff_www.7.man \
129   tmac/hyphenex.pl \
130   tmac/LOCALIZATION \
131   tmac/man.ultrix \
132   tmac/psfig.tmac \
133   tmac/ptx.tmac \
134   tmac/strip.sed \
135   tmac/TESTING-HINTS \
136   tmac/TODO \
137   tmac/www.tmac.in
138
139 dist-hook: tmac-dist-hook
140 tmac-dist-hook:
141         chmod u+w $(distdir)/tmac
142         for f in $(TMACMDOCFILES) $(TMACSTRIPFILES); do \
143           cp -f $(top_srcdir)/$$f-u $(distdir)/tmac; \
144         done
145
146 $(TMACMDOCFILES) $(TMACSTRIPFILES): 
147         $(MKDIR_P) $(top_builddir)/tmac
148         for f in $(TMACMDOCFILES) $(TMACSTRIPFILES); do \
149            sed -f $(tmac_srcdir)/strip.sed $(top_srcdir)/$$f-u > $(top_builddir)/$$f; \
150         done
151
152 tmac/www.tmac: tmac/www.tmac.in
153         $(MKDIR_P) $(top_builddir)/tmac
154         sed -e "s;[@]PNMTOPS_NOSETPAGE[@];$(pnmtops_nosetpage);g" \
155           $(tmac_srcdir)/www.tmac.in > $(top_builddir)/tmac/www.tmac
156
157 # The installation of groff compatibility wrappers for vendor-provided
158 # non-GNU macro sets is controlled by 'compatibility_wrappers' (see the
159 # commentary surrounding m4/groff.m4's
160 # GROFF_WITH_COMPATIBILITY_WRAPPERS).  Collision detection variables of
161 # the form 'tmac_<macro>_prefix' are defined in Makefile.am, to assist
162 # in the installation of groff-provided macro sets.
163 #
164 # When 'compatibility_wrappers' is 'no', one step is performed:
165 #   - the groff-provided macro set implementations are installed in
166 #     <prefix>/share/groff/<version>/tmac/ with the original macro set
167 #     name
168 #
169 # When 'compatibility_wrappers' is 'yes', two steps are performed:
170 #   - the groff-provided macro set implementations are installed in
171 #     <prefix>/share/groff/<version>/tmac/ with a prefix of
172 #     $(tmac_prefix) (which is usually 'g', via the appropriate
173 #     collision detection variable)
174 #   - the generated compatibility wrappers are installed in
175 #     <prefix>/lib/groff/site-tmac, with the original macro set name
176 #
177 # When 'compatibility_wrappers' is 'manual', two steps are performed:
178 #   - the groff-provided macro set implementations are installed in
179 #     <prefix>/share/groff/<version>/tmac/ with the original macro set
180 #     name
181 #   - the generated compatibility wrappers are installed in
182 #     <prefix>/lib/groff/site-tmac, with a name of
183 #     <macro><wrapper_suffix>, (which is usually '-os', see
184 #     'wrapper_suffix_default' in Makefile.am)
185
186
187 all: tmac/stamp-wrap
188
189 # Generate groff compatibility wrappers for all non-GNU OS provided
190 # macro sets.
191 tmac/stamp-wrap:
192         $(MKDIR_P) $(top_builddir)/tmac;
193         if test -n "$(tmac_wrap)"; then \
194           for m in ""$(tmac_wrap); do \
195             $(RM) $(top_builddir)/tmac/$$m-wrap; \
196             if test "$$m" = an; then \
197               echo .do mso andoc.tmac >>$(top_builddir)/tmac/$$m-wrap; \
198             fi; \
199             echo .cp 1 >>$(top_builddir)/tmac/$$m-wrap; \
200             echo .so $(sys_tmac_prefix)$$m >>$(top_builddir)/tmac/$$m-wrap; \
201           done; \
202         fi
203         touch $@
204
205 # Install groff compatibility wrappers into
206 # <prefix>/lib/groff/site-tmac.
207 install-data-local: install_tmac_wrap
208 install_tmac_wrap:
209         $(MKDIR_P) $(DESTDIR)$(systemtmacdir);
210         if test "$(compatibility_wrappers)" != "no"; then \
211           if test -n "$(tmac_wrap)"; then \
212             for m in ""$(tmac_wrap); do \
213               $(INSTALL_DATA) $(tmac_builddir)/$$m-wrap \
214                 $(DESTDIR)$(systemtmacdir)/$$m$(wrapper_suffix).tmac; \
215             done; \
216           fi; \
217         fi
218
219 # Rename the groff implementations of colliding macro sets to have a
220 # prefix.
221 install-data-hook: install_tmac_wrap_hook
222 install_tmac_wrap_hook:
223         if test "$(compatibility_wrappers)" = "yes"; then \
224           if test -n "$(tmac_wrap)"; then \
225             if test -f $(DESTDIR)$(tmacdir)/s.tmac -a -n "$(tmac_s_prefix)"; \
226             then \
227               mv $(DESTDIR)$(tmacdir)/s.tmac \
228                  $(DESTDIR)$(tmacdir)/$(tmac_s_prefix)s.tmac; \
229             fi; \
230             if test -f $(DESTDIR)$(tmacdir)/an.tmac -a -n "$(tmac_an_prefix)"; \
231             then \
232               mv $(DESTDIR)$(tmacdir)/an.tmac \
233                  $(DESTDIR)$(tmacdir)/$(tmac_an_prefix)an.tmac; \
234             fi; \
235           fi; \
236         fi
237
238 # Uninstall groff compatibility wrappers & renamed groff implementation
239 # macro sets.
240 uninstall_groffdirs: uninstall_tmac_hook
241 uninstall_tmac_hook:
242         if test -n "$(tmac_wrap)"; then \
243           if test "$(compatibility_wrappers)" != "no"; then \
244             for m in ""$(tmac_wrap); do \
245               $(RM) $(DESTDIR)$(systemtmacdir)/$$m$(wrapper_suffix).tmac; \
246             done; \
247           fi; \
248           $(RM) -f $(DESTDIR)$(tmacdir)/$(tmac_an_prefix)an.tmac; \
249           $(RM) -f $(DESTDIR)$(tmacdir)/$(tmac_s_prefix)s.tmac; \
250         fi
251         if test -d $(DESTDIR)$(mdocdir); then \
252           rmdir $(DESTDIR)$(mdocdir); \
253         fi
254         if test -d $(DESTDIR)$(tmacdir); then \
255           rmdir $(DESTDIR)$(tmacdir); \
256         fi
257         if test -d $(DESTDIR)$(localtmacdir); then \
258           rmdir $(DESTDIR)$(localtmacdir); \
259         fi
260
261
262 ########################################################################
263 # Editor settings
264 ########################################################################
265 #
266 # Local Variables:
267 # mode: makefile-automake
268 # fill-column: 72
269 # End:
270 # vim: set filetype=automake textwidth=72: