summaryrefslogtreecommitdiffhomepage
path: root/tasks/mruby_build.rake
diff options
context:
space:
mode:
authorYukihiro Matz Matsumoto <[email protected]>2013-01-30 07:33:35 +0900
committerYukihiro Matz Matsumoto <[email protected]>2013-01-30 07:33:35 +0900
commit24679c6dd64a09a18d9576b4d87a11b3fd223268 (patch)
tree40d0bbd0fe65191b90a4f8b021d012bb2f5643a7 /tasks/mruby_build.rake
parent78b362f8dd1713895596a241a35be4299d4f84a8 (diff)
parent6440f108bde035ec4c738f261062fe281b77053e (diff)
downloadmruby-24679c6dd64a09a18d9576b4d87a11b3fd223268.tar.gz
mruby-24679c6dd64a09a18d9576b4d87a11b3fd223268.zip
resolve conflict
Diffstat (limited to 'tasks/mruby_build.rake')
-rw-r--r--tasks/mruby_build.rake69
1 files changed, 37 insertions, 32 deletions
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index 645656417..cbef16d24 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -53,43 +53,37 @@ module MRuby
Exts = Struct.new(:object, :executable, :library)
def initialize(name='host', &block)
- MRuby::Build.current = self
- @name = name
- @root = File.expand_path("#{File.dirname(__FILE__)}/..")
+ @name = name.to_s
- if ENV['OS'] == 'Windows_NT'
- @exts = Exts.new('.o', '.exe', '.a')
- else
- @exts = Exts.new('.o', '', '.a')
- end
-
- @file_separator = '/'
- @cc = Command::Compiler.new(self, %w(.c))
- @cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp))
- @objc = Command::Compiler.new(self, %w(.m))
- @asm = Command::Compiler.new(self, %w(.S .asm))
- @linker = Command::Linker.new(self)
- @archiver = Command::Archiver.new(self)
- @yacc = Command::Yacc.new(self)
- @gperf = Command::Gperf.new(self)
- @git = Command::Git.new(self)
- @mrbc = Command::Mrbc.new(self)
-
- @bins = %w(mruby mrbc mirb)
- @gems, @libmruby = [], []
-
- MRuby.targets[name.to_s] = self
-
- instance_eval(&block)
+ unless MRuby.targets[@name]
+ @root = File.expand_path("#{File.dirname(__FILE__)}/..")
- compilers.each do |compiler|
- if respond_to?(:enable_gems?) && enable_gems?
- compiler.defines -= %w(DISABLE_GEMS)
+ if ENV['OS'] == 'Windows_NT'
+ @exts = Exts.new('.o', '.exe', '.a')
else
- compiler.defines += %w(DISABLE_GEMS)
+ @exts = Exts.new('.o', '', '.a')
end
- compiler.define_rules build_dir
+
+ @file_separator = '/'
+ @cc = Command::Compiler.new(self, %w(.c))
+ @cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp))
+ @objc = Command::Compiler.new(self, %w(.m))
+ @asm = Command::Compiler.new(self, %w(.S .asm))
+ @linker = Command::Linker.new(self)
+ @archiver = Command::Archiver.new(self)
+ @yacc = Command::Yacc.new(self)
+ @gperf = Command::Gperf.new(self)
+ @git = Command::Git.new(self)
+ @mrbc = Command::Mrbc.new(self)
+
+ @bins = %w(mruby mrbc mirb)
+ @gems, @libmruby = [], []
+
+ MRuby.targets[@name] = self
end
+
+ MRuby::Build.current = MRuby.targets[@name]
+ MRuby.targets[@name].instance_eval(&block)
end
def toolchain(name)
@@ -112,6 +106,17 @@ module MRuby
end
end
+ def define_rules
+ compilers.each do |compiler|
+ if respond_to?(:enable_gems?) && enable_gems?
+ compiler.defines -= %w(DISABLE_GEMS)
+ else
+ compiler.defines += %w(DISABLE_GEMS)
+ end
+ compiler.define_rules build_dir
+ end
+ end
+
def filename(name)
if name.is_a?(Array)
name.flatten.map { |n| filename(n) }