-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use extconf.rb for external GC compilation
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.
- Loading branch information
1 parent
b7d55d5
commit 98f3e2d
Showing
9 changed files
with
75 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "../extconf_base" | ||
|
||
create_gc_makefile("default") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require "mkmf" | ||
|
||
srcdir = File.join(__dir__, "..") | ||
$CFLAGS << " -I#{srcdir}" | ||
|
||
$CFLAGS << " -DBUILDING_SHARED_GC" | ||
$CFLAGS << " -fPIC" | ||
|
||
def create_gc_makefile(name) | ||
create_makefile("librubygc.#{name}") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# 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) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.