@@ -99,28 +99,49 @@ test/gc/node_modules/weak/build/Release/weakref.node: $(NODE_EXE) |
99 | 99 | --directory="$(shell pwd)/test/gc/node_modules/weak" \ |
100 | 100 | --nodedir="$(shell pwd)" |
101 | 101 |
|
102 | | -build-addons: $(NODE_EXE) |
103 | | - rm -rf test/addons/doc-*/ |
| 102 | +# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale. |
| 103 | +test/addons/.docbuildstamp: doc/api/addons.markdown |
| 104 | + $(RM) -r test/addons/doc-*/ |
104 | 105 | $(NODE) tools/doc/addon-verify.js |
105 | | - $(foreach dir, \ |
106 | | - $(sort $(dir $(wildcard test/addons/*/*.gyp))), \ |
107 | | - $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ |
108 | | - --directory="$(shell pwd)/$(dir)" \ |
109 | | - --nodedir="$(shell pwd)" && ) echo "build done" |
| 106 | + touch $@ |
| 107 | + |
| 108 | +ADDONS_BINDING_GYPS := \ |
| 109 | + $(filter-out test/addons/doc-*/binding.gyp, \ |
| 110 | + $(wildcard test/addons/*/binding.gyp)) |
| 111 | + |
| 112 | +# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale. |
| 113 | +test/addons/.buildstamp: $(ADDONS_BINDING_GYPS) | test/addons/.docbuildstamp |
| 114 | + # Cannot use $(wildcard test/addons/*/) here, it's evaluated before |
| 115 | + # embedded addons have been generated from the documentation. |
| 116 | + for dirname in test/addons/*/; do \ |
| 117 | + $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ |
| 118 | + --directory="$$PWD/$$dirname" \ |
| 119 | + --nodedir="$$PWD"; \ |
| 120 | + done |
| 121 | + touch $@ |
| 122 | + |
| 123 | +# .buildstamp and .docbuildstamp need $(NODE_EXE) but cannot depend on it |
| 124 | +# directly because it calls make recursively. The parent make cannot know |
| 125 | +# if the subprocess touched anything so it pessimistically assumes that |
| 126 | +# .buildstamp and .docbuildstamp are out of date and need a rebuild. |
| 127 | +# Just goes to show that recursive make really is harmful... |
| 128 | +# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. |
| 129 | +build-addons: $(NODE_EXE) test/addons/.buildstamp |
110 | 130 |
|
111 | 131 | test-gc: all test/gc/node_modules/weak/build/Release/weakref.node |
112 | 132 | $(PYTHON) tools/test.py --mode=release gc |
113 | 133 |
|
114 | | -test-build: all build-addons |
| 134 | +test-build: | all build-addons |
115 | 135 |
|
116 | 136 | test-all: test-build test/gc/node_modules/weak/build/Release/weakref.node |
117 | 137 | $(PYTHON) tools/test.py --mode=debug,release |
118 | 138 |
|
119 | 139 | test-all-valgrind: test-build |
120 | 140 | $(PYTHON) tools/test.py --mode=debug,release --valgrind |
121 | 141 |
|
122 | | -test-ci: |
123 | | - $(PYTHON) tools/test.py -p tap --logfile test.tap --mode=release message parallel sequential |
| 142 | +test-ci: | build-addons |
| 143 | + $(PYTHON) tools/test.py -p tap --logfile test.tap --mode=release \ |
| 144 | + addons message parallel sequential |
124 | 145 |
|
125 | 146 | test-release: test-build |
126 | 147 | $(PYTHON) tools/test.py --mode=release |
|