/
Makefile
executable file
·112 lines (91 loc) · 3.35 KB
/
Makefile
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
#!/usr/bin/make -f
##################################################################
# General settings
#
# INPUT - Main including file without .xml suffix
# OUTPUT - Generated document minus target suffix
# DEST - Destination for (non-chunked) transformations
# CHUNKDIR - Destination for chunked HTML transformations
# OUTPUT - "Path/Name" of generated (non-chunked) documents.
##################################################################
INPUT = index
OUTPUT = index
DEST = .
CHUNKDIR = html
OUTFILE = $(DEST)/$(OUTPUT)
##################################################################
# Stylesheet configuration
#
# Uncomment the proper stylesheet directory for your machine
#
# STYLEDIR - Directory holding xsl-ns stylesheet distribution
# HTML_xsl - Stylesheet for HTML transformations
# HTML_CHUNKED_xsl - Stylesheet for Chunked HTML transformations
##################################################################
# Fedora - Package: docbook5-style-xsl
STYLEDIR = /usr/share/sgml/docbook/xsl-ns-stylesheets/
# Ubuntu - Package: docbook-xsl-ns
# STYLEDIR = /usr/share/xml/docbook/stylesheet/docbook-xsl-ns/
# OS X - Package (Macports): docbook-xsl
# STYLEDIR = /opt/local/share/xsl/docbook-xsl
HTML_xsl = $(STYLEDIR)/html/docbook.xsl
HTML_CHUNKED_xsl = $(STYLEDIR)/html/chunk.xsl
##################################################################
# Options for transformations
#
# XSLTPARAMS - Options applicable to single/chunked output
# XSLT_HTML_PARAMS - Options specific to sigle HTML output
# DBLATEX_PARAMS - Options specific to dblatex PDF output
##################################################################
XSLTPARAMS = --xinclude \
--stringparam section.autolabel 1
XSLT_HTML_PARAMS = -o $(OUTFILE).html
XSLT_CHUNKED_PARAMS = --stringparam base.dir $(CHUNKDIR)/
DBLATEX_PARAMS = -o $(OUTFILE).pdf \
-P latex.class.options=11pt \
-P term.breakline=1
##################################################################
# Use the proper options for the target platform
##################################################################
OSTYPE := $(shell uname -s)
# OS X?
ifeq ("$(findstring Darwin, $(OSTYPE))", "Darwin")
SED = sed -E
FIND = find . -E
# Assume GNU
else
SED = sed -r
FIND = find . -regextype posix-extended
endif
##################################################################
# DocBook5 Schema
#
# Uncomment the applicable path to your system
#
# SCHEMADIR - Directory holding the DocBook5 RNC/RNG DTDs
##################################################################
# Fedora - Package: docbook5-schemas
SCHEMADIR = /usr/share/xml/docbook5/schema/rng/5.0
# OS X - Package (MacPorts): docbook-xml-5.0
# SCHEMADIR = /opt/local/share/xml/docbook/5.0/rng
# Ubuntu - Package: docbook5-xml
# SCHEMADIR = /usr/share/xml/docbook/schema/rng/5.0
##################################################################
# Build targets
##################################################################
all: clean docs
docdir:
mkdir -p $(DEST)
mkdir -p $(CHUNKDIR)
chunked:
xsltproc $(XSLTPARAMS) $(XSLT_CHUNKED_PARAMS) $(HTML_CHUNKED_xsl) $(INPUT).xml
html:
xsltproc $(XSLTPARAMS) $(XSLT_HTML_PARAMS) $(HTML_xsl) $(INPUT).xml
pdf:
dblatex $(DBLATEX_PARAMS) $(INPUT).xml
docs: docdir html pdf chunked
locator:
sed "s'%SCHEMADIR%'$(SCHEMADIR)'" .schemas.xml > schemas.xml
clean:
$(FIND) \( -regex "^[.]?(.+)\~$$" -o -regex "./[.]?#.*#" \) -delete
rm -fR output/*