-
Notifications
You must be signed in to change notification settings - Fork 111
/
Makefile
89 lines (69 loc) · 2.23 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
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)
COFFEE = bin/coffee --js --bare
PEGJS = node_modules/.bin/pegjs --cache --plugin ./lib/pegjs-coffee-plugin
MOCHA = node_modules/.bin/mocha --compilers coffee:./register -u tdd
CJSIFY = node_modules/.bin/cjsify --export CoffeeScript
MINIFIER = node_modules/.bin/esmangle
all: $(LIB)
build: all
parser: lib/parser.js
browser: dist/coffee-script-redux.min.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.pegcoffee bootstraps lib lib/pegjs-coffee-plugin.js
$(PEGJS) <"$<" >"[email protected]" && mv "[email protected]" "$@"
lib/bootstrap/parser.js: src/grammar.pegcoffee lib/bootstrap lib/pegjs-coffee-plugin.js
$(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/coffee-script-redux.js: lib/browser.js dist
$(CJSIFY) src/browser.coffee -vx CoffeeScript \
-a /src/register.coffee: \
-a /src/parser.coffee:/lib/parser.js \
--source-map "[email protected]" > "$@"
dist/coffee-script-redux.min.js: lib/browser.js dist
$(CJSIFY) src/browser.coffee -vmx CoffeeScript \
-a /src/register.coffee: \
-a /src/parser.coffee:/lib/parser.js \
--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/*.coffee
# 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
rm -rf dist