File: docbook.mk

package info (click to toggle)
caspar 20200611-2
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 908 kB
  • sloc: sh: 574; makefile: 124
file content (138 lines) | stat: -rw-r--r-- 3,282 bytes parent folder | download | duplicates (7)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# This file is maintained at http://git.mdcc.cx/caspar

# Copyright (C) 2002, 2003, 2004 Joost van Baal <joostvb-caspar-c-12@mdcc.cx>
#  
# This file is part of caspar.  Caspar 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.  You should have received a copy of
# the GNU General Public License along with this file (see COPYING).

# See caspar-typesetting(7) for usage information.

# see also /usr/local/src/debian/maint-guide/maint-guide-1.0.2/Makefile
# for a debiandoc-sgml example.

XMLDCL ?= /usr/share/sgml/declaration/xml.dcl

# my jade looks in "caspar/print.dsl",
#  "/usr/local/share/sgml/caspar/print.dsl",
#  "/usr/local/lib/sgml/caspar/print.dsl",
#  "/usr/share/sgml/caspar/print.dsl"
# when i specify -d caspar/print.dsl
#
# when using your own print.dsl, your Makefile could read
#
#  PRINT_DSL = print.dsl
#  include caspar/mk/docbook.mk
#
#
HTML_DSL ?= caspar/html.dsl
PRINT_DSL ?= caspar/print.dsl

# JADE = /usr/bin/jade
JADE ?= jade
# jade's -E option.  the jade default is 200.  we choose a maximum
# of 10 errors: we don't wanna have our console spammed by errormessages
JADE_MAXERRORS ?= 10

PDFJADETEX ?= pdfjadetex
PDFLATEX ?= pdflatex
JADETEX ?= jadetex
LATEX ?= latex

W3M ?= w3m
DVIPS ?= dvips
PSNUP ?= psnup

LPR ?= lpr
# gnome-gv might do well too
GV ?= gv

SGML2HTML_RULE = $(JADE) -E$(JADE_MAXERRORS) -t sgml -d $(HTML_DSL) $<

XML2HTML_RULE  = $(JADE) -E$(JADE_MAXERRORS) -t sgml -d $(HTML_DSL) \
  $(XMLDCL) $<

# lynx doesn't deal well with too wide blurbs of <literallayout>  :(
HTML2TXT_RULE  = $(W3M) -dump $< > $@

SGML2JTEX_RULE = $(JADE) -E$(JADE_MAXERRORS) -t tex -d $(PRINT_DSL) \
  -o $@ $<

XML2JTEX_RULE  = $(JADE) -E$(JADE_MAXERRORS) -t tex -d $(PRINT_DSL) \
  -o $@ $(XMLDCL) $<

# run three times for toc processing
JTEX2DVI_RULE  = $(JADETEX) $< && $(JADETEX) $< && $(JADETEX) $< && \
  rm -f $*.log $*.out $*.aux

# rm -f: intermediate files might not exist
JTEX2PDF_RULE = $(PDFJADETEX) $< && $(PDFJADETEX) $< && $(PDFJADETEX) $< && \
  rm -f $*.log $*.out $*.aux

# One of the GNU Make implicit rules makes N.dvi from N.tex with the
# command $(TEX)
TEX2DVI_RULE   = $(LATEX) $< && $(LATEX) $< && $(LATEX) $< && \
  rm -f $*.log $*.aux

DVI2PS_RULE    = $(DVIPS) -f < $< > $@
TEX2PDF_RULE   = $(PDFLATEX) $< && $(PDFLATEX) $< && $(PDFLATEX) $< && \
  rm -f $*.log $*.aux

PS22PS_RULE    = $(PSNUP) -2 $< $@

# create nice default target
sources := $(basename $(wildcard *.dbx *.tex *.sgml))
outputs := $(addsuffix .ps,$(sources)) $(addsuffix .pdf,$(sources)) \
  $(addsuffix .html,$(sources)) $(addsuffix  .txt,$(sources))

typeset: $(outputs)

%.jtex: %.sgml
	$(SGML2JTEX_RULE)

%.jtex: %.dbx
	$(XML2JTEX_RULE)

%.dvi: %.jtex
	$(JTEX2DVI_RULE)

%.dvi: %.tex
	$(TEX2DVI_RULE)

%.ps: %.dvi
	$(DVI2PS_RULE)

%.pdf: %.tex
	$(TEX2PDF_RULE)

%.pdf: %.jtex
	$(JTEX2PDF_RULE)

%.html: %.sgml
	$(SGML2HTML_RULE)

%.html: %.dbx
	$(XML2HTML_RULE)

%.txt: %.html
	$(HTML2TXT_RULE)

%.2ps: %.ps
	$(PS22PS_RULE)

%.view: %.ps
	$(GV) $<

%.print: %.2ps
	$(LPR) $<

%.printbig: %.ps
	$(LPR) $<

clean:
	-rm *.aux *.log *.dvi *.jtex

.PRECIOUS: %.ps %.html