01c6d8bf8fe92d3817c0ac887c0d2843ad46a20f
[platform/upstream/groff.git] / contrib / pdfmark / Makefile.sub
1 # Copyright (C) 2005-2014  Free Software Foundation, Inc.
2 #      Written by Keith Marshall (keith.d.marshall@ntlworld.com)
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 MAN1=\
20   pdfroff.n
21
22 CMDFILES=\
23   pdfroff
24
25 TMACFILES=\
26   pdfmark.tmac \
27   spdf.tmac
28
29 PDFDOCFILES=\
30   pdfmark.pdf
31
32 MOSTLYCLEANDIRADD=\
33   pdfroff-*
34
35 MOSTLYCLEANADD=\
36   gnu.eps \
37   $(PDFDOCFILES) \
38   $(CMDFILES) \
39   pdf[0-9]*
40
41 GROFF_BIN_DIR=$(top_builddir)/src/roff/groff
42 GROFF_OTHER_BIN_DIRS=\
43   $(top_builddir)/src/roff/troff \
44   $(top_builddir)/src/devices/grops
45 GROFF_BIN_DIRS=$(GROFF_BIN_DIR) $(GROFF_OTHER_BIN_DIRS)
46 GROFF_BIN_PATH=`echo $(GROFF_BIN_DIRS) | sed -e 's|  *|$(SH_SEP)|g'`
47
48 FFLAG=-F$(top_builddir)/font -F$(top_srcdir)/font
49 MFLAG=-M$(srcdir) -M$(top_builddir)/tmac -M$(top_srcdir)/tmac
50 PFLAG=-dpaper=$(PAGE) -P-p$(PAGE)
51
52 PDFROFF=\
53   GROFF_TMPDIR=. \
54   GROFF_COMMAND_PREFIX= \
55   GROFF_BIN_DIR="$(GROFF_BIN_DIR)" \
56   GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
57   ./pdfroff --keep-temporary-files $(FFLAG) $(MFLAG) $(PFLAG)
58
59 RM=rm -f
60
61 .SUFFIXES: .ms .pdf
62 .ms.pdf:
63         $(PDFROFF) -mspdf --stylesheet=$(srcdir)/cover.ms $< >$@
64
65 all: pdfroff $(make_pdfdoc)
66
67 # The pdf files use the local script to generate.
68 $(PDFDOCFILES): pdfroff
69
70 pdfdoc: gnu.eps $(PDFDOCFILES)
71
72 gnu.eps:
73         if test -f $(top_srcdir)/doc/gnu.eps; then \
74           cp $(top_srcdir)/doc/gnu.eps . ; \
75         elif test -f $(top_builddir)/doc/gnu.eps; then \
76           cp $(top_builddir)/doc/gnu.eps . ; \
77         else \
78           xpmtoppm $(top_srcdir)/doc/gnu.xpm | pnmdepth 15 \
79             | $(pnmtops_nosetpage) -noturn -rle >$@ ; \
80         fi
81
82 pdfroff: pdfroff.sh $(SH_DEPS_SED_SCRIPT)
83         sed -f $(SH_DEPS_SED_SCRIPT) \
84             -e "s|@VERSION@|$(version)$(revision)|" \
85             -e "s|@GROFF_AWK_INTERPRETERS@|$(ALT_AWK_PROGS)|" \
86             -e "s|@GROFF_GHOSTSCRIPT_INTERPRETERS@|$(ALT_GHOSTSCRIPT_PROGS)|" \
87             -e "s|@GROFF_BIN_DIR@|$(bindir)|" $(srcdir)/pdfroff.sh >$@
88         chmod +x $@
89
90 install_data: install_always $(make_install_pdfdoc)
91
92 install_always:
93         -test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
94         for f in $(CMDFILES); do \
95           $(RM) $(DESTDIR)$(bindir)/$$f; \
96           $(INSTALL_SCRIPT) $$f $(DESTDIR)$(bindir)/$$f; \
97         done
98         -test -d $(DESTDIR)$(tmacdir) || $(mkinstalldirs) $(DESTDIR)$(tmacdir)
99         for f in $(TMACFILES); do \
100           $(RM) $(DESTDIR)$(tmacdir)/$$f; \
101           $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(tmacdir)/$$f; \
102         done
103
104 install_pdfdoc: install_always
105         -test -d $(DESTDIR)$(pdfdocdir) \
106           || $(mkinstalldirs) $(DESTDIR)$(pdfdocdir)
107         for f in $(PDFDOCFILES); do \
108           $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
109           $(INSTALL_DATA) $$f $(DESTDIR)$(pdfdocdir)/$$f; \
110         done
111
112 uninstall_sub: uninstall_always $(make_uninstall_pdfdoc)
113
114 uninstall_always:
115         -for f in $(CMDFILES); do $(RM) $(DESTDIR)$(bindir)/$$f; done
116         -for f in $(TMACFILES); do $(RM) $(DESTDIR)$(tmacdir)/$$f; done
117
118 uninstall_pdfdoc: uninstall_always
119         -for f in $(PDFDOCFILES); do $(RM) $(DESTDIR)$(pdfdocdir)/$$f; done
120
121 # Emacs settings
122 ########################################################################
123 #
124 # Local Variables:
125 # mode: makefile
126 # End: