forked from sebasmagri/the-little-mongodb-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (38 loc) · 1.2 KB
/
Makefile
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
SOURCE_FILE_NAME = mongodb.markdown
BOOK_FILE_NAME = mongodb
PDF_BUILDER = pandoc
PDF_BUILDER_FLAGS = \
--latex-engine xelatex \
--template ../common/pdf-template.tex \
--listings
EPUB_BUILDER = pandoc
EPUB_BUILDER_FLAGS = \
--epub-cover-image
MOBI_BUILDER = kindlegen
PO4A_COMMON_FLAGS ?= \
-f text \
-M UTF-8 \
-m en/mongodb.markdown
%/:
[ -d $* ] || mkdir $*
%/mongodb.markdown: %/ locale/%/mongodb.po
po4a-translate ${PO4A_COMMON_FLAGS} -p locale/$*/mongodb.po -l $*/mongodb.markdown
%/mongodb.pdf: %/mongodb.markdown
cd $* && $(PDF_BUILDER) $(PDF_BUILDER_FLAGS) $(SOURCE_FILE_NAME) -o $(BOOK_FILE_NAME).pdf
%/title.png: %/
[ -f $*/title.png ] || cp en/title.png $*/
%/title.txt: %/
[ -f $*/title.txt ] || cp en/title.txt $*/
%/mongodb.epub: %/title.png %/title.txt %/mongodb.markdown
$(EPUB_BUILDER) $(EPUB_BUILDER_FLAGS) $^ -o $@
%/mongodb.mobi: %/mongodb.epub
$(MOBI_BUILDER) $^
createpo:
mkdir locale/${LANG} && po4a-gettextize ${PO4A_COMMON_FLAGS} -p locale/${LANG}/mongodb.po
updatepo:
po4a-updatepo ${PO4A_COMMON_FLAGS} -p locale/${LANG}/mongodb.po
clean:
rm -f */$(BOOK_FILE_NAME).pdf
rm -f */$(BOOK_FILE_NAME).epub
rm -f */$(BOOK_FILE_NAME).mobi
.PHONY: createpo updatepo clean