summaryrefslogtreecommitdiffhomepage
path: root/test/mrbtest.rake
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-01-02 09:54:05 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2013-01-02 09:54:05 -0800
commit65901c3dbdc6ee38acdfaa6c29d8d4bdd575a6be (patch)
treeb79aa703ef7c528896c4f1be8280d0691314008b /test/mrbtest.rake
parenta48fc0d7952ad1f10ae777637269fe6a3f9ad0a2 (diff)
parent7c469c0b9dadd1de09fed18c3e5cc551012c38c1 (diff)
downloadmruby-65901c3dbdc6ee38acdfaa6c29d8d4bdd575a6be.tar.gz
mruby-65901c3dbdc6ee38acdfaa6c29d8d4bdd575a6be.zip
Merge pull request #679 from masuidrive/merge_to_cruby_building_script
Rebuild CRuby based building script without Makefile
Diffstat (limited to 'test/mrbtest.rake')
-rw-r--r--test/mrbtest.rake32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/mrbtest.rake b/test/mrbtest.rake
new file mode 100644
index 000000000..1d416df2c
--- /dev/null
+++ b/test/mrbtest.rake
@@ -0,0 +1,32 @@
+dir = File.dirname(__FILE__).sub(%r|^\./|, '')
+
+MRuby.each_target do
+ exec = exefile("#{build_dir}/#{dir}/mrbtest")
+ clib = "#{build_dir}/#{dir}/mrbtest.c"
+ mlib = clib.ext('o')
+ mrbs = Dir.glob("#{dir}/t/*.rb")
+ init = "#{dir}/init_mrbtest.c"
+ asslib = "#{dir}/assert.rb"
+
+ objs = ["#{build_dir}/#{dir}/driver.o", mlib]
+
+ file exec => objs + gems.map{ |g| g.testlib } + ["#{build_dir}/lib/libmruby.a"] do |t|
+ link t.name, t.prerequisites, [], gems.map { |g| g.mruby_libs }
+ end
+
+ file mlib => [clib]
+ file clib => [exefile("#{build_dir}/bin/mrbc"), init, asslib] + mrbs do |t|
+ open(clib, 'w') do |f|
+ f.puts File.read(init)
+ compile_mruby f, [asslib] + mrbs, 'mrbtest_irep'
+ gems.each do |g|
+ f.puts "void GENERATED_TMP_mrb_#{g.funcname}_gem_test(mrb_state *mrb);"
+ end
+ f.puts "void mrbgemtest_init(mrb_state* mrb) {"
+ gems.each do |g|
+ f.puts " GENERATED_TMP_mrb_#{g.funcname}_gem_test(mrb);"
+ end
+ f.puts "}"
+ end
+ end
+end \ No newline at end of file