From 0970ca957226d52af52e1f261fbb7ee8b3086cce Mon Sep 17 00:00:00 2001 From: Yuichiro MASUI Date: Sat, 23 Feb 2013 16:36:57 +0900 Subject: Support to build on pwd != mruby source root --- Rakefile | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 74e714ca3..1c65321f5 100644 --- a/Rakefile +++ b/Rakefile @@ -1,46 +1,47 @@ # encoding: utf-8 # Build description. # basic build file for mruby +MRUBY_ROOT = File.dirname(File.expand_path(__FILE__)) -load 'tasks/ruby_ext.rake' -load 'tasks/mruby_build.rake' -load 'tasks/mrbgem_spec.rake' +# load build systems +load "#{MRUBY_ROOT}/tasks/ruby_ext.rake" +load "#{MRUBY_ROOT}/tasks/mruby_build.rake" +load "#{MRUBY_ROOT}/tasks/mrbgem_spec.rake" -############################## -# compile flags -load 'build_config.rb' - -MRUBY_CONFIGS = ['build_config.rb'] -if ENV['MRUBY_CONFIG'] - MRUBY_CONFIGS << ENV['MRUBY_CONFIG'] - load ENV['MRUBY_CONFIG'] +# load configuration file +MRUBY_CONFIGS = ["#{MRUBY_ROOT}/build_config.rb", ENV['MRUBY_CONFIG']].compact +MRUBY_CONFIGS.each do |config| + load config unless config.empty? end +# load basic rules MRuby.each_target do |build| build.define_rules end -load 'src/mruby_core.rake' -load 'mrblib/mrblib.rake' -load 'tools/mrbc/mrbc.rake' +# load custom rules +load "#{MRUBY_ROOT}/src/mruby_core.rake" +load "#{MRUBY_ROOT}/mrblib/mrblib.rake" +load "#{MRUBY_ROOT}/tools/mrbc/mrbc.rake" + +load "#{MRUBY_ROOT}/tasks/mrbgems.rake" +load "#{MRUBY_ROOT}/tasks/libmruby.rake" +load "#{MRUBY_ROOT}/tools/mruby/mruby.rake" +load "#{MRUBY_ROOT}/tools/mirb/mirb.rake" -load 'tasks/mrbgems.rake' -load 'tasks/libmruby.rake' -load 'tools/mruby/mruby.rake' -load 'tools/mirb/mirb.rake' +load "#{MRUBY_ROOT}/tasks/mrbgems_test.rake" +load "#{MRUBY_ROOT}/test/mrbtest.rake" -load 'tasks/mrbgems_test.rake' -load 'test/mrbtest.rake' ############################## # generic build targets, rules task :default => :all depfiles = MRuby.targets['host'].bins.map do |bin| - install_path = MRuby.targets['host'].exefile("bin/#{bin}") - - file install_path => MRuby.targets['host'].exefile("build/host/bin/#{bin}") do |t| - FileUtils.rm t.name, :force => true + install_path = MRuby.targets['host'].exefile("#{MRUBY_ROOT}/bin/#{bin}") + source_path = MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/#{bin}") + + file install_path => source_path do |t| FileUtils.cp t.prerequisites.first, t.name end -- cgit v1.2.3