2014-04-14 20:45:36 +00:00
|
|
|
SHELL=/bin/bash
|
|
|
|
VOC=voc
|
2016-09-22 17:42:47 +00:00
|
|
|
TARGET=cptable.js
|
|
|
|
AUXTARGETS=cputils.js cpexcel.js sbcs.js
|
2016-10-15 06:09:05 +00:00
|
|
|
DISTFULL=cpexcel sbcs cptable
|
|
|
|
CMDS=bin/codepage.njs
|
|
|
|
|
|
|
|
ULIB=$(shell echo $(LIB) | tr a-z A-Z)
|
2014-04-14 20:45:36 +00:00
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
## Main Targets
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: voc ## Build library and auxiliary scripts
|
|
|
|
|
|
|
|
.PHONY: voc
|
2014-04-14 20:45:36 +00:00
|
|
|
voc test.js: codepage.md
|
|
|
|
$(VOC) codepage.md
|
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
.PHONY: js
|
|
|
|
js: make.sh codepage.md ## Build all output targets
|
2014-04-14 20:45:36 +00:00
|
|
|
bash make.sh <(awk -F, '$$3=="1"' pages.csv) sbcs.js cptable
|
|
|
|
bash make.sh excel.csv cpexcel.js cptable
|
|
|
|
bash make.sh
|
2016-09-22 17:42:47 +00:00
|
|
|
make cputils.js
|
2014-04-14 20:45:36 +00:00
|
|
|
|
2016-10-15 06:09:05 +00:00
|
|
|
cputils.js: cputils.flow.js
|
2016-09-22 17:42:47 +00:00
|
|
|
node -e 'process.stdout.write(require("fs").readFileSync("$<","utf8").replace(/^[ \t]*\/\*[:#][^*]*\*\/[ \t]*(\n)?/gm,"").replace(/\/\*[:#][^*]*\*\//gm,""))' > $@
|
2014-04-14 20:45:36 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
2016-09-22 17:42:47 +00:00
|
|
|
clean: ## Remove targets and build artifaats
|
2016-01-16 03:27:02 +00:00
|
|
|
rm -f make.sh .vocrc pages.csv bits/*.js
|
2014-04-14 20:45:36 +00:00
|
|
|
|
2016-10-15 06:09:05 +00:00
|
|
|
.PHONY: dist
|
|
|
|
dist: $(TARGET) $(AUXTARGETS) ## Copy files for distribution
|
2016-09-22 17:42:47 +00:00
|
|
|
cp $(TARGET) $(AUXTARGETS) LICENSE dist/
|
2017-03-10 21:26:53 +00:00
|
|
|
for i in $(DISTFULL); do cat $$i.js cputils.js | sed "s#require('./cptable')#cptable#" > dist/$$i.full.js; done
|
2014-04-14 20:45:36 +00:00
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
## Testing
|
2014-06-26 05:54:13 +00:00
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
.PHONY: test mocha
|
|
|
|
test mocha: test.js $(TARGET) baseline ## Run test suite
|
|
|
|
mocha -R spec -t 20000
|
2014-04-14 20:45:36 +00:00
|
|
|
|
2014-06-27 13:43:31 +00:00
|
|
|
.PHONY: ctest
|
2016-09-22 17:42:47 +00:00
|
|
|
ctest: ## Build browser test (into ctest/ subdirectory)
|
2014-06-27 13:43:31 +00:00
|
|
|
bash ctest/fixtures.sh
|
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
.PHONY: ctestserv
|
|
|
|
ctestserv: ## Start a test server on port 8000
|
2016-10-15 06:09:05 +00:00
|
|
|
@cd ctest && python -mSimpleHTTPServer
|
2016-09-22 17:42:47 +00:00
|
|
|
|
|
|
|
.PHONY: baseline
|
|
|
|
baseline: ## Build test baselines
|
|
|
|
@bash ./misc/make_baseline.sh
|
|
|
|
|
2016-10-15 06:09:05 +00:00
|
|
|
.PHONY: clean-baseline
|
|
|
|
clean-baseline: ## Remove test baselines
|
|
|
|
@bash ./misc/make_baseline.sh clean
|
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
## Code Checking
|
2014-04-14 20:45:36 +00:00
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
.PHONY: lint
|
|
|
|
lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
|
|
|
|
@jshint --show-non-errors $(TARGET) $(AUXTARGETS)
|
2016-10-15 06:09:05 +00:00
|
|
|
@jshint --show-non-errors $(CMDS)
|
2016-09-22 17:42:47 +00:00
|
|
|
@jshint --show-non-errors package.json
|
|
|
|
@jshint --show-non-errors --extract=always $(HTMLLINT)
|
|
|
|
@jscs $(TARGET) $(AUXTARGETS)
|
|
|
|
|
|
|
|
.PHONY: flow
|
|
|
|
flow: lint ## Run flow checker
|
|
|
|
@flow check --all --show-all-errors
|
|
|
|
|
|
|
|
.PHONY: cov
|
|
|
|
cov: misc/coverage.html ## Run coverage test
|
|
|
|
|
|
|
|
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: prof
|
|
|
|
prof:
|
|
|
|
cat misc/prof.js test.js > prof.js
|
|
|
|
node --prof prof.js
|
2014-04-14 20:45:36 +00:00
|
|
|
|
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
@grep -hE '(^[a-zA-Z_-][ a-zA-Z_-]*:.*?|^#[#*])' $(MAKEFILE_LIST) | bash misc/help.sh
|
2014-04-22 23:02:59 +00:00
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
#* To show a spinner, append "-spin" to any target e.g. cov-spin
|
|
|
|
%-spin:
|
|
|
|
@make $* & bash misc/spin.sh $$!
|