xref: /netbsd-src/external/gpl2/groff/dist/contrib/pdfmark/Makefile.sub (revision 4acc5b6b2013c23d840d952be7c84bc64d81149a)
1# Copyright (C) 2005, 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 2, or (at your option) any later
9# 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 along
17# with groff; see the file COPYING.  If not, write to the Free Software
18# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
19
20MAN1=\
21  pdfroff.n
22
23CMDFILES=\
24  pdfroff
25
26TMACFILES=\
27  pdfmark.tmac \
28  spdf.tmac
29
30PDFDOCFILES=\
31  pdfmark.pdf
32
33CLEANADD=\
34  gnu.eps \
35  $(PDFDOCFILES) \
36  $(CMDFILES)
37
38# Some `makes' don't predefine RM...
39RM=rm -f
40
41GROFF_BIN_DIR=$(top_builddir)/src/roff/groff
42GROFF_OTHER_BIN_DIRS=\
43  $(top_builddir)/src/roff/troff \
44  $(top_builddir)/src/devices/grops
45GROFF_BIN_DIRS=$(GROFF_BIN_DIR) $(GROFF_OTHER_BIN_DIRS)
46GROFF_BIN_PATH=`echo $(GROFF_BIN_DIRS) | sed -e 's|  *|$(SH_SEP)|g'`
47
48FFLAG=-F$(top_builddir)/font -F$(top_srcdir)/font
49MFLAG=-M$(srcdir) -M$(top_builddir)/tmac -M$(top_srcdir)/tmac
50PFLAG=-dpaper=$(PAGE) -P-p$(PAGE)
51
52PDFROFF=\
53  export GROFF_COMMAND_PREFIX; GROFF_COMMAND_PREFIX=''; \
54  export GROFF_BIN_DIR; GROFF_BIN_DIR=$(GROFF_BIN_DIR); \
55  export GROFF_BIN_PATH; GROFF_BIN_PATH=$(GROFF_BIN_PATH); \
56  ./pdfroff $(FFLAG) $(MFLAG) $(PFLAG)
57
58.SUFFIXES: .ms .pdf
59.ms.pdf:
60	$(RM) $@
61	$(PDFROFF) -mspdf --stylesheet=$(srcdir)/cover.ms $< >$@
62
63all: pdfroff $(make_pdfdoc)
64
65$(PDFDOCFILES): pdfroff
66
67pdfdoc: gnu.eps $(PDFDOCFILES)
68
69gnu.eps:
70	if test -f $(top_srcdir)/doc/gnu.eps; then \
71	  cp $(top_srcdir)/doc/gnu.eps . ; \
72	elif test -f $(top_builddir)/doc/gnu.eps; then \
73	  cp $(top_builddir)/doc/gnu.eps . ; \
74	else \
75	  xpmtoppm $(top_srcdir)/doc/gnu.xpm | pnmdepth 15 | \
76	    $(pnmtops_nosetpage) -noturn -rle >$@ ; \
77	fi
78
79pdfroff: pdfroff.sh $(SH_DEPS_SED_SCRIPT)
80	$(RM) $@
81	sed -f $(SH_DEPS_SED_SCRIPT) \
82	    -e "s|@VERSION@|$(version)$(revision)|" \
83	    -e "s|@GROFF_AWK_INTERPRETERS@|$(ALT_AWK_PROGS)|" \
84	    -e "s|@GROFF_GHOSTSCRIPT_INTERPRETERS@|$(ALT_GHOSTSCRIPT_PROGS)|" \
85	    -e "s|@GROFF_BIN_DIR@|$(bindir)|" $(srcdir)/pdfroff.sh >$@
86	chmod +x $@
87
88install_data: $(make_install_pdfdoc)
89	-test -d $(bindir) || $(mkinstalldirs) $(bindir)
90	for f in $(CMDFILES); do \
91	  $(RM) $(bindir)/$$f; \
92	  $(INSTALL_SCRIPT) $$f $(bindir)/$$f; \
93	done
94	-test -d $(tmacdir) || $(mkinstalldirs) $(tmacdir)
95	for f in $(TMACFILES); do \
96	  $(RM) $(tmacdir)/$$f; \
97	  $(INSTALL_DATA) $(srcdir)/$$f $(tmacdir)/$$f; \
98	done
99
100install_pdfdoc:
101	-test -d $(pdfdocdir) || $(mkinstalldirs) $(pdfdocdir)
102	for f in $(PDFDOCFILES); do \
103	  $(RM) $(pdfdocdir)/$$f; \
104	  $(INSTALL_DATA) $$f $(pdfdocdir)/$$f; \
105	done
106
107uninstall_sub:
108	for f in $(CMDFILES); do \
109	  $(RM) $(bindir)/$$f; \
110	done
111	for f in $(TMACFILES); do \
112	  $(RM) $(tmacdir)/$$f; \
113	done
114	for f in $(PDFDOCFILES); do \
115	  $(RM) $(pdfdocdir)/$$f; \
116	done
117