mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00

This commit adds extconf.rb for both the default GC and and MMTk to build
the external GC. This allows common.mk to not need to contain any
implementation-specific build configuration.
db6a29b4a9
37 lines
881 B
Ruby
37 lines
881 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../extconf_base"
|
|
|
|
# Statically link `libmmtk_ruby.a`
|
|
$LIBS << " $(MMTK_BUILD)/libmmtk_ruby.#{RbConfig::CONFIG["LIBEXT"]}"
|
|
|
|
create_gc_makefile("mmtk")
|
|
|
|
makefile = File.read("Makefile")
|
|
|
|
# Modify the `all` target to run the `mmtk` target first
|
|
makefile.gsub!(/^all:\s+(.*)$/, 'all: mmtk \1')
|
|
|
|
# Add the `mmtk` target to run `cargo build`
|
|
makefile << <<~'MAKEFILE'
|
|
$(srcdir)/mmtk.c: mmtk
|
|
|
|
MMTK_BUILD=debug
|
|
|
|
.PHONY: mmtk
|
|
mmtk:
|
|
$(Q) case $(MMTK_BUILD) in \
|
|
release) \
|
|
CARGO_TARGET_DIR="." cargo build --manifest-path=$(srcdir)/Cargo.toml --release \
|
|
;; \
|
|
debug) \
|
|
CARGO_TARGET_DIR="." cargo build --manifest-path=$(srcdir)/Cargo.toml \
|
|
;; \
|
|
*) \
|
|
$(ECHO) Unknown MMTK_BUILD=$(MMTK_BUILD) \
|
|
exit 1 \
|
|
;; \
|
|
esac
|
|
MAKEFILE
|
|
|
|
File.open("Makefile", "w") { |file| file.puts(makefile) }
|