summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2018-08-07 13:09:04 +0200
committerDaniel Bevenius <daniel.bevenius@gmail.com>2018-08-10 05:38:29 +0200
commitd3d54aa8ef6e4df04507f3d3a1b891c863eb497b (patch)
tree23e1fd1290ea8ed65bcf38e95086dc657cef9354 /Makefile
parentc7962dcba46f44b888686e6a76bcc6fef2eb7760 (diff)
downloadnode-new-d3d54aa8ef6e4df04507f3d3a1b891c863eb497b.tar.gz
build: extract common parts from addon .buildstamp
This commit extracts common parts from the targets test/addons/.buildstamp, and test/addons-napi/.buildstamp to reduce some duplication. PR-URL: https://github.com/nodejs/node/pull/22171 Reviewed-By: Jon Moss <me@jonathanmoss.me>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 17 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index fc4a094656..f1242bbb30 100644
--- a/Makefile
+++ b/Makefile
@@ -333,19 +333,26 @@ ADDONS_BINDING_SOURCES := \
$(filter-out test/addons/??_*/*.cc, $(wildcard test/addons/*/*.cc)) \
$(filter-out test/addons/??_*/*.h, $(wildcard test/addons/*/*.h))
+ADDONS_PREREQS := config.gypi \
+ deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \
+ deps/uv/include/*.h deps/v8/include/*.h \
+ src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h
+
+define run_build_addons
+env npm_config_loglevel=$(LOGLEVEL) npm_config_nodedir="$$PWD" \
+ npm_config_python="$(PYTHON)" $(NODE) "$$PWD/tools/build-addons" \
+ "$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" \
+ $1
+touch $2
+endef
+
# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale.
# Depends on node-gyp package.json so that build-addons is (re)executed when
# node-gyp is updated as part of an npm update.
-test/addons/.buildstamp: config.gypi \
- deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \
+test/addons/.buildstamp: $(ADDONS_PREREQS) \
$(ADDONS_BINDING_GYPS) $(ADDONS_BINDING_SOURCES) \
- deps/uv/include/*.h deps/v8/include/*.h \
- src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \
test/addons/.docbuildstamp
- env npm_config_loglevel=$(LOGLEVEL) npm_config_nodedir="$$PWD" \
- npm_config_python="$(PYTHON)" $(NODE) "$$PWD/tools/build-addons" \
- "$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" "$$PWD/test/addons"
- touch $@
+ @$(call run_build_addons,"$$PWD/test/addons",$@)
.PHONY: build-addons
# .buildstamp needs $(NODE_EXE) but cannot depend on it
@@ -366,17 +373,10 @@ ADDONS_NAPI_BINDING_SOURCES := \
$(filter-out test/addons-napi/??_*/*.h, $(wildcard test/addons-napi/*/*.h))
# Implicitly depends on $(NODE_EXE), see the build-addons-napi rule for rationale.
-test/addons-napi/.buildstamp: config.gypi \
- deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \
+test/addons-napi/.buildstamp: $(ADDONS_PREREQS) \
$(ADDONS_NAPI_BINDING_GYPS) $(ADDONS_NAPI_BINDING_SOURCES) \
- deps/uv/include/*.h deps/v8/include/*.h \
- src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \
src/node_api.h src/node_api_types.h
- env npm_config_loglevel=$(LOGLEVEL) npm_config_nodedir="$$PWD" \
- npm_config_python="$(PYTHON)" $(NODE) "$$PWD/tools/build-addons" \
- "$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" \
- "$$PWD/test/addons-napi"
- touch $@
+ @$(call run_build_addons,"$$PWD/test/addons-napi",$@)
.PHONY: build-addons-napi
# .buildstamp needs $(NODE_EXE) but cannot depend on it