2016-01-16 18:47:42 +00:00
|
|
|
LIB=vdc
|
|
|
|
REQS=
|
|
|
|
ADDONS=
|
|
|
|
AUXTARGETS=
|
2016-09-24 18:53:39 +00:00
|
|
|
HTMLLINT=index.html
|
2013-12-14 07:43:55 +00:00
|
|
|
|
2016-01-16 18:47:42 +00:00
|
|
|
ULIB=$(shell echo $(LIB) | tr a-z A-Z)
|
|
|
|
DEPS=
|
|
|
|
TARGET=$(LIB).js
|
2016-09-24 18:53:39 +00:00
|
|
|
FLOWTARGET=$(LIB).flow.js
|
|
|
|
|
|
|
|
## Main Targets
|
2013-12-14 07:43:55 +00:00
|
|
|
|
2016-01-16 18:47:42 +00:00
|
|
|
.PHONY: all
|
2016-09-24 18:53:39 +00:00
|
|
|
all: $(TARGET) $(AUXTARGETS) ## Build library and auxiliary scripts
|
2013-12-14 07:43:55 +00:00
|
|
|
|
2016-01-16 18:47:42 +00:00
|
|
|
$(TARGET) $(AUXTARGETS): %.js : %.flow.js
|
2016-09-24 18:53:39 +00:00
|
|
|
node -e 'process.stdout.write(require("fs").readFileSync("$<","utf8").replace(/^[ \t]*\/\*[:#][^*]*\*\/\s*(\n)?/gm,"").replace(/\/\*[:#][^*]*\*\//gm,""))' > $@
|
2013-12-14 07:43:55 +00:00
|
|
|
|
2016-01-16 18:47:42 +00:00
|
|
|
.PHONY: clean
|
2016-09-24 18:53:39 +00:00
|
|
|
clean: clean-baseline ## Remove targets and build artifacts
|
2016-01-16 18:47:42 +00:00
|
|
|
rm -f $(TARGET)
|
2013-12-14 07:43:55 +00:00
|
|
|
|
2016-09-24 18:53:39 +00:00
|
|
|
## Testing
|
|
|
|
|
2016-01-16 18:47:42 +00:00
|
|
|
.PHONY: test mocha
|
2016-09-24 18:53:39 +00:00
|
|
|
test mocha: test.js $(TARGET) baseline ## Run test suite
|
2016-01-16 18:47:42 +00:00
|
|
|
mocha -R spec -t 20000
|
2013-12-14 07:43:55 +00:00
|
|
|
|
2016-09-24 18:53:39 +00:00
|
|
|
.PHONY: baseline
|
|
|
|
baseline: ## Build test baselines
|
|
|
|
@bash ./misc/make_baseline.sh
|
|
|
|
|
|
|
|
.PHONY: clean-baseline
|
|
|
|
clean-baseline: ## Remove test baselines
|
|
|
|
rm -f test_files/*.*
|
|
|
|
|
|
|
|
## Code Checking
|
|
|
|
|
2016-01-16 18:47:42 +00:00
|
|
|
.PHONY: lint
|
2016-09-24 18:53:39 +00:00
|
|
|
lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
|
|
|
|
@jshint --show-non-errors $(TARGET) $(AUXTARGETS)
|
|
|
|
@jshint --show-non-errors package.json
|
|
|
|
@jshint --show-non-errors --extract=always $(HTMLLINT)
|
|
|
|
@jscs $(TARGET) $(AUXTARGETS)
|
2013-12-14 07:43:55 +00:00
|
|
|
|
2016-01-16 18:47:42 +00:00
|
|
|
.PHONY: flow
|
2016-09-24 18:53:39 +00:00
|
|
|
flow: lint ## Run flow checker
|
|
|
|
@flow check --all --show-all-errors
|
2016-01-16 18:47:42 +00:00
|
|
|
|
2016-09-24 18:53:39 +00:00
|
|
|
.PHONY: cov
|
|
|
|
cov: misc/coverage.html ## Run coverage test
|
2013-12-14 07:43:55 +00:00
|
|
|
|
2016-09-24 18:53:39 +00:00
|
|
|
misc/coverage.html: $(TARGET) test.js
|
|
|
|
mocha --require blanket -R html-cov -t 20000 > $@
|
|
|
|
|
|
|
|
.PHONY: coveralls
|
|
|
|
coveralls: ## Coverage Test + Send to coveralls.io
|
|
|
|
mocha --require blanket --reporter mocha-lcov-reporter -t 20000 | node ./node_modules/coveralls/bin/coveralls.js
|
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
@grep -hE '(^[a-zA-Z_-][ a-zA-Z_-]*:.*?|^#[#*])' $(MAKEFILE_LIST) | bash misc/help.sh
|
|
|
|
|
|
|
|
#* To show a spinner, append "-spin" to any target e.g. cov-spin
|
|
|
|
%-spin:
|
|
|
|
@make $* & bash misc/spin.sh $$!
|