File: Makefile

package info (click to toggle)
xmlformat 1.04-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,012 kB
  • sloc: xml: 2,289; perl: 996; ruby: 831; makefile: 109; sh: 65
file content (120 lines) | stat: -rw-r--r-- 3,214 bytes parent folder | download | duplicates (3)
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
# For the following variable, if its value is set in the environment,
# use it.  Otherwise, use value specified below.  Note that if the
# default doesn't work, you must specify an override value in the
# environment. For example, you'll likely need to provide a catalog
# file elsewhere (such as in your home directory) that provides
# pathnames that are correct for your system.

XML_CATALOG_FILES ?= ./catalog.xml

# This string must be mapped in your XML catalog file to the root
# directory of your local DocBook XSL files.  For example, you might
# have a catalog entry that looks like this:
# <rewriteSystem
#   systemIdStartString="docbook://xsl-current/"
#   rewritePrefix="file:///usr/local/sgml/docbook-xsl-1.69.1/" />

DOCBOOK_XSL = /usr/share/xml/docbook/stylesheet/docbook-xsl


LN = ln -s -f
RM = rm -f

XML_VALIDATE = ./xml-validate

# Basename of main document (used for default targets of common ops)

MAINDOC_BASE = xmlformat

all::
	@echo "You must say what you want to build"
	@echo "make dist-prep: build documents for distribution"
	@echo "make doc.valid: valid XML source document"
	@echo "make doc.html: generate HTML version of document"
	@echo "make doc.pdf: generate PDF version of document"

# Generate documents in output formats that are included in distributions

dist-prep::
	make xmlformat.html xmlformat.html-chunk xmlformat.pdf
	make tutorial.html tutorial.html-chunk tutorial.pdf

valid:: $(MAINDOC_BASE).valid
html:: $(MAINDOC_BASE).html
pdf:: $(MAINDOC_BASE).pdf

# reformat document
reformat::
	../xmlformat.rb -i -b.bak $(MAINDOC_BASE).xml

# show diff between old and previous versions
diff::
	-diff -u $(MAINDOC_BASE).xml.bak $(MAINDOC_BASE).xml

all:: $(OUTPUTS) 

%.html: %.xml
	xsltproc \
		--novalid \
		--param generate.section.toc.level 2 \
		--param section.autolabel 1 \
		--param section.label.includes.component.label 1 \
		--output $@ $(DOCBOOK_XSL)/html/docbook.xsl \
		$<

%.html-chunk: %.xml
	@-mkdir $@/
	xsltproc \
		--novalid \
		--param generate.section.toc.level 8 \
		--param section.autolabel 1 \
		--param section.label.includes.component.label 1 \
		--param use.id.as.filename 1 \
		--param chunk.quietly 1 \
		--param chunk.first.sections 1 \
		--param chunk.fast 1 \
		--stringparam chunker.output.encoding "utf-8" \
		--output $@/ $(DOCBOOK_XSL)/html/chunkfast.xsl \
		$<

%.txt: %.html
	lynx -dump $< > $@

# for page margins, note that you can't set left and right as they
# will be overwritten. The default value is 1in for both.

%.fo: %.xml
	xsltproc \
		--novalid \
		--param use.extensions 1 \
		--param fop1.extensions 1 \
		--param tablecolumns.extension 0 \
		--param section.autolabel 1 \
		--param section.label.includes.component.label 1 \
		--stringparam page.margin.inner "1in" \
		--stringparam page.margin.outer "1in" \
		--stringparam draft.mode "no" \
		--output $@ $(DOCBOOK_XSL)/fo/docbook.xsl \
		$<

%.pdf: %.fo
	fop -q $< $@

# reformat document
%.format:: %.xml
	../xmlformat.rb -i -b.bak $<

# show diff between old and previous versions
%.diff:: %.xml
	-diff -u $<.bak $<

# validate input files
%.valid: %.xml
	$(XML_VALIDATE) $<

clean:
	$(RM) *.fo *.pdf *.html
	$(RM) -R *.html-chunk

realclean: clean
	$(RM) *.bak