forked from tangrams/tangram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
66 lines (50 loc) · 2.11 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
# Binaries
UGLIFY = ./node_modules/.bin/uglifyjs
KARMA = ./node_modules/karma/bin/karma
JSHINT = ./node_modules/.bin/jshint
DEREQUIRE = ./node_modules/.bin/derequire
# Build debug and minified libraries
all: \
dist/tangram.min.js \
dist/tangram.debug.js
debug: dist/tangram.debug.js
dist/tangram.debug.js: .npm src/gl/shader_sources.js $(shell ./build_deps.sh)
node build.js --debug=true --require './src/module.js' --runtime | $(DEREQUIRE) > dist/tangram.debug.js
dist/tangram.min.js: dist/tangram.debug.js
$(UGLIFY) dist/tangram.debug.js -c warnings=false -m -o dist/tangram.min.js
@gzip dist/tangram.min.js -c | wc -c | awk '{ printf "%.0fk minified+gzipped\n", $$1 / 1024 }'
# Process shaders into strings and export as a module
src/gl/shader_sources.js: $(shell find src/ -name '*.glsl')
bash ./build_shaders.sh > src/gl/shader_sources.js
### Tests
# Run lint
lint: .npm
$(JSHINT) `find src/ -name '*.js'`
$(JSHINT) `find test/ -name '*.js'`
# Test-specific builds of the library
build-testable: lint dist/tangram.debug.js
node build.js --debug=true --require './src/module.js' --runtime > dist/tangram.test-worker.js
node build.js --debug=true --all './test/*.js' --runtime > dist/tangram.test.js
# Do a single test run, locally (opens browser, runs test, closes browser)
test: build-testable
$(KARMA) start --browsers Chrome --single-run
# Do a single test run, remotely (currently, Sauce Labs via CircleCI, w/custom Firefox on Windows profile)
test-ci: build-testable
$(KARMA) start --browsers SL_Firefox --single-run
# Start a karma browser and leave it open, useful for doing multiple test runs during development,
# without the browser setup/teardown time.
karma-start: .npm
$(KARMA) start --browsers Chrome --no-watch
# Do a single test run for a karma browser already started with `make karma-start`
run-tests: build-testable
$(KARMA) run --browsers Chrome
### Maintenance
# An attempt to get make to treat npm as a dependency
.npm: package.json
npm install
touch .npm
# Clean all artifacts
clean:
rm -f dist/*
rm -f src/gl/shader_sources.js
.PHONY : clean all test lint build-testable karma-start run-tests