-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEManual.mk
56 lines (41 loc) · 1.09 KB
/
EManual.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
MAKEFILE_VERSION=2
SOURCE=./source
SOURCE_CONFIG_FILE=$(SOURCE)/book.json
TMP_BOOK=./book
DEST=./dist
IGNORE=.git
EXT_LICENSE=./_license
EXT_CONFIG=./_config
EXT_CONFIG_FILES=$(EXT_CONFIG)/*.json
default: main
-@echo "=================="
-@echo " Build Success! "
-@echo "=================="
init:
-rm -rf dist
pre-build:
cp -r $(SOURCE) $(TMP_BOOK)
rm -rf $(TMP_BOOK)/$(IGNORE)
# create book.json
gitbook-ext jsonmerge $(SOURCE_CONFIG_FILE) $(EXT_CONFIG_FILES) > $(TMP_BOOK)/book.json
build:
gitbook build $(TMP_BOOK) $(DEST)/book
gitbook-ext minify --verbose $(DEST)/book
package:
cp $(TMP_BOOK)/book.json $(DEST)/book
cp -rf $(EXT_LICENSE) $(DEST)/book/_license
cd $(DEST) && zip -vr book.zip book/
# post package
md5 $(DEST)/book.zip > $(DEST)/md5
finish:
# clean up
rm -rf $(TMP_BOOK)
main: init pre-build build package finish
deploy:
git push origin gh-pages
update-source:
git submodule update --remote $(SOURCE)
serve:
@echo "serve on ~> http://localhost:8000"
cd $(DEST)/book && python -m SimpleHTTPServer 8000
.PHONY: default main init pre-build build package finish