Skip to content

Commit 0ab3962

Browse files
committed
added Makefile.
1 parent 2c0adc5 commit 0ab3962

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

Makefile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
2+
JS = build/acorn.player.js
3+
4+
CSS = build/acorn.player.css
5+
6+
JS_SRC = $(shell find coffee | grep .coffee | sed 's/coffee\//build\/js-compiled\//g' | sed 's/\.coffee/\.js/g' )
7+
8+
9+
all: build
10+
11+
.PHONY: clean test watch
12+
13+
test:
14+
# probably broken?
15+
@npm test
16+
17+
clean:
18+
rm -rf -- build
19+
20+
21+
# css
22+
build/acorn.player.css: less/acorn-player.less
23+
@mkdir -p `dirname $@`
24+
@rm -f $@
25+
node_modules/.bin/lessc $< $@
26+
27+
build/acorn.player.min.css: build/acorn.player.css
28+
@mkdir -p `dirname $@`
29+
@rm -f $@
30+
cat $< | node_modules/.bin/cssmin > $@
31+
32+
33+
# coffee
34+
build/js-compiled/%.js: coffee/%.coffee
35+
@mkdir -p `dirname $@`
36+
@rm -f $@
37+
node_modules/.bin/coffee -b -p -c $< > $@
38+
39+
40+
# js
41+
build/acorn.player.js: $(JS_SRC) package.json
42+
#: $(shell node_modules/.bin/smash --list build/js-compiled/src/)
43+
# use JS_SRC here because the index.js (for smash --list) is an intermediate
44+
# file, which gets constructed.
45+
@mkdir -p `dirname $@`
46+
@rm -f $@
47+
node_modules/.bin/smash build/js-compiled/src/ | node_modules/.bin/uglifyjs - -b indent-level=2 -o $@
48+
49+
50+
# minification
51+
build/%.min.js: build/%.js
52+
@mkdir -p `dirname $@`
53+
@rm -f $@
54+
node_modules/.bin/uglifyjs $< > $@
55+
56+
57+
# build
58+
build: build/acorn.player.min.js build/acorn.player.min.css
59+
60+
61+
# dist
62+
dist: build
63+
cp -r $< $@
64+
65+
66+
# serve
67+
serve:
68+
@echo "Serving static files..."
69+
@node_modules/.bin/http-server -p 8000
70+
71+
# watching
72+
watch:
73+
@echo "Serving static files..."
74+
@node_modules/.bin/http-server -p 8000 &
75+
@echo "Watching files for changes..."
76+
@watchr -e "watch('(less|coffee|lib)\/.*\.(less|coffee|css)') { system 'make' }"
77+

0 commit comments

Comments
 (0)