-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
106 lines (83 loc) · 2.34 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#########
# prelude
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := build
.DELETE_ON_ERROR:
.SUFFIXES:
#######################
# environment variables
CAPNP_BIN := capnp
TAP_FLAGS ?= -j8 --no-coverage --ts -Rterse -c
TAP_TS := 1
TSC_FLAGS ?=
STANDARD_FLAGS ?= --dry-run
##############
# binary paths
capnpc := $(shell which capnpc)
node := $(shell which node)
node_bin := node_modules/.bin
tsc := $(node_bin)/tsc $(TSC_FLAGS)
tap := $(node_bin)/tap $(TAP_FLAGS)
eslint := $(node_bin)/eslint
standard := $(node_bin)/standard-version $(STANDARD_FLAGS)
npm := $(shell which npm)
######
# vars
capnp_ts := packages/capnp-ts
capnpc_ts := packages/capnpc-ts
js_examples := packages/js_examples
capnp_deps := $(shell find packages/capnp-ts/src -name '*.ts' -not -name '*.d.ts' -print)
capnp_deps := $(capnp_deps) $(shell find packages/capnpc-ts/src -name '*.ts' -not -name '*.d.ts' -print)
specs_in := $(shell find packages -name '*.spec.ts' -print)
specs_out := $(patsubst %.ts,%.js,$(specs_in))
capnp_in := $(shell find packages -name '*.capnp' -print)
capnp_out := $(patsubst %.capnp,%.capnp.js,$(capnp_in))
################
# build commands
%.capnp.js: $(capnp_deps)
%.capnp.js: %.capnp
$(capnpc) -o./$(capnpc_ts)/bin/capnpc-ts.js -I $(capnp_ts)/src/std $<
.PHONY: benchmark
benchmark: build
benchmark:
$(node) $(capnp_ts)/benchmark/index.js
@echo
.PHONY: build-prelude
build-prelude:
$(tsc) -p tsconfig.prelude.json
.PHONY: build-src
build-src: build-prelude
$(tsc) -p tsconfig.src.json
.PHONY: build-capnp
build-capnp: build-src
build-capnp: $(capnp_out)
.PHONY: build-test
build-test: build-capnp
$(tsc) -p tsconfig.test.json
.PHONY: build
build: build-test
.PHONY: clean
clean:
@find packages -name "*.d.ts" -not -path "*/node_modules/*" | xargs -r rm
@find packages -name "*.js" -not -path "*/bin/*" -not -path "*/node_modules/*" | xargs -r rm
@find packages -name "*.map" -not -path "*/node_modules/*" | xargs -r rm
@find packages -name "*.tsbuildinfo" -not -path "*/node_modules/*" | xargs -r rm
@rm -f $(capnp_out)
.PHONY: test
test: build
@$(tap) $(specs_out)
.PHONY: coverage
coverage: build
@$(tap) --coverage $(specs_in)
.PHONY: lint
lint: build
$(eslint) . --ext .ts
.PHONY: release
release: build
$(standard)
.PHONY: publish
publish:
$(npm) publish -w capnp-ts
$(npm) publish -w capnpc-ts