summaryrefslogtreecommitdiffhomepage
path: root/src/mruby_core.rake
diff options
context:
space:
mode:
authortake_cheeze <[email protected]>2015-04-06 15:20:13 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-06-01 21:53:55 +0900
commit6460ef77bcceb17d80d1b46a07b28fada19737c8 (patch)
tree802d327b0efbe1ed9ed1a1109657e23705b4f89f /src/mruby_core.rake
parent214bc3c95a9e01a7be4d76e94d80be9d9d59bd4b (diff)
downloadmruby-6460ef77bcceb17d80d1b46a07b28fada19737c8.tar.gz
mruby-6460ef77bcceb17d80d1b46a07b28fada19737c8.zip
Compile mruby compiler as mrbgem.
Compiler codes is moved to "mruby-compiler". Executable `mrbc` is moved to "mruby-bin-mrbc".
Diffstat (limited to 'src/mruby_core.rake')
-rw-r--r--src/mruby_core.rake63
1 files changed, 2 insertions, 61 deletions
diff --git a/src/mruby_core.rake b/src/mruby_core.rake
index 88fca83fc..abde441d5 100644
--- a/src/mruby_core.rake
+++ b/src/mruby_core.rake
@@ -3,76 +3,17 @@ MRuby.each_target do
relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT)
current_build_dir = "#{build_dir}/#{relative_from_root}"
- lex_def = "#{current_dir}/lex.def"
objs = Dir.glob("#{current_dir}/*.c").map { |f|
- next nil if cxx_abi_enabled? and f =~ /(codegen|error|vm).c$/
+ next nil if cxx_abi_enabled? and f =~ /(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", __FILE__] do |t|
- File.open(t.name, 'w') do |f|
- f.write <<EOS
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
-extern "C" {
-#include "#{MRUBY_ROOT}/#{t.prerequisites.first}"
-}
-
-
-#{v == 'error'? 'mrb_int mrb_jmpbuf::jmpbuf_id = 0;' : ''}
-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", __FILE__] do |t|
- File.open(t.name, 'w') do |f|
- f.write <<EOS
-#define __STDC_CONSTANT_MACROS
-#define __STDC_LIMIT_MACROS
-
-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
+ objs += %w(vm error).map { |v| compile_as_cxx "#{current_dir}/#{v}.c", "#{current_build_dir}/#{v}.cxx" }
end
self.libmruby << objs
file libfile("#{build_dir}/lib/libmruby_core") => objs do |t|
archiver.run t.name, t.prerequisites
end
-
- # Parser
- file "#{current_build_dir}/y.tab.c" => ["#{current_dir}/parse.y"] do |t|
- yacc.run t.name, t.prerequisites.first
- end
-
- # Lexical analyzer
- file lex_def => "#{current_dir}/keywords" do |t|
- gperf.run t.name, t.prerequisites.first
- end
end