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: nodejs#29995
Fixes: nodejs/build#1961
Refs: nodejs@53ca0b9#commitcomment-35494896
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
  • Loading branch information
Gabriel Schulhof committed Oct 22, 2019
1 parent d9174b4 commit 4d29011
Showing 1 changed file with 14 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

0 comments on commit 4d29011

Please sign in to comment.