/
Makefile
61 lines (50 loc) 路 1.39 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
PREFIX=./node_modules/.bin
SELF=$(lastword $(MAKEFILE_LIST))
## Compiler
# The compiler to use for the ES7 -> ES5 transformation
JC=$(PREFIX)/babel
# Location of files
SRC=src/
OUT=dist/
# The flags to pass to the compiler
JCFLAGS=$(SRC) -d $(OUT)
# The binary files to copy
BIN=cli/cheddar
EXE=cheddar
BIN_MAKE=$(foreach BIN_FILE,$(BIN),chmod 755 $(SRC)$(BIN_FILE) && cp $(SRC)$(BIN_FILE) $(OUT)$(BIN_FILE)${\n})
## Tests
TESTRUNNER=$(PREFIX)/babel-node
COVERAGE=$(PREFIX)/babel-istanbul
TEST=$(PREFIX)/_mocha
TFLAGS=cover $(TEST)
BENCHMARK=benchmark/
## Rules
all: default
# The default task
# The **production** build
default: $(JC)
NODE_ENV=production $(JC) $(JCFLAGS) --minified --compact true
$(BIN_MAKE)
# Development build task
# This builds and includes source maps
build: $(JC)
$(JC) $(JCFLAGS) --source-maps
$(BIN_MAKE)
# Runs install with default method
# Perhaps pass args later?
install: ./bin/install
./bin/install --method=path
# Runs browser_repl build for web REPL
# Uses browserify to compiled babelified code
# browser_build: $(JC)
# $(PREFIX)/browserify dist/cli/browser_repl.js -o Cheddar.js
# Performs testing, including coverage
# At the moment uses mocha for testing
# and babel-istanbul for coverage
test: $(TESTRUNNER) $(COVERAGE) $(TEST)
$(TESTRUNNER) $(COVERAGE) $(TFLAGS)
benchmark: $(BENCHMARK) $(OUT)
node $(BENCHMARK)
clean: $(OUT)
rm -rf $(OUT)
.PHONY: test benchmark clean