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 --- tools/mirb/mirb.rake | 6 ++++-- tools/mrbc/mrbc.rake | 6 ++++-- tools/mruby/mruby.rake | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/mirb/mirb.rake b/tools/mirb/mirb.rake index 46e69136e..f258a9df9 100644 --- a/tools/mirb/mirb.rake +++ b/tools/mirb/mirb.rake @@ -1,9 +1,11 @@ MRuby.each_target do - dir = File.dirname(__FILE__).relative_path_from(root) + current_dir = File.dirname(__FILE__).relative_path_from(Dir.pwd) + relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT) + current_build_dir = "#{build_dir}/#{relative_from_root}" if bins.find { |s| s.to_s == 'mirb' } exec = exefile("#{build_dir}/bin/mirb") - objs = Dir.glob("#{dir}/*.c").map { |f| objfile(f.pathmap("#{build_dir}/%X")) }.flatten + objs = Dir.glob("#{current_dir}/*.c").map { |f| objfile(f.pathmap("#{current_build_dir}/%n")) } file exec => objs + [libfile("#{build_dir}/lib/libmruby")] do |t| gem_flags = gems.map { |g| g.linker.flags } diff --git a/tools/mrbc/mrbc.rake b/tools/mrbc/mrbc.rake index 0121b7f81..1a0309a0d 100644 --- a/tools/mrbc/mrbc.rake +++ b/tools/mrbc/mrbc.rake @@ -1,9 +1,11 @@ MRuby.each_target do - dir = File.dirname(__FILE__).relative_path_from(root) + current_dir = File.dirname(__FILE__).relative_path_from(Dir.pwd) + relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT) + current_build_dir = "#{build_dir}/#{relative_from_root}" if bins.find { |s| s.to_s == 'mrbc' } exec = exefile("#{build_dir}/bin/mrbc") - objs = Dir.glob("#{dir}/*.c").map { |f| objfile(f.pathmap("#{build_dir}/%X")) }.flatten + objs = Dir.glob("#{current_dir}/*.c").map { |f| objfile(f.pathmap("#{current_build_dir}/%n")) }.flatten file exec => objs + [libfile("#{build_dir}/lib/libmruby_core")] do |t| linker.run t.name, t.prerequisites diff --git a/tools/mruby/mruby.rake b/tools/mruby/mruby.rake index fccebff63..dc3cbe2a2 100644 --- a/tools/mruby/mruby.rake +++ b/tools/mruby/mruby.rake @@ -1,9 +1,11 @@ MRuby.each_target do - dir = File.dirname(__FILE__).relative_path_from(root) + current_dir = File.dirname(__FILE__).relative_path_from(Dir.pwd) + relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT) + current_build_dir = "#{build_dir}/#{relative_from_root}" if bins.find { |s| s.to_s == 'mruby' } exec = exefile("#{build_dir}/bin/mruby") - objs = Dir.glob("#{dir}/*.c").map { |f| objfile(f.pathmap("#{build_dir}/%X")) }.flatten + objs = Dir.glob("#{current_dir}/*.c").map { |f| objfile(f.pathmap("#{current_build_dir}/%n")) }.flatten file exec => objs + [libfile("#{build_dir}/lib/libmruby")] do |t| gem_flags = gems.map { |g| g.linker.flags } -- cgit v1.2.3