summaryrefslogtreecommitdiff
path: root/contrib/pdfmark/Makefile.sub
blob: 9eb276316aa8e28c41219ba91ead10eddc905b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
#      Written by Keith Marshall (keith.d.marshall@ntlworld.com)
# 
# This file is part of groff.
# 
# groff is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# groff is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

MAN1=\
  pdfroff.n

CMDFILES=\
  pdfroff

TMACFILES=\
  pdfmark.tmac \
  spdf.tmac

PDFDOCFILES=\
  pdfmark.pdf

MOSTLYCLEANDIRADD=\
  pdfroff-*

MOSTLYCLEANADD=\
  gnu.eps \
  $(PDFDOCFILES) \
  $(CMDFILES) \
  pdf[0-9]*

# Some `makes' don't predefine RM...
RM=rm -f

GROFF_BIN_DIR=$(top_builddir)/src/roff/groff
GROFF_OTHER_BIN_DIRS=\
  $(top_builddir)/src/roff/troff \
  $(top_builddir)/src/devices/grops
GROFF_BIN_DIRS=$(GROFF_BIN_DIR) $(GROFF_OTHER_BIN_DIRS)
GROFF_BIN_PATH=`echo $(GROFF_BIN_DIRS) | sed -e 's|  *|$(SH_SEP)|g'`

FFLAG=-F$(top_builddir)/font -F$(top_srcdir)/font
MFLAG=-M$(srcdir) -M$(top_builddir)/tmac -M$(top_srcdir)/tmac
PFLAG=-dpaper=$(PAGE) -P-p$(PAGE)

PDFROFF=\
  export GROFF_TMPDIR; GROFF_TMPDIR='.'; \
  export GROFF_COMMAND_PREFIX; GROFF_COMMAND_PREFIX=''; \
  export GROFF_BIN_DIR; GROFF_BIN_DIR=$(GROFF_BIN_DIR); \
  export GROFF_BIN_PATH; GROFF_BIN_PATH=$(GROFF_BIN_PATH); \
  ./pdfroff --keep-temporary-files $(FFLAG) $(MFLAG) $(PFLAG)

.SUFFIXES: .ms .pdf
.ms.pdf:
	$(RM) $@
	$(PDFROFF) -mspdf --stylesheet=$(srcdir)/cover.ms $< >$@

all: pdfroff $(make_pdfdoc)

pdfdoc: gnu.eps $(PDFDOCFILES)

gnu.eps:
	if test -f $(top_srcdir)/doc/gnu.eps; then \
	  cp $(top_srcdir)/doc/gnu.eps . ; \
	elif test -f $(top_builddir)/doc/gnu.eps; then \
	  cp $(top_builddir)/doc/gnu.eps . ; \
	else \
	  xpmtoppm $(top_srcdir)/doc/gnu.xpm | pnmdepth 15 | \
	    $(pnmtops_nosetpage) -noturn -rle >$@ ; \
	fi

pdfroff: pdfroff.sh $(SH_DEPS_SED_SCRIPT)
	$(RM) $@
	sed -f $(SH_DEPS_SED_SCRIPT) \
	    -e "s|@VERSION@|$(version)$(revision)|" \
	    -e "s|@GROFF_AWK_INTERPRETERS@|$(ALT_AWK_PROGS)|" \
	    -e "s|@GROFF_GHOSTSCRIPT_INTERPRETERS@|$(ALT_GHOSTSCRIPT_PROGS)|" \
	    -e "s|@GROFF_BIN_DIR@|$(bindir)|" $(srcdir)/pdfroff.sh >$@
	chmod +x $@

install_data: $(make_install_pdfdoc)
	-test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
	for f in $(CMDFILES); do \
	  $(RM) $(DESTDIR)$(bindir)/$$f; \
	  $(INSTALL_SCRIPT) $$f $(DESTDIR)$(bindir)/$$f; \
	done
	-test -d $(DESTDIR)$(tmacdir) || $(mkinstalldirs) $(DESTDIR)$(tmacdir)
	for f in $(TMACFILES); do \
	  $(RM) $(DESTDIR)$(tmacdir)/$$f; \
	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(tmacdir)/$$f; \
	done

install_pdfdoc:
	-test -d $(DESTDIR)$(pdfdocdir) \
	  || $(mkinstalldirs) $(DESTDIR)$(pdfdocdir)
	for f in $(PDFDOCFILES); do \
	  $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
	  $(INSTALL_DATA) $$f $(DESTDIR)$(pdfdocdir)/$$f; \
	done

uninstall_sub:
	for f in $(CMDFILES); do \
	  $(RM) $(DESTDIR)$(bindir)/$$f; \
	done
	for f in $(TMACFILES); do \
	  $(RM) $(DESTDIR)$(tmacdir)/$$f; \
	done
	for f in $(PDFDOCFILES); do \
	  $(RM) $(DESTDIR)$(pdfdocdir)/$$f; \
	done