forked from jstat/jstat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (43 loc) · 1.21 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
NODE_PATH ?= ./node_modules
DIST_DIR = ./dist
JS_COMPILER = $(NODE_PATH)/uglify-js/bin/uglifyjs
JS_TESTER = $(NODE_PATH)/vows/bin/vows
DOC_DIR = doc
BUILD_DIR = build
DOC_LIST = `ls $(DOC_DIR)/md/`
JS_ENGINE ?= $(shell which node nodejs 2>/dev/null | grep -Po -m 1 "(.+?)$$")
all: clean core doc
clean:
@echo 'Cleaning up build files'
@rm -rf dist
core: jstat.js jstat.min.js
jstat.js: \
src/core.js \
src/vector.js \
src/special.js \
src/distribution.js \
src/linearalgebra.js \
src/test.js
@echo 'Building jStat'
@mkdir -p $(DIST_DIR)
@cat $^ > $(DIST_DIR)/$@
jstat.min.js: jstat.js
@echo 'Minifying jStat'
@$(JS_COMPILER) < $(DIST_DIR)/$< > $(DIST_DIR)/$@
doc:
@echo 'Generating documentation'
@mkdir -p $(DIST_DIR)/docs/assets
@cp $(DOC_DIR)/assets/*.css $(DIST_DIR)/docs/assets/
@cp $(DOC_DIR)/assets/*.js $(DIST_DIR)/docs/assets/
@for i in $(DOC_LIST); do \
$(JS_ENGINE) $(BUILD_DIR)/doctool.js $(DOC_DIR)/assets/template.html $(DOC_DIR)/md/$${i} $(DIST_DIR)/docs/$${i%.*}.html; \
done
jstat: jstat.js
install:
@echo 'Downloading necessary libraries for build'
@mkdir -p node_modules
@npm install
test: clean core
@echo 'Running jStat unit tests'
@$(JS_TESTER)
.PHONY: clean core doc install test