2014-04-14 20:45:36 +00:00
|
|
|
SHELL=/bin/bash
|
2017-06-13 07:24:04 +00:00
|
|
|
LIB=codepage
|
2014-04-14 20:45:36 +00:00
|
|
|
VOC=voc
|
2016-09-22 17:42:47 +00:00
|
|
|
TARGET=cptable.js
|
|
|
|
AUXTARGETS=cputils.js cpexcel.js sbcs.js
|
2021-07-29 21:10:04 +00:00
|
|
|
DISTFULL_A=cpexcel sbcs
|
|
|
|
DISTFULL_B=cptable
|
2022-02-12 03:40:10 +00:00
|
|
|
DISTFULL_M=cpexcel
|
2021-07-29 21:10:04 +00:00
|
|
|
CMDS=
|
|
|
|
#DISTBITS=iso2022.js
|
|
|
|
DISTBITS=
|
2016-10-15 06:09:05 +00:00
|
|
|
|
|
|
|
ULIB=$(shell echo $(LIB) | tr a-z A-Z)
|
2017-06-13 07:24:04 +00:00
|
|
|
FLOWTARGET=cptable.js
|
|
|
|
CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar
|
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
|
2021-07-29 21:10:04 +00:00
|
|
|
voc: codepage.md
|
|
|
|
@make js
|
|
|
|
#$(VOC) codepage.md
|
2014-04-14 20:45:36 +00:00
|
|
|
|
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
|
2021-07-29 21:10:04 +00:00
|
|
|
bash make.sh pages.csv cptable.js cptable
|
2022-02-12 03:40:10 +00:00
|
|
|
bash make_esm.sh excel.csv cpexcel.mjs
|
2021-07-29 21:10:04 +00:00
|
|
|
#node iso2022/make_iso2022.njs > iso2022.js
|
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
|
2017-06-13 07:24:04 +00:00
|
|
|
clean: ## Remove targets and build artifacts
|
2021-07-29 21:10:04 +00:00
|
|
|
rm -f 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/
|
2021-07-29 21:10:04 +00:00
|
|
|
for i in $(DISTFULL_A); do cat $$i.js cputils.js | sed "s#require('./cptable')#cptable#" > dist/$$i.full.js; done
|
|
|
|
for i in $(DISTFULL_B); do cat $$i.js $(DISTBITS) cputils.js | sed "s#require('./cptable')#cptable#" > dist/$$i.full.js; done
|
2022-02-12 03:40:10 +00:00
|
|
|
for i in $(DISTFULL_M); do cat $$i.mjs cputils.mjs | sed "s#require('./cptable')#cptable#" > dist/$$i.full.mjs; 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
|
2021-07-29 21:10:04 +00:00
|
|
|
test mocha: $(TARGET) baseline ## Run test suite
|
2022-02-12 03:40:10 +00:00
|
|
|
./node_modules/.bin/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
|
2024-04-15 02:24:58 +00:00
|
|
|
@cd cteset && python -mSimpleHTTPServer || python3 -mhttp.server || npx -y http-server -p 8000 .
|
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
|
|
|
|
2018-01-18 22:47:47 +00:00
|
|
|
.PHONY: fullint
|
|
|
|
fullint: lint old-lint tslint flow mdlint ## Run all checks
|
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
.PHONY: lint
|
2017-06-13 07:24:04 +00:00
|
|
|
lint: $(TARGET) $(AUXTARGETS) ## Run eslint checks
|
2021-07-29 21:10:04 +00:00
|
|
|
@eslint --ext .js,.njs,.json,.html,.htm $(TARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json
|
2017-06-13 07:24:04 +00:00
|
|
|
if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi
|
|
|
|
|
|
|
|
.PHONY: old-lint
|
|
|
|
old-lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
|
2016-09-22 17:42:47 +00:00
|
|
|
@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)
|
2017-06-13 07:24:04 +00:00
|
|
|
if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi
|
|
|
|
|
2018-01-18 22:47:47 +00:00
|
|
|
.PHONY: tslint
|
|
|
|
tslint: $(TARGET) ## Run typescript checks
|
|
|
|
#@npm install dtslint typescript
|
|
|
|
#@npm run-script dtslint
|
|
|
|
dtslint types
|
2016-09-22 17:42:47 +00:00
|
|
|
|
|
|
|
.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
|
|
|
|
|
2018-01-18 22:47:47 +00:00
|
|
|
MDLINT=README.md codepage.md
|
|
|
|
.PHONY: mdlint
|
|
|
|
mdlint: $(MDLINT) ## Check markdown documents
|
|
|
|
alex $^
|
|
|
|
mdspell -a -n -x -r --en-us $^
|
|
|
|
|
2016-09-22 17:42:47 +00:00
|
|
|
.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 $$!
|