-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (56 loc) · 1.49 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
lssrc = $(shell find scripts/ -type f -name '*.ls')
jsobj = $(lssrc:.ls=.js)
packobj = app.js vendor.js
packflag = -d
csssrc = $(shell find styles/ -type f -name '*.styl')
cssobj = $(csssrc:.styl=.css)
htmlsrc = $(shell find . -maxdepth 1 -type f -name '*.pug')
htmlobj = $(htmlsrc:.pug=.html)
testsrc = $(shell find test/ -type f -name '*.ls')
testobj = $(testsrc:.ls=.js)
confsrc = $(shell find . -maxdepth 1 -type f -name '*.ls')
confobj = $(confsrc:.ls=.js)
releasedir = release/
.PHONY: all
all: compile pack
.PHONY: compile
compile: $(jsobj) $(cssobj) $(htmlobj)
.PHONY: config
config: $(confobj)
.PHONY: pack
pack: compile config
webpack --progress $(packflag)
.PHONY: release
release: packflag = -p
release: all
echo $(packflag)
mkdir -p $(releasedir)
cp --parents $(packobj) $(cssobj) $(htmlobj) $(releasedir)
cd $(releasedir); zip -r9 ../release.zip *
cd $(releasedir); tar -zcvf ../release.tar.gz *
.PHONY: watch
watch: compile config
webpack --watch &
while true; do make --quiet compile; sleep 1; done
$(packobj): compile config
webpack
$(jsobj) $(testobj) $(confobj): %.js: %.ls
lsc --no-header -pcb $< > $@
@echo -e ' \033[1;30mcompiled\033[0m $<'
$(cssobj): %.css: %.styl
stylus $<
$(htmlobj): %.html: %.pug
pug -n $@ -P $<
.PHONY: test
test: compile $(testobj)
mocha --recursive
.PHONY: clean
clean:
@rm -vf $(jsobj)
@rm -vf $(cssobj)
@rm -vf $(testobj)
@rm -vf $(htmlobj)
@rm -vf $(confobj)
@rm -vf $(packobj)
@rm -vfr $(releasedir)
@rm -vf release.zip release.tar.gz