Skip to content

Commit

Permalink
build: build benchmark addons like test addons
Browse files Browse the repository at this point in the history
Build the addons for benchmarks in the same way that the addons for
tests are built.

PR-URL: #29995
Fixes: nodejs/build#1961
Refs: 53ca0b9#commitcomment-35494896
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Beth Griggs <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
  • Loading branch information
richardlau authored and targos committed Nov 10, 2019
1 parent 94ac44f commit a1adce1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
36 changes: 14 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -347,24 +347,6 @@ test-valgrind: all
test-check-deopts: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential

benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node: \
benchmark/napi/function_call/napi_binding.c \
benchmark/napi/function_call/binding.cc \
benchmark/napi/function_call/binding.gyp | all
$(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
--python="$(PYTHON)" \
--directory="$(shell pwd)/benchmark/napi/function_call" \
--nodedir="$(shell pwd)"

benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node: \
benchmark/napi/function_args/napi_binding.c \
benchmark/napi/function_args/binding.cc \
benchmark/napi/function_args/binding.gyp | all
$(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
--python="$(PYTHON)" \
--directory="$(shell pwd)/benchmark/napi/function_args" \
--nodedir="$(shell pwd)"

DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.js doc/api/addons.md

ifeq ($(OSTYPE),aix)
Expand Down Expand Up @@ -470,6 +452,17 @@ test/node-api/.buildstamp: $(ADDONS_PREREQS) \
# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
build-node-api-tests: | $(NODE_EXE) test/node-api/.buildstamp

BENCHMARK_NAPI_BINDING_GYPS := $(wildcard benchmark/napi/*/binding.gyp)

BENCHMARK_NAPI_BINDING_SOURCES := \
$(wildcard benchmark/napi/*/*.c) \
$(wildcard benchmark/napi/*/*.cc) \
$(wildcard benchmark/napi/*/*.h)

benchmark/napi/.buildstamp: $(ADDONS_PREREQS) \
$(BENCHMARK_NAPI_BINDING_GYPS) $(BENCHMARK_NAPI_BINDING_SOURCES)
@$(call run_build_addons,"$$PWD/benchmark/napi",$@)

.PHONY: clear-stalled
clear-stalled:
@echo "Clean up any leftover processes but don't error if found."
Expand Down Expand Up @@ -1163,13 +1156,12 @@ bench: bench-addons-build

# Build required addons for benchmark before running it.
.PHONY: bench-addons-build
bench-addons-build: benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node \
benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node
bench-addons-build: | $(NODE_EXE) benchmark/napi/.buildstamp

.PHONY: bench-addons-clean
bench-addons-clean:
$(RM) -r benchmark/napi/function_call/build
$(RM) -r benchmark/napi/function_args/build
$(RM) -r benchmark/napi/*/build
$(RM) benchmark/napi/.buildstamp

.PHONY: lint-md-rollup
lint-md-rollup:
Expand Down
1 change: 1 addition & 0 deletions benchmark/napi/ref/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/

0 comments on commit a1adce1

Please sign in to comment.