summaryrefslogtreecommitdiffhomepage
path: root/src/mruby_core.rake
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-11-20 22:23:29 +0900
committerGitHub <[email protected]>2020-11-20 22:23:29 +0900
commitebf380474c2bd450e2f79c708a86cefabe34e040 (patch)
treec5b66575b1cc9bd9f24ada926cc4730b44008594 /src/mruby_core.rake
parent749ac0a021c1c9010d06a6531b5627de012a1478 (diff)
parentaaa12911e2f4be42c2b024d86cd150d91e231b26 (diff)
downloadmruby-ebf380474c2bd450e2f79c708a86cefabe34e040.tar.gz
mruby-ebf380474c2bd450e2f79c708a86cefabe34e040.zip
Merge pull request #5153 from shuujii/refactor-src-mruby_core.rake
Refactor `src/mruby_core.rake`
Diffstat (limited to 'src/mruby_core.rake')
-rw-r--r--src/mruby_core.rake20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mruby_core.rake b/src/mruby_core.rake
index 0b9e94a20..c4816d4ce 100644
--- a/src/mruby_core.rake
+++ b/src/mruby_core.rake
@@ -1,15 +1,13 @@
-MRuby.each_target do
- current_dir = File.dirname(__FILE__).relative_path_from(Dir.pwd)
- relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT)
- current_build_dir = "#{build_dir}/#{relative_from_root}"
-
- objs = Dir.glob("#{current_dir}/*.c").map { |f|
- next nil if cxx_exception_enabled? and f =~ /(error|vm|gc)\.c$/
- objfile(f.pathmap("#{current_build_dir}/%n"))
- }.compact
+as_cxx_srcs = %w[vm error gc].map{|name| "#{MRUBY_ROOT}/src/#{name}.c"}
- if cxx_exception_enabled?
- objs += %w(vm error gc).map { |v| compile_as_cxx "#{current_dir}/#{v}.c", "#{current_build_dir}/#{v}.cxx" }
+MRuby.each_target do
+ objs = Dir.glob("#{MRUBY_ROOT}/src/*.c").map do |src|
+ dst = src.pathmap("#{build_dir}/src/%n")
+ if cxx_exception_enabled? && as_cxx_srcs.include?(src)
+ compile_as_cxx(src, "#{dst}.cxx")
+ else
+ objfile(dst)
+ end
end
self.libmruby_objs << objs