summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 6447a6ffeb3d2576c419b81af424aa189615c0d5 (plain)
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
# $Id$

chapters := $(wildcard chapter_*.xml)

imgs_ps := $(wildcard ps-imgs/*.eps)
imgs_png := $(addsuffix .png,$(addprefix png/,$(basename $(notdir $(imgs_ps)))))


list_imgs:
	@echo $(imgs_ps)
	@echo $(imgs_png)

# cleaning up the voodoo a bit.
# now it matches a pattern instead of generating a bunch of rules
# -- vbatts
png/%.png: ps-imgs/%.eps .convert
	mkdir -p $(CWD)png && \
	convert -channel RGBA -density 196 $< -resample 72 -geometry 800x600 -trim +repage -flatten $@

dummy:
	convert $(2) -geometry 800x600 -quality 100 -depth 24 -weight 10 -render -flatten $(1)

images: $(imgs_ps)

#book.html: build.sh main.xml $(chapters) $(imgs_png) .clean.html
book.html: build.sh main.xml $(chapters) $(imgs_png)
	sh build.sh && \
	ls -l $@

book.pdf: main.xml $(chapters) $(imgs_png) .dblatex .clean.pdf
	dblatex \
		--pdf \
		-x'-xinclude' \
		-o $@ \
		$<

view.pdf: book.pdf
	xdg-open $<

view.html: book.html
	xdg-open $< || links $<

.PHONY: view
view: view.html

.convert:
	@which convert 2>/dev/null >/dev/null || echo "ERROR: 'convert' REQUIRED, this is in imagemagick" && touch $@

.dblatex:
	@which dblatex 2>/dev/null >/dev/null || echo "ERROR: 'dblatex' REQUIRED, SEE http://github.com/vbatts/SlackBuilds/ FOR THE SlackBuild" && touch $@


.PHONY: .clean.html
.clean.html:
	rm -f book.html

.PHONY: .clean.pdf
.clean.pdf:
	rm -f book.pdf

.PHONY: .clean.stuff
.clean.stuff:
	rm -fr .convert .dblatex

.PHONY: .clean.images
.clean.images:
	rm -fr png/

.PHONY: dist-clean clean
dist-clean: clean .clean.images .clean.stuff

clean: .clean.pdf .clean.html 
	

.DEFAULT_GOAL := book.html