-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
199 lines (161 loc) · 4.68 KB
/
Makefile
File metadata and controls
199 lines (161 loc) · 4.68 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
SHELL := $(shell which bash) -eu -o pipefail -c
export PATH := $(abspath tools/bin):$(PATH)
export PROJDIR := $(abspath .)
BUILD_TARGETS := $(addprefix build-,\
webui \
)
CODEGEN_PATHS := \
bins/estree \
libs/htmltokenizer \
libs/htmlparser \
libs/jsparser \
libs/jsruntime \
libs/layout
UPDATE_PATHS := \
libs/jsruntime
CLEAN_TARGETS := $(addprefix clean-,\
$(CODEGEN_PATHS) \
webui \
)
CODEGEN_TARGETS := $(addprefix codegen-,\
$(CODEGEN_PATHS) \
)
UPDATE_TARGETS := $(addprefix update-,\
$(UPDATE_PATHS) \
)
.PHONY: all
all: build
.PHONY: list-targets
list-targets:
@grep -E '^\.PHONY: ' $(MAKEFILE_LIST) | cut -d ' ' -f 2 | grep -v '^\$$' | sort
.PHONY: check
check: check-rust check-js check-github-actions
.PHONY: check-rust
check-rust:
cargo fmt --all --check
cargo check --workspace --all-targets --all-features
cargo clippy --workspace --all-targets --all-features -- -D warnings
.PHONY: check-js
# TODO
check-js:
.PHONY: check-github-actions
check-github-actions:
zizmor -p .github
.PHONY: pin
pin: pin-github-actions
.PHONY: pin-github-actions
pin-github-actions:
pinact run
.PHONY: build
build: OPTIONS ?=
build: $(BUILD_TARGETS)
cargo build $(OPTIONS)
.PHONY: test
test: OPTIONS ?= --all-features
test: TESTNAME ?=
test:
cargo nextest run $(OPTIONS) $(TESTNAME)
.PHONY: test262
test262: PROFILE ?= release
test262: ARGS ?= --progress
test262: OOP ?=
test262:
ifdef OOP
cargo build --bin=bjs --profile=$(PROFILE) --all-features
cargo run -r --bin=test262 --all-features -- --test262-dir=vendor/src/tc39/test262 $(ARGS) launch -- /bin/sh bins/test262/launchers/bjs.sh --profile $(PROFILE) >test262.json
else
cargo run --bin=test262 --profile=$(PROFILE) --all-features -- --test262-dir=vendor/src/tc39/test262 $(ARGS) run >test262.json
endif
# DO NOT REMOVE '-'.
# Continue the execution in order to generate the report even if test commands fail.
# TODO(test): Add test cases for jsruntime.
.PHONY: coverage
coverage: LLVM_COV_ARGS ?= --html
coverage: TEST262_ARGS ?=
coverage:
cargo llvm-cov clean --workspace
cargo llvm-cov nextest --no-report --all-features
-sh bins/estree/scripts/test262_parser_tests.sh --profile=coverage $(TEST262_ARGS)
-sh bins/estree/scripts/test262.sh --profile=coverage $(TEST262_ARGS)
cargo llvm-cov report $(LLVM_COV_ARGS)
# TODO(test): Very slow...
# This takes nearly an hour on a high performance PC.
# This takes several hours in the GitHub Actions.
.PHONY: coverage-jsruntime
coverage-jsruntime: LLVM_COV_ARGS ?= --html
coverage-jsruntime: TEST262_ARGS ?=
coverage-jsruntime:
cargo llvm-cov clean --workspace
cargo llvm-cov run --bin=test262 --no-report --all-features -- --test262-dir=vendor/src/tc39/test262 $(TEST262_ARGS) run >/dev/null
cargo llvm-cov report $(LLVM_COV_ARGS)
.PHONY: bench
bench: OPTIONS ?=
bench: BENCHNAME ?=
bench:
cargo bench $(OPTIONS) $(BENCHNAME)
.PHONY: clean
clean: $(CLEAN_TARGETS)
cargo clean --profile=dev
cargo clean --profile=release
cargo clean --profile=release-lto
cargo clean --profile=release-symbols
.PHONY: clean-all
clean-all: $(CLEAN_TARGETS)
cargo clean
# The order must be determined by dependencies between packages.
.PHONE: codegen
codegen:
@$(MAKE) -s codegen-libs/htmltokenizer
@$(MAKE) -s codegen-libs/htmlparser
@$(MAKE) -s codegen-libs/jsparser
@$(MAKE) -s codegen-libs/jsruntime
@$(MAKE) -s codegen-libs/layout
@$(MAKE) -s codegen-bins/estree
.PHONY: update
update:
@$(MAKE) -s update-libs/jsruntime
.PHONY: update-deps
update-deps: update-deps-crates update-deps-deno
# Specify `CARGO_REGISTRIES_CRATES_IO_PROTOCOL=git` if `make update-deps-crates` gets stuck.
# Perform `cargo update` after `cargo upgrade` in order to update `Cargo.lock`.
.PHONY: update-deps-crates
update-deps-crates:
cargo upgrade -i allow
cargo update
.PHONY: update-deps-deno
update-deps-deno:
@deno upgrade
@deno task update
@deno eval "console.log('deno', Deno.version.deno)" >.tool-versions
.PHONY: update-devcontainer
update-devcontainer:
@sh tools/bin/update_devcontainer_dockerfile.sh -c
.PHONY: doc
doc:
cargo doc --workspace --all-features --document-private-items
.PHONY: format
format: format-rust format-js
.PHONY: format-rust
format-rust:
@echo 'Formatting *.rs...'
@cargo fmt --all
.PHONY: format-js
format-js:
@echo 'Formatting *.js...'
@deno fmt -q 2>/dev/null
.PHONY: vendor
vendor:
@$(MAKE) -s -C vendor clean
@$(MAKE) -s -C vendor install
.PHONY: $(BUILD_TARGETS)
$(BUILD_TARGETS):
@$(MAKE) -s -C $(subst build-,,$@) build
.PHONY: $(CODEGEN_TARGETS)
$(CODEGEN_TARGETS):
@$(MAKE) -s -C $(subst codegen-,,$@) codegen
.PHONY: $(UPDATE_TARGETS)
$(UPDATE_TARGETS):
@$(MAKE) -s -C $(subst update-,,$@) update
.PHONY: $(CLEAN_TARGETS)
$(CLEAN_TARGETS):
@$(MAKE) -s -C $(subst clean-,,$@) clean