Skip to content

Commit 656de67

Browse files
committed
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
1 parent ef3ac3e commit 656de67

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

defs/jit.mk

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Make recipes that deal with the rust code of YJIT and ZJIT.
2+
#
3+
# $(gnumake_recursive) adds the '+' prefix to pass down GNU make's
4+
# jobserver resources to cargo/rustc as rust-lang.org recommends.
5+
# Without it, certain make version trigger a warning. It does not
6+
# add the prefix when `make --dry-run` so dry runs are indeed dry.
27

38
ifneq ($(JIT_CARGO_SUPPORT),no)
49

@@ -25,7 +30,7 @@ $(RUST_LIB): $(srcdir)/ruby.rs
2530
elif [ '$(YJIT_SUPPORT)' != no ]; then \
2631
echo 'building YJIT ($(JIT_CARGO_SUPPORT) mode)'; \
2732
fi
28-
+$(Q)CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \
33+
$(gnumake_recursive)$(Q)CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \
2934
CARGO_TERM_PROGRESS_WHEN='never' \
3035
MACOSX_DEPLOYMENT_TARGET=11.0 \
3136
$(CARGO) $(CARGO_VERBOSE) build --manifest-path '$(top_srcdir)/Cargo.toml' $(CARGO_BUILD_ARGS)
@@ -34,7 +39,7 @@ else ifneq ($(strip $(RLIB_DIR)),) # combo build
3439

3540
$(RUST_LIB): $(srcdir)/ruby.rs
3641
$(ECHO) 'building $(@F)'
37-
$(Q) $(RUSTC) --edition=2024 \
42+
$(gnumake_recursive)$(Q) $(RUSTC) --edition=2024 \
3843
'-L$(@D)' \
3944
--extern=yjit \
4045
--extern=zjit \
@@ -50,7 +55,7 @@ $(YJIT_RLIB): $(JIT_RLIB)
5055
$(ZJIT_RLIB): $(JIT_RLIB)
5156
$(JIT_RLIB):
5257
$(ECHO) 'building $(@F)'
53-
$(Q) $(RUSTC) --crate-name=jit \
58+
$(gnumake_recursive)$(Q) $(RUSTC) --crate-name=jit \
5459
--edition=2024 \
5560
$(JIT_RUST_FLAGS) \
5661
'--out-dir=$(@D)' \

yjit/yjit.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ ifneq ($(strip $(YJIT_LIBS)),)
1818
yjit-libs: $(BUILD_YJIT_LIBS)
1919
$(BUILD_YJIT_LIBS): $(YJIT_SRC_FILES)
2020
$(ECHO) 'building Rust YJIT (release mode)'
21-
$(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
21+
$(gnumake_recursive)$(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
2222
else ifneq ($(strip $(RLIB_DIR)),) # combo build
2323
# Absolute path to avoid VPATH ambiguity
2424
YJIT_RLIB = $(TOP_BUILD_DIR)/$(RLIB_DIR)/libyjit.rlib
2525

2626
$(YJIT_RLIB): $(YJIT_SRC_FILES)
2727
$(ECHO) 'building $(@F)'
28-
$(Q) $(RUSTC) '-L$(@D)' --extern=jit $(YJIT_RUSTC_ARGS)
28+
$(gnumake_recursive)$(Q) $(RUSTC) '-L$(@D)' --extern=jit $(YJIT_RUSTC_ARGS)
2929

3030
$(RUST_LIB): $(YJIT_RLIB)
3131
endif # ifneq ($(strip $(YJIT_LIBS)),)

zjit/zjit.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ BUILD_ZJIT_LIBS = $(TOP_BUILD_DIR)/$(ZJIT_LIBS)
2222
ifneq ($(strip $(ZJIT_LIBS)),)
2323
$(BUILD_ZJIT_LIBS): $(ZJIT_SRC_FILES)
2424
$(ECHO) 'building Rust ZJIT (release mode)'
25-
$(Q) $(RUSTC) $(ZJIT_RUSTC_ARGS)
25+
$(gnumake_recursive)$(Q) $(RUSTC) $(ZJIT_RUSTC_ARGS)
2626
else ifneq ($(strip $(RLIB_DIR)),) # combo build
2727
# Absolute path to avoid VPATH ambiguity
2828
ZJIT_RLIB = $(TOP_BUILD_DIR)/$(RLIB_DIR)/libzjit.rlib
2929

3030
$(ZJIT_RLIB): $(ZJIT_SRC_FILES)
3131
$(ECHO) 'building $(@F)'
32-
$(Q) $(RUSTC) '-L$(@D)' --extern=jit $(ZJIT_RUSTC_ARGS)
32+
$(gnumake_recursive)$(Q) $(RUSTC) '-L$(@D)' --extern=jit $(ZJIT_RUSTC_ARGS)
3333

3434
$(RUST_LIB): $(ZJIT_RLIB)
3535
endif # ifneq ($(strip $(ZJIT_LIBS)),)

0 commit comments

Comments
 (0)