From f3e601c67e2e5beb82c04230739f132dd8cd81a2 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 6 Jan 2025 11:29:42 -0500 Subject: [PATCH] Split compile Rake target into compile:debug and compile:release --- Rakefile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 6da5a51..04a7a94 100644 --- a/Rakefile +++ b/Rakefile @@ -5,14 +5,26 @@ require "net/http" require "rbconfig" require "rake/extensiontask" -task default: [:compile, :install] +Rake::ExtensionTask.prepend(Module.new do + def binary(platform = nil) + "librubygc.mmtk.#{RbConfig::CONFIG["DLEXT"]}" + end +end) + +task default: [:"compile:debug", :install] -Rake::ExtensionTask.new do |ext| - ext.name = "librubygc.mmtk" +extension_configuration = proc do |ext| ext.ext_dir = "gc/mmtk" ext.lib_dir = "tmp/binaries" end +Rake::ExtensionTask.new(:debug, &extension_configuration) + +Rake::ExtensionTask.new(:release) do |ext| + extension_configuration.call(ext) + ext.instance_variable_set(:@make, ext.send(:make) + " MMTK_BUILD=release") +end + task :install do FileUtils.mv(Dir.glob("tmp/binaries/*"), RbConfig::CONFIG["modular_gc_dir"]) end