Imported Upstream version 1.22.3
[platform/upstream/groff.git] / contrib / hdtbl / Makefile.sub
1 # Copyright (C) 2006-2014  Free Software Foundation, Inc.
2 #      Written by Werner Lemberg (wl@gnu.org)
3 #
4 # This file is part of groff.
5 #
6 # groff is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 # for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 # These may be overridden if cross-compiling.
20 GROFFBIN=$(top_builddir)/src/roff/groff/groff
21 GROFF_BIN_PATH=`echo $(groff_bin_dirs) | sed -e 's|  *|$(SH_SEP)|g'`
22
23 groff_bin_dirs=\
24   $(top_builddir)/src/roff/groff \
25   $(top_builddir)/src/roff/troff \
26   $(top_builddir)/src/preproc/eqn \
27   $(top_builddir)/src/preproc/pic \
28   $(top_builddir)/src/preproc/tbl \
29   $(top_builddir)/src/devices/grops
30
31 FFLAG=-F$(top_builddir)/font -F$(top_srcdir)/font
32 TFLAG=-M$(top_builddir)/tmac -M$(top_srcdir)/tmac -M$(srcdir)
33 PFLAG=-t -p -e -U
34
35 GROFF=\
36   GROFF_COMMAND_PREFIX= \
37   GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
38   $(GROFFBIN) $(FFLAG) $(TFLAG) $(PFLAG)
39
40 MAN7=\
41   groff_hdtbl.n
42
43 # These files are processed with `strip.sed'.
44 STRIPFILES=\
45   hdtbl.tmac \
46   hdmisc.tmac
47
48 # These files are handled by the `.in.roff' rule.
49 GENFILES=\
50   examples/fonts_n.roff \
51   examples/fonts_x.roff
52
53 EXAMPLEFILES=\
54   examples/common.roff \
55   examples/chess_board.roff \
56   examples/color_boxes.roff \
57   examples/color_nested_tables.roff \
58   examples/color_table_cells.roff \
59   examples/color_transitions.roff \
60   examples/col_rowspan_colors.roff \
61   examples/mixed_pickles.roff \
62   examples/rainbow.roff \
63   examples/short_reference.roff
64
65 PROCESSEDEXAMPLEFILES=\
66   examples/chess_board.ps \
67   examples/color_boxes.ps \
68   examples/color_nested_tables.ps \
69   examples/color_table_cells.ps \
70   examples/color_transitions.ps \
71   examples/col_rowspan_colors.ps \
72   examples/fonts_n.ps \
73   examples/fonts_x.ps \
74   examples/mixed_pickles.ps \
75   examples/rainbow.ps \
76   examples/short_reference.ps
77
78 EXAMPLEFILES_=`echo $(EXAMPLEFILES) | sed 's|examples/||g'`
79 GENFILES_=`echo $(GENFILES) | sed 's|examples/||g'`
80 PROCESSEDEXAMPLEFILES_=`echo $(PROCESSEDEXAMPLEFILES) | sed 's|examples/||g'`
81
82 MOSTLYCLEANADD=\
83   gnu.eps \
84   $(PROCESSEDEXAMPLEFILES) \
85   $(GENFILES) \
86   examples/stamp \
87   stamp-strip \
88   hdmisc.tmac-s hdtbl.tmac-s
89
90 RM=rm -f
91
92 .SUFFIXES: .roff .in .ps
93
94 .roff.ps:
95         $(GROFF) -Tps -dfontpath=$(top_srcdir)/font -dsopath=$(srcdir)/ \
96                  -mhdtbl $< >$@
97
98 .in.roff:
99         sed -e "s|@fontdir@|$(fontdir)|" $< >$@
100
101 all: $(make_examples) stamp-strip
102
103 .PHONY: examples
104 examples: $(PROCESSEDEXAMPLEFILES)
105
106 $(PROCESSEDEXAMPLEFILES): gnu.eps examples/stamp examples/common.roff
107
108 gnu.eps:
109         if test -f $(top_srcdir)/doc/gnu.eps; then \
110           cp $(top_srcdir)/doc/gnu.eps . ; \
111         elif test -f $(top_builddir)/doc/gnu.eps; then \
112           cp $(top_builddir)/doc/gnu.eps . ; \
113         else \
114           xpmtoppm $(top_srcdir)/doc/gnu.xpm | pnmdepth 15 \
115             | $(pnmtops_nosetpage) -noturn -rle >$@ ; \
116         fi
117
118 examples/stamp:
119         -test -d examples || $(mkinstalldirs) examples
120         touch $@
121
122 stamp-strip: $(STRIPFILES)
123         for f in $(STRIPFILES); do \
124           $(RM) $$f-s; \
125           sed -f $(top_srcdir)/tmac/strip.sed $(srcdir)/$$f >$$f-s; \
126         done
127         touch $@
128
129 $(GENFILES): examples/stamp
130
131 install_data: install_always $(make_install_examples)
132
133 install_always: $(STRIPFILES) $(GENFILES)
134         -test -d $(DESTDIR)$(tmacdir) || $(mkinstalldirs) $(DESTDIR)$(tmacdir)
135         for f in $(STRIPFILES); do \
136           $(RM) $(DESTDIR)$(tmacdir)/$$f; \
137           $(INSTALL_DATA) $$f-s $(DESTDIR)$(tmacdir)/$$f; \
138         done
139
140 install_examples: install_always $(EXAMPLEFILES) $(PROCESSEDEXAMPLEFILES) \
141                   gnu.eps stamp-strip
142         -test -d $(DESTDIR)$(exampledir)/hdtbl \
143           || $(mkinstalldirs) $(DESTDIR)$(exampledir)/hdtbl
144         for f in $(EXAMPLEFILES_); do \
145           $(RM) $(DESTDIR)$(exampledir)/hdtbl/$$f; \
146           $(INSTALL_DATA) $(srcdir)/examples/$$f \
147             $(DESTDIR)$(exampledir)/hdtbl/$$f; \
148         done
149         for f in $(PROCESSEDEXAMPLEFILES_) $(GENFILES_); do \
150           $(RM) $(DESTDIR)$(exampledir)/hdtbl/$$f; \
151           $(INSTALL_DATA) examples/$$f $(DESTDIR)$(exampledir)/hdtbl/$$f; \
152         done
153         $(INSTALL_DATA) gnu.eps $(DESTDIR)$(exampledir)/hdtbl/gnu.eps
154
155 uninstall_sub: uninstall_always $(make_uninstall_examples)
156
157 uninstall_always:
158         -for f in $(STRIPFILES); do $(RM) $(DESTDIR)$(tmacdir)/$$f; done
159
160 uninstall_examples: uninstall_always
161         -for f in $(EXAMPLEFILES_) $(PROCESSEDEXAMPLEFILES_) $(GENFILES_); do \
162           $(RM) $(DESTDIR)$(exampledir)/hdtbl/$$f; \
163         done
164         $(RM) $(DESTDIR)$(exampledir)/hdtbl/gnu.eps
165         -test -d $(DESTDIR)$(exampledir)/hdtbl && \
166           rmdir $(DESTDIR)$(exampledir)/hdtbl
167
168 ########################################################################
169 # Emacs settings
170 ########################################################################
171 #
172 # Local Variables:
173 # mode: makefile
174 # End: