summaryrefslogtreecommitdiff
path: root/yjit/yjit.mk
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-19 15:22:22 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-14 21:24:40 +0900
commitf2429f0af57536a354159f08aac729d6e4cdef38 (patch)
tree784587a4c730f953d962d1bcc5d7689b7d6328ac /yjit/yjit.mk
parentd66b29ccfbedb8d669ebfed19888f9ba22a48b75 (diff)
downloadruby-f2429f0af57536a354159f08aac729d6e4cdef38.tar.gz
Expand dependency for `$(YJIT_LIBS)`
Currently, miniruby is rebuild **always** when yjit is enabled, even if nothing is changed.
Diffstat (limited to 'yjit/yjit.mk')
-rw-r--r--yjit/yjit.mk34
1 files changed, 15 insertions, 19 deletions
diff --git a/yjit/yjit.mk b/yjit/yjit.mk
index 9e3155deb3..315ad9521f 100644
--- a/yjit/yjit.mk
+++ b/yjit/yjit.mk
@@ -5,12 +5,17 @@ CARGO_VERBOSE_0 = -q
CARGO_VERBOSE_1 =
CARGO_VERBOSE = $(CARGO_VERBOSE_$(V))
-# Select between different build profiles with macro substitution
-.PHONY: yjit-static-lib
-yjit-static-lib: yjit-static-lib-$(YJIT_SUPPORT)
+YJIT_SRC_FILES = $(wildcard \
+ $(top_srcdir)/yjit/Cargo.* \
+ $(top_srcdir)/yjit/src/*.rs \
+ $(top_srcdir)/yjit/src/*/*.rs \
+ $(top_srcdir)/yjit/src/*/*/*.rs \
+ $(top_srcdir)/yjit/src/*/*/*/*.rs \
+ )
# YJIT_SUPPORT=yes when `configure` gets `--enable-yjit`
-yjit-static-lib-yes:
+ifeq ($(YJIT_SUPPORT),yes)
+$(YJIT_LIBS): $(YJIT_SRC_FILES)
$(ECHO) 'building Rust YJIT (release mode)'
$(Q) $(RUSTC) \
--crate-name=yjit \
@@ -20,28 +25,19 @@ yjit-static-lib-yes:
-C overflow-checks=on \
'--out-dir=$(CARGO_TARGET_DIR)/release/' \
$(top_srcdir)/yjit/src/lib.rs
-
-yjit-static-lib-no:
+else ifeq ($(YJIT_SUPPORT),no)
+$(YJIT_LIBS):
$(ECHO) 'Error: Tried to build YJIT without configuring it first. Check `make showconfig`?'
@false
-
-yjit-static-lib-cargo:
+else ifeq ($(YJIT_SUPPORT),$(filter dev dev_nodebug stats,$(YJIT_SUPPORT)))
+$(YJIT_LIBS): $(YJIT_SRC_FILES)
$(ECHO) 'building Rust YJIT ($(YJIT_SUPPORT) mode)'
$(Q)$(CHDIR) $(top_srcdir)/yjit && \
CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \
CARGO_TERM_PROGRESS_WHEN='never' \
$(CARGO) $(CARGO_VERBOSE) build $(CARGO_BUILD_ARGS)
-
-yjit-static-lib-dev: yjit-static-lib-cargo
-yjit-static-lib-dev_nodebug: yjit-static-lib-cargo
-yjit-static-lib-stats: yjit-static-lib-cargo
-
-# This PHONY prerequisite makes it so that we always run cargo. When there are
-# no Rust changes on rebuild, Cargo does not touch the mtime of the static
-# library and GNU make avoids relinking. $(empty) seems to be important to
-# trigger rebuild each time in release mode.
-$(YJIT_LIBS): yjit-static-lib
- $(empty)
+else
+endif
# Put this here instead of in common.mk to avoid breaking nmake builds
# TODO: might need to move for BSD Make support