Commit fb3c2f6b authored by take_cheeze's avatar take_cheeze

Add generator script to dependency so that it will regenerate C codes when it's modified.

parent bd0e9db1
...@@ -6,8 +6,8 @@ MRuby.each_target do ...@@ -6,8 +6,8 @@ MRuby.each_target do
self.libmruby << objfile("#{current_build_dir}/mrblib") self.libmruby << objfile("#{current_build_dir}/mrblib")
file objfile("#{current_build_dir}/mrblib") => "#{current_build_dir}/mrblib.c" file objfile("#{current_build_dir}/mrblib") => "#{current_build_dir}/mrblib.c"
file "#{current_build_dir}/mrblib.c" => [mrbcfile] + Dir.glob("#{current_dir}/*.rb").sort do |t| file "#{current_build_dir}/mrblib.c" => [mrbcfile, __FILE__] + Dir.glob("#{current_dir}/*.rb").sort do |t|
mrbc_, *rbfiles = t.prerequisites _, _, *rbfiles = t.prerequisites
FileUtils.mkdir_p File.dirname(t.name) FileUtils.mkdir_p File.dirname(t.name)
open(t.name, 'w') do |f| open(t.name, 'w') do |f|
_pp "GEN", "*.rb", "#{t.name.relative_path}" _pp "GEN", "*.rb", "#{t.name.relative_path}"
......
...@@ -13,7 +13,7 @@ MRuby.each_target do ...@@ -13,7 +13,7 @@ MRuby.each_target do
cxx_abi_dependency = %w(codegen error vm) cxx_abi_dependency = %w(codegen error vm)
cxx_abi_objs = cxx_abi_dependency.map { |v| cxx_abi_objs = cxx_abi_dependency.map { |v|
src = "#{current_build_dir}/#{v}.cxx" src = "#{current_build_dir}/#{v}.cxx"
file src => "#{current_dir}/#{v}.c" do |t| file src => ["#{current_dir}/#{v}.c", __FILE__] do |t|
File.open(t.name, 'w') do |f| File.open(t.name, 'w') do |f|
f.write <<EOS f.write <<EOS
#define __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS
...@@ -37,7 +37,7 @@ EOS ...@@ -37,7 +37,7 @@ EOS
} }
cxx_abi_objs << objfile("#{current_build_dir}/y.tab") 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 "#{current_build_dir}/y.tab.cxx" => ["#{current_build_dir}/y.tab.c", __FILE__] do |t|
File.open(t.name, 'w') do |f| File.open(t.name, 'w') do |f|
f.write <<EOS f.write <<EOS
#define __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS
......
MRuby.each_target do MRuby.each_target do
file libfile("#{build_dir}/lib/libmruby") => libmruby.flatten do |t| file libfile("#{build_dir}/lib/libmruby") => libmruby.flatten do |t|
archiver.run t.name, t.prerequisites archiver.run t.name, t.prerequisites
open("#{build_dir}/lib/libmruby.flags.mak", 'w') do |f| end
file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libfile("#{build_dir}/lib/libmruby")] do |t|
open(t.name, 'w') do |f|
f.puts "MRUBY_CFLAGS = #{cc.all_flags.gsub('"', '\\"')}" f.puts "MRUBY_CFLAGS = #{cc.all_flags.gsub('"', '\\"')}"
gem_flags = gems.map { |g| g.linker.flags } gem_flags = gems.map { |g| g.linker.flags }
...@@ -15,4 +18,5 @@ MRuby.each_target do ...@@ -15,4 +18,5 @@ MRuby.each_target do
f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries).gsub('"', '\\"')}" f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries).gsub('"', '\\"')}"
end end
end end
task :all => "#{build_dir}/lib/libmruby.flags.mak"
end end
...@@ -124,7 +124,7 @@ module MRuby ...@@ -124,7 +124,7 @@ module MRuby
def define_gem_init_builder def define_gem_init_builder
file objfile("#{build_dir}/gem_init") => "#{build_dir}/gem_init.c" file objfile("#{build_dir}/gem_init") => "#{build_dir}/gem_init.c"
file "#{build_dir}/gem_init.c" => [build.mrbcfile] + [rbfiles].flatten do |t| file "#{build_dir}/gem_init.c" => [build.mrbcfile, __FILE__] + [rbfiles].flatten do |t|
FileUtils.mkdir_p build_dir FileUtils.mkdir_p build_dir
generate_gem_init("#{build_dir}/gem_init.c") generate_gem_init("#{build_dir}/gem_init.c")
end end
......
...@@ -7,7 +7,7 @@ MRuby.each_target do ...@@ -7,7 +7,7 @@ MRuby.each_target do
# loader all gems # loader all gems
self.libmruby << objfile("#{build_dir}/mrbgems/gem_init") self.libmruby << objfile("#{build_dir}/mrbgems/gem_init")
file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"] file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"]
file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG] do |t| file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG, __FILE__] do |t|
FileUtils.mkdir_p "#{build_dir}/mrbgems" FileUtils.mkdir_p "#{build_dir}/mrbgems"
open(t.name, 'w') do |f| open(t.name, 'w') do |f|
f.puts %Q[/*] f.puts %Q[/*]
...@@ -40,7 +40,7 @@ MRuby.each_target do ...@@ -40,7 +40,7 @@ MRuby.each_target do
end end
# legal documents # legal documents
file "#{build_dir}/LEGAL" => [MRUBY_CONFIG] do |t| file "#{build_dir}/LEGAL" => [MRUBY_CONFIG, __FILE__] do |t|
open(t.name, 'w+') do |f| open(t.name, 'w+') do |f|
f.puts <<LEGAL f.puts <<LEGAL
Copyright (c) #{Time.now.year} mruby developers Copyright (c) #{Time.now.year} mruby developers
......
...@@ -10,7 +10,7 @@ MRuby.each_target do ...@@ -10,7 +10,7 @@ MRuby.each_target do
test_rbobj = g.test_rbireps.ext(exts.object) test_rbobj = g.test_rbireps.ext(exts.object)
file test_rbobj => g.test_rbireps file test_rbobj => g.test_rbireps
file g.test_rbireps => [g.test_rbfiles].flatten + [g.build.mrbcfile] do |t| file g.test_rbireps => [g.test_rbfiles].flatten + [g.build.mrbcfile, __FILE__] do |t|
open(t.name, 'w') do |f| open(t.name, 'w') do |f|
g.print_gem_test_header(f) g.print_gem_test_header(f)
test_preload = g.test_preload and [g.dir, MRUBY_ROOT].map {|dir| test_preload = g.test_preload and [g.dir, MRUBY_ROOT].map {|dir|
...@@ -117,7 +117,7 @@ MRuby.each_target do ...@@ -117,7 +117,7 @@ MRuby.each_target do
no_mrb_open_test_lib = no_mrb_open_test.ext(exts.object) no_mrb_open_test_lib = no_mrb_open_test.ext(exts.object)
file no_mrb_open_test_lib => "#{no_mrb_open_test}.c" file no_mrb_open_test_lib => "#{no_mrb_open_test}.c"
file "#{no_mrb_open_test}.c" => no_mrb_open_test_rbfiles + [MRUBY_CONFIG] do |t| file "#{no_mrb_open_test}.c" => no_mrb_open_test_rbfiles + [MRUBY_CONFIG, __FILE__] do |t|
open(t.name, 'w') do |f| open(t.name, 'w') do |f|
f.puts %Q[/*] f.puts %Q[/*]
f.puts %Q[ * This file contains a test code for following gems:] f.puts %Q[ * This file contains a test code for following gems:]
......
...@@ -31,15 +31,15 @@ MRuby.each_target do ...@@ -31,15 +31,15 @@ MRuby.each_target do
end end
file ass_lib => ass_c file ass_lib => ass_c
file ass_c => "#{current_dir}/assert.rb" do |t| file ass_c => ["#{current_dir}/assert.rb", __FILE__] do |t|
FileUtils.mkdir_p File.dirname t.name FileUtils.mkdir_p File.dirname t.name
open(t.name, 'w') do |f| open(t.name, 'w') do |f|
mrbc.run f, [t.prerequisites], 'mrbtest_assert_irep' mrbc.run f, [t.prerequisites.first], 'mrbtest_assert_irep'
end end
end end
file mlib => clib file mlib => clib
file clib => [mrbcfile, init] + mrbs do |t| file clib => [mrbcfile, init, __FILE__] + mrbs do |t|
_pp "GEN", "*.rb", "#{clib.relative_path}" _pp "GEN", "*.rb", "#{clib.relative_path}"
FileUtils.mkdir_p File.dirname(clib) FileUtils.mkdir_p File.dirname(clib)
open(clib, 'w') do |f| open(clib, 'w') do |f|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment