@@ -315,25 +315,14 @@ ADDONS_BINDING_SOURCES := \ |
315 | 315 | # Depends on node-gyp package.json so that build-addons is (re)executed when |
316 | 316 | # node-gyp is updated as part of an npm update. |
317 | 317 | test/addons/.buildstamp: config.gypi \ |
318 | | - deps/npm/node_modules/node-gyp/package.json \ |
| 318 | + deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \ |
319 | 319 | $(ADDONS_BINDING_GYPS) $(ADDONS_BINDING_SOURCES) \ |
320 | 320 | deps/uv/include/*.h deps/v8/include/*.h \ |
321 | 321 | src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \ |
322 | 322 | test/addons/.docbuildstamp |
323 | | -# Cannot use $(wildcard test/addons/*/) here, it's evaluated before |
324 | | -# embedded addons have been generated from the documentation. |
325 | | -# Ignore folders without binding.gyp |
326 | | -# (https://github.com/nodejs/node/issues/14843) |
327 | | - @for dirname in test/addons/*/; do \ |
328 | | - if [ ! -f "$$PWD/$${dirname}binding.gyp" ]; then \ |
329 | | - continue; fi ; \ |
330 | | - printf "\nBuilding addon $$PWD/$$dirname\n" ; \ |
331 | | - env MAKEFLAGS="-j1" $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp \ |
332 | | - --loglevel=$(LOGLEVEL) rebuild \ |
333 | | - --python="$(PYTHON)" \ |
334 | | - --directory="$$PWD/$$dirname" \ |
335 | | - --nodedir="$$PWD" || exit 1 ; \ |
336 | | - done |
| 323 | + env npm_config_loglevel=$(LOGLEVEL) npm_config_nodedir="$$PWD" \ |
| 324 | + npm_config_python="$(PYTHON)" $(NODE) "$$PWD/tools/build-addons" \ |
| 325 | + "$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" "$$PWD/test/addons" |
337 | 326 | touch $@ |
338 | 327 |
|
339 | 328 | .PHONY: build-addons |
@@ -355,25 +344,15 @@ ADDONS_NAPI_BINDING_SOURCES := \ |
355 | 344 |
|
356 | 345 | # Implicitly depends on $(NODE_EXE), see the build-addons-napi rule for rationale. |
357 | 346 | test/addons-napi/.buildstamp: config.gypi \ |
358 | | - deps/npm/node_modules/node-gyp/package.json \ |
| 347 | + deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \ |
359 | 348 | $(ADDONS_NAPI_BINDING_GYPS) $(ADDONS_NAPI_BINDING_SOURCES) \ |
360 | 349 | deps/uv/include/*.h deps/v8/include/*.h \ |
361 | 350 | src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \ |
362 | 351 | src/node_api.h src/node_api_types.h |
363 | | -# Cannot use $(wildcard test/addons-napi/*/) here, it's evaluated before |
364 | | -# embedded addons have been generated from the documentation. |
365 | | -# Ignore folders without binding.gyp |
366 | | -# (https://github.com/nodejs/node/issues/14843) |
367 | | - @for dirname in test/addons-napi/*/; do \ |
368 | | - if [ ! -f "$$PWD/$${dirname}binding.gyp" ]; then \ |
369 | | - continue; fi ; \ |
370 | | - printf "\nBuilding addon $$PWD/$$dirname\n" ; \ |
371 | | - env MAKEFLAGS="-j1" $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp \ |
372 | | - --loglevel=$(LOGLEVEL) rebuild \ |
373 | | - --python="$(PYTHON)" \ |
374 | | - --directory="$$PWD/$$dirname" \ |
375 | | - --nodedir="$$PWD" || exit 1 ; \ |
376 | | - done |
| 352 | + env npm_config_loglevel=$(LOGLEVEL) npm_config_nodedir="$$PWD" \ |
| 353 | + npm_config_python="$(PYTHON)" $(NODE) "$$PWD/tools/build-addons" \ |
| 354 | + "$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" \ |
| 355 | + "$$PWD/test/addons-napi" |
377 | 356 | touch $@ |
378 | 357 |
|
379 | 358 | .PHONY: build-addons-napi |
|