forked from openresty/nginx-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ebooks.mk
69 lines (55 loc) · 1.75 KB
/
ebooks.mk
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
lang= en
lang2= en
src= en
ver= $(shell date +'%Y.%m.%d')
title= agentzh's Nginx Tutorials (ver $(ver))
name= agentzh-nginx-tutorials-$(lang)
tutfiles= $(sort $(wildcard $(src)/*.tut))
wikifiles= $(patsubst %.tut,wiki/%.wiki,$(tutfiles))
htmlfiles= $(patsubst %.tut,html/%.html,$(tutfiles))
.PHONY: all mobi epub pdf html
.PRECIOUS: $(wikifiles) $(htmlfiles)
all: mobi epub pdf html
mobi: $(name).mobi
epub: $(name).epub
pdf: $(name).pdf
html: $(name).html
%.pdf: $(name).html
cp tutorial-simple.css tutorial.css
ebook-convert $< $@ \
--margin-bottom 10 \
--margin-top 10 \
--margin-left 10 \
--margin-right 10 \
--no-chapters-in-toc \
--book-producer 'agentzh' \
--pdf-default-font-size 12 \
--pdf-mono-font-size 12 \
--paper-size a4 \
--title "$(title)" --publisher 'agentzh' \
--language $(lang2) --authors 'agentzh'
git co tutorial.css
%.mobi: $(name).html
cp tutorial-simple.css tutorial.css
ebook-convert $< $@ \
--output-profile kindle_dx --no-inline-toc \
--title "$(title)" --publisher 'agentzh' \
--language $(lang2) --authors 'agentzh'
git co tutorial.css
%.epub: $(name).html
cp tutorial-simple.css tutorial.css
ebook-convert $< $@ \
--no-default-epub-cover \
--output-profile kindle_dx \
--title "$(title)" --publisher 'agentzh' \
--language $(lang2) --authors 'agentzh'
git co tutorial.css
$(name).html: $(htmlfiles) ./utils/gen-html-index-$(lang2).pl
./utils/gen-html-index-$(lang2).pl -v $(ver) -o $@ $(htmlfiles)
html/%.html: wiki/%.wiki ./utils/wiki2html-$(lang2).pl
mkdir -p $(dir $@)
./utils/wiki2html-$(lang2).pl -o $@ $<
wiki/%.wiki: %.tut ./utils/tut2wiki-$(lang2).pl
mkdir -p $(dir $@)
./utils/tut2wiki-$(lang2).pl -o $@ $<
#test: ; echo $(htmlfiles)