@@ -234,6 +234,18 @@ ADDONS_BINDING_SOURCES := \
234
234
$(filter-out test/addons/??_* /* .cc, $(wildcard test/addons/* /* .cc) ) \
235
235
$(filter-out test/addons/??_* /* .h, $(wildcard test/addons/* /* .h) )
236
236
237
+ define test_addons
238
+ @for dirname in $(1 ) /*/; do \
239
+ printf "\nBuilding addon $$PWD/$$dirname\n" ; \
240
+ env MAKEFLAGS="-j1" $(NODE ) deps/npm/node_modules/node-gyp/bin/node-gyp \
241
+ --loglevel=$(LOGLEVEL ) rebuild \
242
+ --python="$(PYTHON ) " \
243
+ --directory="$$PWD/$$dirname" \
244
+ --nodedir="$$PWD" || exit 1 ; \
245
+ done
246
+ touch $(2 )
247
+ endef
248
+
237
249
# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale.
238
250
# Depends on node-gyp package.json so that build-addons is (re)executed when
239
251
# node-gyp is updated as part of an npm update.
@@ -243,17 +255,7 @@ test/addons/.buildstamp: config.gypi \
243
255
deps/uv/include/* .h deps/v8/include/* .h \
244
256
src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \
245
257
test/addons/.docbuildstamp
246
- # Cannot use $(wildcard test/addons/*/) here, it's evaluated before
247
- # embedded addons have been generated from the documentation.
248
- @for dirname in test/addons/*/; do \
249
- printf "\nBuilding addon $$PWD/$$dirname\n" ; \
250
- env MAKEFLAGS="-j1" $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp \
251
- --loglevel=$(LOGLEVEL) rebuild \
252
- --python="$(PYTHON)" \
253
- --directory="$$PWD/$$dirname" \
254
- --nodedir="$$PWD" || exit 1 ; \
255
- done
256
- touch $@
258
+ $(call test_addons, $(@D ) , $@ )
257
259
258
260
# .buildstamp and .docbuildstamp need $(NODE_EXE) but cannot depend on it
259
261
# directly because it calls make recursively. The parent make cannot know
@@ -278,17 +280,7 @@ test/addons-napi/.buildstamp: config.gypi \
278
280
deps/uv/include/* .h deps/v8/include/* .h \
279
281
src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h \
280
282
src/node_api.h src/node_api_types.h
281
- # Cannot use $(wildcard test/addons-napi/*/) here, it's evaluated before
282
- # embedded addons have been generated from the documentation.
283
- @for dirname in test/addons-napi/*/; do \
284
- printf "\nBuilding addon $$PWD/$$dirname\n" ; \
285
- env MAKEFLAGS="-j1" $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp \
286
- --loglevel=$(LOGLEVEL) rebuild \
287
- --python="$(PYTHON)" \
288
- --directory="$$PWD/$$dirname" \
289
- --nodedir="$$PWD" || exit 1 ; \
290
- done
291
- touch $@
283
+ $(call test_addons, $(@D ) , $@ )
292
284
293
285
# .buildstamp and .docbuildstamp need $(NODE_EXE) but cannot depend on it
294
286
# directly because it calls make recursively. The parent make cannot know
0 commit comments