-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathMakefile
96 lines (75 loc) · 2.38 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
88
89
90
91
92
93
94
95
96
default: all
SRC = $(wildcard src/*.coffee | sort)
LIB = $(SRC:src/%.coffee=lib/%.js) lib/parser.js
BOOTSTRAPS = $(SRC:src/%.coffee=lib/bootstrap/%.js) lib/bootstrap/parser.js
LIBMIN = $(LIB:lib/%.js=lib/%.min.js)
TEST = $(wildcard test/*.coffee | sort)
ROOT = $(shell pwd)
EMBER_SCRIPT = ./bin/ember-script --js --bare
COFFEE = node_modules/.bin/coffee --js --bare
PEGJS = node_modules/.bin/pegjs --cache --export-var 'module.exports'
MOCHA = node_modules/.bin/mocha --compilers em:./register -u tdd
CJSIFY = node_modules/.bin/cjsify --export EmberScript
MINIFIER = node_modules/.bin/esmangle
all: $(LIB) dist/ember-script.js
build: all
parser: lib/parser.js
#browser: dist/ember-script.min.js
browser: dist/ember-script.js
min: minify
minify: $(LIBMIN)
# TODO: test-browser
# TODO: doc
# TODO: bench
lib:
mkdir lib/
lib/bootstrap: lib
mkdir -p lib/bootstrap
lib/parser.js: src/grammar.pegjs bootstraps lib
$(PEGJS) <"$<" >"[email protected]" && mv "[email protected]" "$@"
lib/bootstrap/parser.js: src/grammar.pegjs lib/bootstrap
$(PEGJS) <"$<" >"$@"
lib/bootstrap/%.js: src/%.coffee lib/bootstrap
$(COFFEE) -i "$<" >"$@"
bootstraps: $(BOOTSTRAPS) lib/bootstrap
cp lib/bootstrap/* lib
lib/%.js: src/%.coffee lib/bootstrap/%.js bootstraps lib
$(COFFEE) -i "$<" >"[email protected]" && mv "[email protected]" "$@"
dist:
mkdir dist/
dist/ember-script.js: lib/browser.js dist
$(CJSIFY) src/browser.coffee -vx EmberScript \
-a fs: -a child_process: \
-a /src/register.coffee: \
-a /src/parser.coffee:/lib/parser.js \
-h .coffee:coffee-script-redux \
--source-map "[email protected]" > "$@"
dist/ember-script.min.js: lib/browser.js dist
$(CJSIFY) src/browser.coffee -vmx EmberScript \
-a fs: -a child_process: \
-a /src/register.coffee: \
-a /src/parser.coffee:/lib/parser.js \
-h .coffee:coffee-script-redux \
--source-map "[email protected]" > "$@"
lib/%.min.js: lib/%.js lib/coffee-script
$(MINIFIER) <"$<" >"$@"
.PHONY: default all build parser browser min minify test coverage install loc clean
test:
$(MOCHA) -R dot test/*.em
# TODO: use Constellation/ibrik for coverage
coverage:
@which jscoverage || (echo "install node-jscoverage"; exit 1)
rm -rf instrumented
jscoverage -v lib instrumented
$(MOCHA) -R dot
$(MOCHA) -r instrumented/compiler -R html-cov > coverage.html
@xdg-open coverage.html &> /dev/null
install:
npm install -g .
loc:
wc -l src/*
clean:
rm -rf instrumented
rm -f coverage.html
rm -rf lib/coffee-script
rm -rf dist