~ricardo-cropalato/ubuntu-desktop-course/ubuntu-desktop-course-pt-br-ricardo-cropalato

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
# This is an example Makefile for converting the docbook XML to 
# PDF and HTML.


# This is quite a hack, a patch that integrates the call of the 
# top level Makefile is welcome.

ifeq ($(CURDIR)x,x)
	CURDIR = $(shell pwd)
endif

BOOK = desktop-course-book
SGSUFFIX = -studentguide
QUESTIONSUFFIX = -questions

IGXSL = $(CURDIR)/lib/instructorguide.xsl
SGXSL = $(CURDIR)/lib/studentguide.xsl

TEXSTYLE = -s $(CURDIR)/lib/training.sty
#TEXSTYLE = -T $(CURDIR)/lib/training.sty

DIRTARGETS = $(addsuffix stamp,$(wildcard */))
HTMLTARGETS = $(addsuffix .html,$(basename $(wildcard *.xml))) 
PDFTARGETS = $(addsuffix .pdf,$(basename $(wildcard *.xml))) 


all: $(DIRTARGETS) $(HTMLTARGETS) $(PDFTARGETS)

XSLTPROC = /usr/bin/xsltproc
DBLATEX = /usr/bin/dblatex
DBLATEXOPTS = $(TEXSTYLE) -p $(CURDIR)/lib/dblatex.xsl -Ichapter1 -Ichapter3 -Ichapter4 -Ichapter5 -Ichapter6 -Ichapter7 -Ichapter8 -Ichapter9 -Ichapter10 -Ichapter11 
XSL ?= $(CURDIR)/lib/html.xsl

%/stamp: %/
	@$(MAKE) CURDIR=$(CURDIR) XSL=$(XSL) -f $(CURDIR)/Makefile -C $<

# If you need to specify a custom XSL here, dblatex accepts the -p switch
%.pdf: %.xml 
	@$(XSLTPROC) --xinclude -o tmp-$@.xml $(CURDIR)/lib/instructorguide.xsl $<
	@$(DBLATEX) $(DBLATEXOPTS) -tpdf -o $@ tmp-$@.xml
	@rm -f tmp-$@.xml

%.html: %.xml $(XSL)
	@$(XSLTPROC) -o - $(IGXSL) $< | $(XSLTPROC) -o $@ $(XSL) -

book: 
	@$(XSLTPROC) --xinclude -o tmp-ig.xml $(CURDIR)/lib/instructorguide.xsl $(BOOK).xml
	@$(DBLATEX) -p$(CURDIR)/lib/dblatex.xsl $(DBLATEXOPTS) -tpdf -o $(BOOK).pdf tmp-ig.xml
	@rm -f tmp-ig.xml

booksg: 
	@$(XSLTPROC) --xinclude -o tmp-sg.xml $(CURDIR)/lib/studentguide.xsl $(BOOK).xml
	@$(DBLATEX) -p$(CURDIR)/lib/dblatex.xsl $(DBLATEXOPTS) -tpdf -o $(BOOK)$(SGSUFFIX).pdf tmp-sg.xml
	@rm -f tmp-sg.xml

questions:
	@$(XSLTPROC) --xinclude -o tmp-questions.xml $(CURDIR)/lib/answersheet.xsl $(BOOK).xml 
	@$(XSLTPROC) --xinclude -o tmp-answers.xml $(CURDIR)/lib/questions.xsl tmp-questions.xml
	@$(DBLATEX) -p$(CURDIR)/lib/dblatex.xsl $(DBLATEXOPS) -tpdf -o $(BOOK)$(QUESTIONSUFFIX).pdf tmp-answers.xml
	@rm -f tmp-answers.xml tmp-questions.xml

clean:
	 @rm -f ig.xml sg.xml *.html *.pdf tmp-*.xml */tmp-*.xml */*.html */*.pdf

#.PHONY: $(DIRTARGETS)