-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
87 lines (70 loc) · 2.66 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
79
80
81
82
83
84
85
86
87
PY=python3
PELICAN?=pelican
PELICANOPTS?=
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
VERSIONFILE=$(BASEDIR)/content/rootpath/version
OUTPUTDIR=$(BASEDIR)/output
COMMONJS=${OUTPUTDIR}/assets/js/common.js
NODEJSDIR=$(BASEDIR)/bitbiliNewTheme
CONFFILE=$(BASEDIR)/pelicanconf.py
CONFFILETEST=$(BASEDIR)/pelicanconf_test.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
PUBLISHCONFTEST=$(BASEDIR)/publishconf_test.py
help:
@echo 'Makefile for a pelican Web site '
@echo ' '
@echo 'Usage: '
@echo ' make clean remove the generated files '
@echo ' make cleanout remove the output dir '
@echo ' make publish generate using production settings '
@echo ' make publishtest generate using test-production settings '
@echo ' '
rmdrafts:
[ ! -d content/drafts ] || rm -rf content/drafts
cleanout:
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)/*
clean:
[ ! -d $(OUTPUTDIR) ] || find $(OUTPUTDIR) -not -type d -not -wholename "*/.git*" -not -iname "*.pdf" -not -wholename "*/fa/*.svg" -not -wholename "*/cc/*.png" -delete
templ:
cd $(NODEJSDIR) && \
yarn run prepareDist
css: templ
cd $(NODEJSDIR) && \
yarn run minifyCSS
js: css
cd $(NODEJSDIR) && \
yarn run doWebpack
hashversion:
$(BASEDIR)/hashversion.sh $(VERSIONFILE) $(COMMONJS)
sw:
cd $(NODEJSDIR) && \
yarn run generateSW
cp -a $(NODEJSDIR)/dist/assets/js/sw.js $(OUTPUTDIR)/
cp -a $(NODEJSDIR)/dist/assets/js/sw.js $(OUTPUTDIR)/service-worker.js
rsthtml:
(cd $(OUTPUTDIR) && find -iname "*.rst" | parallel -I@ pygmentize -f html -o @.html @)
copy_static:
cp -a $(INPUTDIR)/assets $(OUTPUTDIR)/
cp -a $(INPUTDIR)/demos $(OUTPUTDIR)/
cp -a $(INPUTDIR)/images $(OUTPUTDIR)/
cp -a $(INPUTDIR)/mis $(OUTPUTDIR)/
cp -a $(INPUTDIR)/nocimages $(OUTPUTDIR)/
cp -a $(INPUTDIR)/rootpath/* $(OUTPUTDIR)/
publishtest: rmdrafts cleanout js
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONFTEST) $(PELICANOPTS)
$(MAKE) rsthtml
$(MAKE) copy_static
publishtest-sw: rmdrafts cleanout js
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONFTEST) $(PELICANOPTS)
$(MAKE) rsthtml
$(MAKE) hashversion
$(MAKE) sw
$(MAKE) copy_static
publish: rmdrafts cleanout js
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
$(MAKE) rsthtml
$(MAKE) hashversion
$(MAKE) sw
$(MAKE) copy_static
.PHONY: html help clean cleanout publish publishtest rmdrafts rsthtml css js hashversion