Imported Upstream version 1.22.4
[platform/upstream/groff.git] / contrib / mm / mm.am
1 # Copyright 1991-2018 Free Software Foundation, Inc.
2 #
3 # Last update: 22 Aug 2015
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 # mm.am
21 #
22
23 mm_srcdir = $(top_srcdir)/contrib/mm
24 mm_builddir = $(top_builddir)/contrib/mm
25
26 bin_SCRIPTS += mmroff
27
28 man1_MANS += contrib/mm/mmroff.1
29 man7_MANS += \
30   contrib/mm/groff_mm.7 \
31   contrib/mm/groff_mmse.7
32
33 # Files installed in $(tmacdir)/mm
34 MMFILES = \
35   contrib/mm/mm/0.MT \
36   contrib/mm/mm/5.MT \
37   contrib/mm/mm/4.MT \
38   contrib/mm/mm/ms.cov \
39   contrib/mm/mm/se_ms.cov
40 mmdir = $(tmacdir)/mm
41 dist_mm_DATA = $(MMFILES)
42
43 # Files installed in $(tmacdir)
44 tmacmmdir = $(tmacdir)
45 dist_tmacmm_DATA = contrib/mm/refer-mm.tmac
46
47 MMEXAMPLEFILES=\
48   contrib/mm/examples/letter.mm
49
50 mmexampledir=$(exampledir)/mm
51 dist_mmexample_DATA = $(MMEXAMPLEFILES)
52
53 # Local configuration files with default values.
54 MMLOCALE = \
55   locale \
56   se_locale
57
58 EXTRA_DIST += \
59   contrib/mm/ChangeLog \
60   contrib/mm/examples \
61   contrib/mm/Makefile.sim \
62   contrib/mm/mm \
63   contrib/mm/NOTES \
64   contrib/mm/README \
65   contrib/mm/groff_mm.7.man \
66   contrib/mm/groff_mmse.7.man \
67   contrib/mm/mmroff.1.man \
68   contrib/mm/mmroff.pl
69
70
71 mmroff: $(mm_srcdir)/mmroff.pl
72         $(AM_V_GEN)$(SED) -e 's;/usr/bin/perl;$(PERL);' \
73             $(mm_srcdir)/mmroff.pl \
74             >$@ \
75         && chmod +x $@
76
77 # Special installation rules for m.tmac, mse.tmac, mmse.tmac, mm.tmac
78 # and MMLOCALE
79 install-data-local: install_mm
80 install_mm:
81         -test -d $(DESTDIR)$(tmacdir) || $(mkinstalldirs) $(DESTDIR)$(tmacdir)
82         -test -d $(DESTDIR)$(mmdir) || $(mkinstalldirs) $(DESTDIR)$(mmdir)
83         $(RM) $(DESTDIR)$(tmacdir)/tmac.$(tmac_m_prefix)m
84         $(RM) $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)m.tmac
85         $(INSTALL_DATA) $(mm_srcdir)/m.tmac \
86           $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)m.tmac
87         $(SED) -e "s;^.mso m.tmac;.mso $(tmac_m_prefix)m.tmac;g" \
88           $(mm_srcdir)/mse.tmac > $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)mse.tmac
89         @$(SED) -e "s;^.mso mse.tmac;.mso $(tmac_m_prefix)mse.tmac;g" \
90           $(mm_srcdir)/mmse.tmac > $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)mmse.tmac
91         @$(SED) -e "s;^.mso m.tmac;.mso $(tmac_m_prefix)m.tmac;g" \
92           $(mm_srcdir)/mm.tmac > $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)mm.tmac
93         @for f in $(MMLOCALE); do \
94           test -f $(DESTDIR)$(tmacdir)/mm/$$f \
95             || touch $(DESTDIR)$(tmacdir)/mm/$$f; \
96         done
97 uninstall-local: uninstall_mm
98 uninstall_mm:
99         if test -d $(DESTDIR)$(mmexampledir); then \
100           rmdir $(DESTDIR)$(mmexampledir); \
101         fi
102         -for f in $(MMLOCALE); do \
103           test -s $(DESTDIR)$(tmacdir)/mm/$$f \
104             || $(RM) $(DESTDIR)$(tmacdir)/mm/$$f; \
105         done
106         $(RM) $(DESTDIR)$(tmacdir)/tmac.$(tmac_m_prefix)m
107         $(RM) $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)m.tmac
108         $(RM) $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)mm.tmac
109         $(RM) $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)mse.tmac
110         $(RM) $(DESTDIR)$(tmacdir)/$(tmac_m_prefix)mmse.tmac
111         -rmdir $(DESTDIR)$(tmacdir)/mm
112
113 # Special distribution rule: we copy all .tmac files from contrib/mm
114 dist-hook: dist_mm
115 dist_mm:
116         chmod u+w $(distdir)/contrib/mm/
117         for i in $(mm_srcdir)/*.tmac; do \
118           cp -f $$i $(distdir)/contrib/mm/; \
119         done
120
121
122 ########################################################################
123 ### Emacs settings
124 # Local Variables:
125 # mode: makefile-automake
126 # End:
127 # vim: set filetype=automake: