-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathMakefile
60 lines (45 loc) · 1.46 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
# Project makefile
# working directories and files
#
TOPDIR :=$(shell pwd)
DOCS :=$(TOPDIR)/docs
BUILD :=$(TOPDIR)/build
# mkdocs configuration file
MKDOCSCFG :=_mkdocs.yml
SERVECFG :=$(TOPDIR)/$(MKDOCSCFG)
BUILDCFG :=$(BUILD)/$(MKDOCSCFG)
# sub-dir names for categoried posts
CATEGORIES :=categories
ARCHIVES :=archives
# count of latest posts show in homepage
INDEXCNT :=10
.PHONY: pre_process
pre_process:
@echo Checking and creating sub-directories...
@if [ -d "$(DOCS)/$(CATEGORIES)" ]; then rm -rf "$(DOCS)/$(CATEGORIES)" ; fi
@if [ -d "$(DOCS)/$(ARCHIVES)" ]; then rm -rf "$(DOCS)/$(ARCHIVES)" ; fi
@mkdir "$(DOCS)/$(CATEGORIES)"
@mkdir "$(DOCS)/$(ARCHIVES)"
.PHONY: copy
copy: pre_process
@if [ -d "$(BUILD)" ]; then rm -rf "$(BUILD)" ; fi
@mkdir "$(BUILD)"
@cp -rp "$(DOCS)" "$(BUILD)/"
.PHONY: serve
serve: pre_process
@echo Summarizing pages...
@cp mkdocs.yml "$(SERVECFG)"
@python run.py serve "$(SERVECFG)" $(ARCHIVES) $(CATEGORIES) $(INDEXCNT)
@mkdocs serve -f "$(SERVECFG)"
.PHONY: build
build: copy
@echo Summarizing pages...
@cp mkdocs.yml "$(BUILDCFG)"
@python run.py build "$(BUILDCFG)" $(ARCHIVES) $(CATEGORIES) $(INDEXCNT)
@mkdocs build -f "$(BUILDCFG)"
.PHONY: clean
clean:
@if [ -d "$(BUILD)" ]; then rm -rf "$(BUILD)" ; fi
@if [ -d "$(DOCS)/$(CATEGORIES)" ]; then rm -rf "$(DOCS)/$(CATEGORIES)" ; fi
@if [ -d "$(DOCS)/$(ARCHIVES)" ]; then rm -rf "$(DOCS)/$(ARCHIVES)" ; fi
@if [ -e "$(SERVECFG)" ]; then rm -rf "$(SERVECFG)" ; fi