summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2025-12-17 13:51:12 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2025-12-17 14:49:32 -0500
commit656de67d5c8cd894eeda0baa618663098dce17f2 (patch)
tree1d157fff08f05fed5173f83cf0c1217d0e9e6c66
parentef3ac3e68c20276eed3de756c1260f43d94746d3 (diff)
JITs: Pass down GNU make jobserver resources when appropriate
To fix warnings from rustc on e.g. Make 4.3, which is in Ubuntu 24.04: > warning: failed to connect to jobserver from environment variable
-rw-r--r--defs/jit.mk11
-rw-r--r--yjit/yjit.mk4
-rw-r--r--zjit/zjit.mk4
3 files changed, 12 insertions, 7 deletions
diff --git a/defs/jit.mk b/defs/jit.mk
index e893098ca2..42b56c4cd9 100644
--- a/defs/jit.mk
+++ b/defs/jit.mk
@@ -1,4 +1,9 @@
# Make recipes that deal with the rust code of YJIT and ZJIT.
+#
+# $(gnumake_recursive) adds the '+' prefix to pass down GNU make's
+# jobserver resources to cargo/rustc as rust-lang.org recommends.
+# Without it, certain make version trigger a warning. It does not
+# add the prefix when `make --dry-run` so dry runs are indeed dry.
ifneq ($(JIT_CARGO_SUPPORT),no)
@@ -25,7 +30,7 @@ $(RUST_LIB): $(srcdir)/ruby.rs
elif [ '$(YJIT_SUPPORT)' != no ]; then \
echo 'building YJIT ($(JIT_CARGO_SUPPORT) mode)'; \
fi
- +$(Q)CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \
+ $(gnumake_recursive)$(Q)CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \
CARGO_TERM_PROGRESS_WHEN='never' \
MACOSX_DEPLOYMENT_TARGET=11.0 \
$(CARGO) $(CARGO_VERBOSE) build --manifest-path '$(top_srcdir)/Cargo.toml' $(CARGO_BUILD_ARGS)
@@ -34,7 +39,7 @@ else ifneq ($(strip $(RLIB_DIR)),) # combo build
$(RUST_LIB): $(srcdir)/ruby.rs
$(ECHO) 'building $(@F)'
- $(Q) $(RUSTC) --edition=2024 \
+ $(gnumake_recursive)$(Q) $(RUSTC) --edition=2024 \
'-L$(@D)' \
--extern=yjit \
--extern=zjit \
@@ -50,7 +55,7 @@ $(YJIT_RLIB): $(JIT_RLIB)
$(ZJIT_RLIB): $(JIT_RLIB)
$(JIT_RLIB):
$(ECHO) 'building $(@F)'
- $(Q) $(RUSTC) --crate-name=jit \
+ $(gnumake_recursive)$(Q) $(RUSTC) --crate-name=jit \
--edition=2024 \
$(JIT_RUST_FLAGS) \
'--out-dir=$(@D)' \
diff --git a/yjit/yjit.mk b/yjit/yjit.mk
index 22d256fee7..21fd96514b 100644
--- a/yjit/yjit.mk
+++ b/yjit/yjit.mk
@@ -18,14 +18,14 @@ ifneq ($(strip $(YJIT_LIBS)),)
yjit-libs: $(BUILD_YJIT_LIBS)
$(BUILD_YJIT_LIBS): $(YJIT_SRC_FILES)
$(ECHO) 'building Rust YJIT (release mode)'
- $(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
+ $(gnumake_recursive)$(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
else ifneq ($(strip $(RLIB_DIR)),) # combo build
# Absolute path to avoid VPATH ambiguity
YJIT_RLIB = $(TOP_BUILD_DIR)/$(RLIB_DIR)/libyjit.rlib
$(YJIT_RLIB): $(YJIT_SRC_FILES)
$(ECHO) 'building $(@F)'
- $(Q) $(RUSTC) '-L$(@D)' --extern=jit $(YJIT_RUSTC_ARGS)
+ $(gnumake_recursive)$(Q) $(RUSTC) '-L$(@D)' --extern=jit $(YJIT_RUSTC_ARGS)
$(RUST_LIB): $(YJIT_RLIB)
endif # ifneq ($(strip $(YJIT_LIBS)),)
diff --git a/zjit/zjit.mk b/zjit/zjit.mk
index 2116775a91..58b45d8787 100644
--- a/zjit/zjit.mk
+++ b/zjit/zjit.mk
@@ -22,14 +22,14 @@ BUILD_ZJIT_LIBS = $(TOP_BUILD_DIR)/$(ZJIT_LIBS)
ifneq ($(strip $(ZJIT_LIBS)),)
$(BUILD_ZJIT_LIBS): $(ZJIT_SRC_FILES)
$(ECHO) 'building Rust ZJIT (release mode)'
- $(Q) $(RUSTC) $(ZJIT_RUSTC_ARGS)
+ $(gnumake_recursive)$(Q) $(RUSTC) $(ZJIT_RUSTC_ARGS)
else ifneq ($(strip $(RLIB_DIR)),) # combo build
# Absolute path to avoid VPATH ambiguity
ZJIT_RLIB = $(TOP_BUILD_DIR)/$(RLIB_DIR)/libzjit.rlib
$(ZJIT_RLIB): $(ZJIT_SRC_FILES)
$(ECHO) 'building $(@F)'
- $(Q) $(RUSTC) '-L$(@D)' --extern=jit $(ZJIT_RUSTC_ARGS)
+ $(gnumake_recursive)$(Q) $(RUSTC) '-L$(@D)' --extern=jit $(ZJIT_RUSTC_ARGS)
$(RUST_LIB): $(ZJIT_RLIB)
endif # ifneq ($(strip $(ZJIT_LIBS)),)