Imported Upstream version 1.22.4
[platform/upstream/groff.git] / contrib / groffer / groffer.am
1 # Automake rules for 'groffer'
2
3 # File position: <groff-source>/contrib/groffer/groffer.am
4
5 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
6 # Written by Werner Lemberg <wl@gnu.org> and
7 # Bernd Warken <groff-bernd.warken-72@web.de>.
8 # Automake migration by Bertrand Garrigues
9
10 # Last update: 22 Aug 2015
11
12 # This file is part of 'groffer' which is part of 'groff'.
13
14 # 'groff' is free software; you can redistribute it and/or modify it
15 # under the terms of the GNU General Public License as published by
16 # the Free Software Foundation, either version 2 of the License, or
17 # (at your option) any later version.
18
19 # 'groff' is distributed in the hope that it will be useful, but
20 # WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22 # General Public License for more details.
23
24 # You should have received a copy of the GNU General Public License
25 # along with this program.  If not, see
26 # <http://www.gnu.org/licenses/gpl-2.0.html>.
27
28 ########################################################################
29
30 groffer_srcdir = $(top_srcdir)/contrib/groffer
31 # generated programs
32 ROFF2PROGS = \
33   roff2dvi \
34   roff2html \
35   roff2pdf \
36   roff2ps \
37   roff2text \
38   roff2x
39
40 # Generated man templates
41 ROFF2MAN = \
42   contrib/groffer/roff2dvi.1.man \
43   contrib/groffer/roff2html.1.man \
44   contrib/groffer/roff2pdf.1.man \
45   contrib/groffer/roff2ps.1.man \
46   contrib/groffer/roff2text.1.man \
47   contrib/groffer/roff2x.1.man
48
49 GROFFER_PERL = \
50   contrib/groffer/main_subs.pl \
51   contrib/groffer/man.pl \
52   contrib/groffer/split_env.sh \
53   contrib/groffer/subs.pl
54
55 GROFFER_REST = \
56   contrib/groffer/roff2.1.man \
57   contrib/groffer/version.sh \
58   contrib/groffer/groffer.1.man \
59   contrib/groffer/groffer.pl \
60   contrib/groffer/roff2.pl
61
62 EXTRA_DIST += $(GROFFER_PERL) $(GROFFER_REST) \
63   contrib/groffer/ChangeLog  \
64   contrib/groffer/README \
65   contrib/groffer/README_PERL
66
67 # groffer_dir is set by a m4 macro
68 grofferdir = $(groffer_dir)
69 bin_SCRIPTS += groffer $(ROFF2PROGS)
70 groffer_DATA = $(GROFFER_PERL) contrib/groffer/version.sh
71 man1_MANS += \
72   contrib/groffer/groffer.1 \
73   contrib/groffer/roff2dvi.1 \
74   contrib/groffer/roff2html.1 \
75   contrib/groffer/roff2pdf.1 \
76   contrib/groffer/roff2ps.1 \
77   contrib/groffer/roff2text.1 \
78   contrib/groffer/roff2x.1
79 MOSTLYCLEANFILES += $(ROFF2MAN)
80
81 $(ROFF2PROGS): $(groffer_srcdir)/roff2.pl
82         cp $(groffer_srcdir)/roff2.pl $@
83
84 # we take roff2.man and replace the @ROFF2MODE@ by the type of file
85 # (dvi, pdf, html etc ...)
86 $(ROFF2MAN):  $(groffer_srcdir)/roff2.1.man
87         $(AM_V_GEN)$(MKDIR_P) contrib/groffer \
88         && FILEMODE=`echo $@ | sed 's|contrib/groffer/roff2\([a-z][a-z]*\)\.1\.man|\1|g'` \
89         && sed -e 's/[@]ROFF2MODE[@]/'"$$FILEMODE"'/g' \
90                $(groffer_srcdir)/roff2.1.man \
91                > $@;
92
93 groffer: $(GROFFER_PERL) $(GROFFER_REST) $(SH_DEPS_SED_SCRIPT)
94         $(AM_V_GEN)sed -f "$(SH_DEPS_SED_SCRIPT)" \
95            -e "s|[@]g[@]|$(g)|g" \
96            -e "s|[@]BINDIR[@]|$(DESTDIR)$(bindir)|g" \
97            -e "s|[@]libdir[@]|$(DESTDIR)$(libdir)|g" \
98            -e "s|[@]groffer_dir[@]|$(DESTDIR)$(groffer_dir)|g" \
99            -e "s|[@]VERSION[@]|$(VERSION)|g" \
100            -e "$(SH_SCRIPT_SED_CMD)" \
101            $(groffer_srcdir)/groffer.pl \
102            >$@ \
103         && chmod +x $@;
104
105 uninstall_groffdirs: uninstall-groffer-hook
106 uninstall-groffer-hook:
107         if test -d $(DESTDIR)$(grofferdir); then \
108           rmdir $(DESTDIR)$(grofferdir); \
109         fi
110
111
112 ########################################################################
113 # Editor settings
114 ########################################################################
115 #
116 # Local Variables:
117 # mode: makefile-automake
118 # fill-column: 72
119 # End:
120 # vim: set filetype=automake textwidth=72: