~antpeter/ubuntu-desktop-course/ubuntu-desktop-course-russian-antpeter

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
# 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 -Ichapter2 -Ichapter3 -Ichapter4 -Ichapter5 -Ichapter6 -Ichapter7 -Ichapter8 -Ichapter9 -Ichapter10
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 --stringparam profile.userlevel instructor -o tmp-$@.xml $(CURDIR)/lib/instructorguide.xsl $<
	@$(DBLATEX) $(DBLATEXOPTS) -tpdf -o $@ tmp-$@.xml
	@rm -f tmp-$@.xml

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

book: 
	@$(XSLTPROC) --xinclude --stringparam profile.userlevel student -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
	@ps2pdf -dUseFlateCompression=true $(BOOK).pdf
	@mv $(BOOK).pdf.pdf $(BOOK).pdf

booksg: 
	@$(XSLTPROC) --xinclude --stringparam profile.userlevel student -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
	@ps2pdf -dUseFlateCompression=true $(BOOK)$(SGSUFFIX).pdf
	@mv $(BOOK)$(SGSUFFIX).pdf.pdf $(BOOK)$(SGSUFFIX).pdf

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
	@ps2pdf -dUseFlateCompression=true $(BOOK)$(QUESTIONSUFFIX).pdf
	@mv $(BOOK)$(QUESTIONSUFFIX).pdf.pdf $(BOOK)$(QUESTIONSUFFIX).pdf

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

#.PHONY: $(DIRTARGETS)