[ruby/mmtk] Fix libmmtk_ruby.a building in extconf.rb

Since libmmtk_ruby.a was a PHONY target, it caused the shared object to
not be rebuilt even though libmmtk_ruby.a was updated.

https://github.com/ruby/mmtk/commit/076f0a97a6
This commit is contained in:
Peter Zhu 2025-01-09 12:26:07 -05:00 committed by git
parent 5fab31b15e
commit 2da91080d3

View File

@ -9,17 +9,17 @@ create_gc_makefile("mmtk")
makefile = File.read("Makefile") makefile = File.read("Makefile")
# Modify the `all` target to run the `mmtk` target first makefile.prepend("MMTK_BUILD=debug\n")
makefile.gsub!(/^all:\s+(.*)$/, 'all: mmtk \1')
# Add the `mmtk` target to run `cargo build` # Add `libmmtk_ruby.a` as an object file
makefile << <<~'MAKEFILE' makefile.gsub!(/^OBJS = (.*)$/, "OBJS = \\1 $(MMTK_BUILD)/libmmtk_ruby.#{RbConfig::CONFIG["LIBEXT"]}")
$(srcdir)/mmtk.c: mmtk
MMTK_BUILD=debug # Modify the `all` target to run the `libmmtk_ruby.a` target first
makefile.gsub!(/^all:\s+(.*)$/, "all: $(MMTK_BUILD)/libmmtk_ruby.#{RbConfig::CONFIG["LIBEXT"]} \\1")
.PHONY: mmtk # Add the `libmmtk_ruby.a` target to run `cargo build`
mmtk: makefile << <<~MAKEFILE
$(MMTK_BUILD)/libmmtk_ruby.#{RbConfig::CONFIG["LIBEXT"]}: $(wildcard $(srcdir)/src/*.rs) $(srcdir)/Cargo.toml $(srcdir)/Cargo.toml
$(Q) case $(MMTK_BUILD) in \ $(Q) case $(MMTK_BUILD) in \
release) \ release) \
CARGO_TARGET_DIR="." cargo build --manifest-path=$(srcdir)/Cargo.toml --release \ CARGO_TARGET_DIR="." cargo build --manifest-path=$(srcdir)/Cargo.toml --release \