summaryrefslogtreecommitdiffhomepage
path: root/src/mruby_core.rake
diff options
context:
space:
mode:
authortake_cheeze <[email protected]>2014-02-25 18:47:28 +0900
committertake_cheeze <[email protected]>2014-03-01 20:05:29 +0900
commit78915f96017a12e8c3c40a4a2714543c10d0d070 (patch)
tree9db022c63ebd09aec5d1164141a0bdb85cc93d3f /src/mruby_core.rake
parent5ff9c1d2861609fc98f03ec2d768e0b4f1559a09 (diff)
downloadmruby-78915f96017a12e8c3c40a4a2714543c10d0d070.tar.gz
mruby-78915f96017a12e8c3c40a4a2714543c10d0d070.zip
support c++ exception
Diffstat (limited to 'src/mruby_core.rake')
-rw-r--r--src/mruby_core.rake53
1 files changed, 47 insertions, 6 deletions
diff --git a/src/mruby_core.rake b/src/mruby_core.rake
index db335223d..28ce74e64 100644
--- a/src/mruby_core.rake
+++ b/src/mruby_core.rake
@@ -4,8 +4,53 @@ MRuby.each_target do
current_build_dir = "#{build_dir}/#{relative_from_root}"
lex_def = "#{current_dir}/lex.def"
- objs = Dir.glob("#{current_dir}/*.c").map { |f| objfile(f.pathmap("#{current_build_dir}/%n")) }
- objs += [objfile("#{current_build_dir}/y.tab")]
+ objs = Dir.glob("#{current_dir}/*.c").map { |f|
+ next nil if cxx_abi_enabled? and f =~ /(codegen|error|vm).c$/
+ objfile(f.pathmap("#{current_build_dir}/%n"))
+ }.compact
+
+ if cxx_abi_enabled?
+ cxx_abi_dependency = %w(codegen error vm)
+ cxx_abi_objs = cxx_abi_dependency.map { |v|
+ src = "#{current_build_dir}/#{v}.cxx"
+ file src => "#{current_dir}/#{v}.c" do |t|
+ File.open(t.name, 'w') do |f|
+ f.write <<EOS
+extern "C" {
+#include "#{MRUBY_ROOT}/#{t.prerequisites.first}"
+}
+EOS
+ end
+ end
+
+ file objfile(src) => src do |t|
+ cxx.run t.name, t.prerequisites.first, [], [current_dir]
+ end
+
+ objfile src
+ }
+ cxx_abi_objs << objfile("#{current_build_dir}/y.tab")
+
+ file "#{current_build_dir}/y.tab.cxx" => "#{current_build_dir}/y.tab.c" do |t|
+ File.open(t.name, 'w') do |f|
+ f.write <<EOS
+extern "C" {
+#include "#{t.prerequisites.first}"
+}
+EOS
+ end
+ end
+ file objfile("#{current_build_dir}/y.tab") => ["#{current_build_dir}/y.tab.cxx", lex_def] do |t|
+ cxx.run t.name, t.prerequisites.first, [], [current_dir]
+ end
+
+ objs += cxx_abi_objs
+ else
+ objs += [objfile("#{current_build_dir}/y.tab")]
+ file objfile("#{current_build_dir}/y.tab") => ["#{current_build_dir}/y.tab.c", lex_def] do |t|
+ cc.run t.name, t.prerequisites.first, [], [current_dir]
+ end
+ end
self.libmruby << objs
file libfile("#{build_dir}/lib/libmruby_core") => objs do |t|
@@ -17,10 +62,6 @@ MRuby.each_target do
yacc.run t.name, t.prerequisites.first
end
- file objfile("#{current_build_dir}/y.tab") => ["#{current_build_dir}/y.tab.c", lex_def] do |t|
- cc.run t.name, t.prerequisites.first, [], [current_dir]
- end
-
# Lexical analyzer
file lex_def => "#{current_dir}/keywords" do |t|
gperf.run t.name, t.prerequisites.first