forked from alchemy-fr/Phraseanet-Docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (60 loc) · 2.29 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# MakeFile for building all the docs at once.
# Inspired by the Makefile used by bazaar.
# http://bazaar.launchpad.net/~bzr-pqm/bzr/2.3/
#
# All credits for this multilingual builder to the CakePHP Team
# see https://github.com/cakephp/docs
PYTHON = python
.PHONY: all clean html latexpdf epub htmlhelp website website-dirs
# Languages that can be built.
LANGS = fr en
DEST = website
# Dependencies to perform before running other builds.
# Clone the en/Makefile everywhere.
SPHINX_DEPENDENCIES = $(foreach lang, $(LANGS), $(lang)/Makefile)
# Copy-paste the french Makefile everwhere its needed.
%/Makefile: fr/Makefile
cp $< $@
#
# The various formats the documentation can be created in.
#
# Loop over the possible languages and call other build targets.
#
html: $(foreach lang, $(LANGS), html-$(lang))
cp -f _templates/index.php _build/html/index.php
cp -f _templates/.htaccess _build/html/.htaccess
cp -Rf _templates/lib _build/lib
htmlstrict: $(foreach lang, $(LANGS), htmlstrict-$(lang))
cp -f _templates/index.php _build/html/index.php
cp -f _templates/.htaccess _build/html/.htaccess
cp -Rf _templates/lib _build/lib
htmlhelp: $(foreach lang, $(LANGS), htmlhelp-$(lang))
epub: $(foreach lang, $(LANGS), epub-$(lang))
htmlhelp: $(foreach lang, $(LANGS), htmlhelp-$(lang))
# Make the HTML version of the documentation with correctly nested language folders.
html-%: $(SPHINX_DEPENDENCIES)
cd $* && make html LANG=$*
htmlstrict-%: $(SPHINX_DEPENDENCIES)
cd $* && make htmlstrict LANG=$*
htmlhelp-%: $(SPHINX_DEPENDENCIES)
cd $* && make htmlhelp LANG=$*
epub-%: $(SPHINX_DEPENDENCIES)
cd $* && make epub LANG=$*
latexpdf-%: $(SPHINX_DEPENDENCIES)
cd $* && make latexpdf LANG=$*
website-dirs:
# Make the directory if its not there already.
[ ! -d $(DEST) ] && mkdir $(DEST) || true
# Make the downloads directory
[ ! -d $(DEST)/_downloads ] && mkdir $(DEST)/_downloads || true
# Make downloads for each language
$(foreach lang, $(LANGS), [ ! -d $(DEST)/_downloads/$(lang) ] && mkdir $(DEST)/_downloads/$(lang) || true;)
website: website-dirs html epub
# Move HTML
$(foreach lang, $(LANGS), cp -r build/html/$(lang) $(DEST)/$(lang);)
# Move EPUB files
$(foreach lang, $(LANGS), cp -r build/epub/$(lang)/*.epub $(DEST)/_downloads/$(lang);)
clean:
rm -rf _build/*
clean-website:
rm -rf $(DEST)/*