-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (42 loc) · 1.15 KB
/
Makefile
File metadata and controls
56 lines (42 loc) · 1.15 KB
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
default: all
pug = $(shell find src -type f -name "*.pug")
html = $(pug:src/%.pug=lib/%.html)
pugc = node_modules/.bin/pug
styl = $(shell find src -type f -name "*.styl")
css = $(styl:src/%.styl=lib/%.css)
stylus = node_modules/.bin/stylus
ls = $(shell find src -type f -name "*.ls")
js = $(ls:src/%.ls=lib/%.js)
lsc = node_modules/.bin/lsc
webpack = node_modules/.bin/webpack
lib/%.html: src/%.pug
mkdir -p $(shell dirname "$@")
$(pugc) -P < "$<" > "$@"
@echo "--> compiled $<"
lib/%.css: src/%.styl
mkdir -p $(shell dirname "$@")
$(stylus) -p -o lib "$<" > "$@"
@echo "--> compiled $<"
lib/%.js: src/%.ls
mkdir -p $(shell dirname "$@")
$(lsc) --no-header -p -b -c "$<" > "$@"
@echo "--> compiled $<"
webpack.config.js:
$(lsc) --no-header -p -b -c webpack.config.ls > webpack.config.js
.PHONY: all
all: compile pack
.PHONY: compile
compile: $(html) $(css) $(js)
.PHONY: pack
pack: webpack.config.js
${webpack}
.PHONY: run
run: all
xdg-open lib/index.html
.PHONY: watch
watch: webpack.config.js compile
${webpack} --watch &
while true; do make --silent compile || notify-send -a make "make failed"; sleep 1; done
.PHONY: clean
clean:
@rm -vrf lib