-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (46 loc) · 1.48 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
# OS Specific
# set default shell to cmd.exe, fixing git-shell issues with gnu-make.
ifeq ($(OS), Windows_NT)
SHELL = C:\Windows\SysWOW64\cmd.exe
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OPEN_BROWSER := chromium-browser
endif
ifeq ($(UNAME_S),Darwin)
OPEN_BROWSER += open
endif
endif
LS = node_modules/livescript
LSC = node_modules/".bin"/lsc
MOCHA = node_modules/".bin"/mocha
_MOCHA = node_modules/".bin"/_mocha
BRSIFY = node_modules/".bin"/browserify
UGLIFY = node_modules/".bin"/uglifyjs
MKDIRP = node_modules/".bin"/mkdirp
ISTNBL = node_modules/".bin"/istanbul
MOCHAF = -u tdd -R min -t 5000 --compilers ls:$(LS) -r "./test-runner.ls" -c -S -b --recursive --inline-diffs
LS_SRC = $(shell find src -maxdepth 1 -name "*.ls" -type f | sort)
LS_DIST = $(LS_SRC:src/%.ls=lib/%.js)
BR_DIST = browser/prelude.js browser/prelude.min.js
build: prepare $(LS_DIST) $(BR_DIST)
prepare:
@$(MKDIRP) lib browser
test: build
@$(ISTNBL) cover $(_MOCHA) -- $(MOCHAF)
clean:
@rm -rf lib
@rm -rf browser
@sleep .1 # wait for editor to refresh the file tree.......
init:
@rm -rf none_modules/
@npm install
report: test
@$(OPEN_BROWSER) coverage/lcov-report/index.html > /dev/null 2>&1
.PHONY: build prepare test clean init report
lib/%.js: src/%.ls
$(LSC)$(if $(RELEASE),, --map linked) --bare -o "$(shell dirname $@)" -c "$<"
browser/%.js: lib/%.js
$(BRSIFY) -r "./$<:prelude" > "$@"
browser/%.min.js: browser/%.js
$(UGLIFY) "./$<" --mangle --comments "none" > "$@"