Commit 3cac7b92c82 for nodejs
commit 3cac7b92c82fdb8c8d6af012cc3c6a6949d79166
Author: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
Date: Mon Nov 23 10:51:49 2026 -0300
build: re-run configure to regenerate out/Makefile
The out/Makefile rule runs gyp directly, without -Dconfiguring_node=1
and the other arguments configure.py passes. After a gyp file or
configure.py changes, the makefiles lose -fPIE and -pie, every object
is rebuilt, and node is only a PIE if the compiler defaults to it.
config.status writes config.gypi and out/Makefile together, so list
the gyp files under config.gypi and have out/Makefile depend on it
alone. out/Makefile only re-runs config.status itself when it is
missing or not newer than config.gypi, as after make clean. Building
through make with --ninja now also regenerates build.ninja after a
gyp change.
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67534
Refs: https://github.com/nodejs/node/pull/67386
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
diff --git a/Makefile b/Makefile
index cd732faeec2..5c1cdda8614 100644
--- a/Makefile
+++ b/Makefile
@@ -180,16 +180,26 @@ endif
with-code-cache test-code-cache:
$(warning '$@' target is a noop)
-out/Makefile: config.gypi common.gypi node.gyp \
+# config.status writes out/Makefile together with config.gypi, but make may
+# still see out/Makefile as stale right after that. Rerun it only when
+# out/Makefile is missing (as after `make clean`) or not newer. Shells with
+# whole-second -nt then rerun on a tie instead of leaving it stale.
+out/Makefile: config.gypi
+ @if [ "$@" -nt "$<" ]; then :; \
+ elif [ -x config.status ]; then \
+ export PATH="$(NO_BIN_OVERRIDE_PATH)" && ./config.status; \
+ else \
+ echo Missing or stale $@, please run ./configure; \
+ exit 1; \
+ fi
+
+# node_version.h is listed because the N-API version is taken from there
+# and included in config.gypi
+config.gypi: configure configure.py src/node_version.h common.gypi node.gyp \
deps/*/*.gyp \
tools/v8_gypfiles/toolchain.gypi \
tools/v8_gypfiles/features.gypi \
tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
- $(PYTHON) tools/gyp_node.py -f make -Dpython=$(PYTHON)
-
-# node_version.h is listed because the N-API version is taken from there
-# and included in config.gypi
-config.gypi: configure configure.py src/node_version.h
@if [ -x config.status ]; then \
export PATH="$(NO_BIN_OVERRIDE_PATH)" && ./config.status; \
else \