summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'tasks')
-rw-r--r--tasks/mrbgem_spec.rake1
-rw-r--r--tasks/mrbgems.rake2
-rw-r--r--tasks/mruby_build.rake63
-rw-r--r--tasks/mruby_build_commands.rake6
-rw-r--r--tasks/toolchains/clang.rake2
-rw-r--r--tasks/toolchains/gcc.rake2
6 files changed, 40 insertions, 36 deletions
diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake
index 0e228629b..5a28053b5 100644
--- a/tasks/mrbgem_spec.rake
+++ b/tasks/mrbgem_spec.rake
@@ -35,7 +35,6 @@ module MRuby
def setup
MRuby::Gem.current = self
-
@build.compilers.each do |compiler|
compiler.defines -= %w(DISABLE_GEMS)
compiler.include_paths << "#{dir}/include"
diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake
index 9d8798ef3..285aa75b8 100644
--- a/tasks/mrbgems.rake
+++ b/tasks/mrbgems.rake
@@ -8,7 +8,7 @@ MRuby.each_target do
# loader all gems
self.libmruby << objfile("#{build_dir}/mrbgems/gem_init")
file objfile("#{build_dir}/mrbgems/gem_init") => "#{build_dir}/mrbgems/gem_init.c"
- file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG] do |t|
+ file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIGS].flatten do |t|
FileUtils.mkdir_p "#{build_dir}/mrbgems"
open(t.name, 'w') do |f|
f.puts %Q[/*]
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index cd9f77fc4..2962e167a 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -53,39 +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 = [], []
+ unless MRuby.targets[@name]
+ @root = File.expand_path("#{File.dirname(__FILE__)}/..")
- MRuby.targets[name.to_s] = self
-
- instance_eval(&block)
+ if ENV['OS'] == 'Windows_NT'
+ @exts = Exts.new('.o', '.exe', '.a')
+ else
+ @exts = Exts.new('.o', '', '.a')
+ end
- compilers.each do |compiler|
- compiler.defines -= %w(DISABLE_GEMS) if respond_to?(:enable_gems?) && enable_gems?
- 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)
@@ -108,6 +106,13 @@ module MRuby
end
end
+ def define_rules
+ compilers.each do |compiler|
+ compiler.defines -= %w(DISABLE_GEMS) if respond_to?(:enable_gems?) && enable_gems?
+ compiler.define_rules build_dir
+ end
+ end
+
def filename(name)
if name.is_a?(Array)
name.flatten.map { |n| filename(n) }
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake
index 20203ad7e..98a216920 100644
--- a/tasks/mruby_build_commands.rake
+++ b/tasks/mruby_build_commands.rake
@@ -36,14 +36,14 @@ module MRuby
def initialize(build, source_exts=[])
super(build)
- @command = ENV['CC'] || 'gcc'
+ @command = ENV['CC'] || 'cc'
@flags = [ENV['CFLAGS'] || []]
@source_exts = source_exts
@include_paths = ["#{build.root}/include"]
@defines = %w(DISABLE_GEMS)
@option_include_path = '-I%s'
@option_define = '-D%s'
- @compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
+ @compile_options = '%{flags} -o %{outfile} -c %{infile}'
end
def all_flags(_defineds=[], _include_paths=[], _flags=[])
@@ -111,7 +111,7 @@ module MRuby
def initialize(build)
super
- @command = ENV['LD'] || 'gcc'
+ @command = ENV['LD'] || 'ld'
@flags = (ENV['LDFLAGS'] || [])
@flags_before_libraries, @flags_after_libraries = [], []
@libraries = []
diff --git a/tasks/toolchains/clang.rake b/tasks/toolchains/clang.rake
index 1785c4c79..d5d2ccd7c 100644
--- a/tasks/toolchains/clang.rake
+++ b/tasks/toolchains/clang.rake
@@ -1,7 +1,7 @@
MRuby::Toolchain.new(:clang) do |conf|
toolchain :gcc
- [conf.cc, conf.cxx, conf.objc].each do |cc|
+ [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc|
cc.command = ENV['CC'] || 'clang'
end
conf.linker.command = ENV['LD'] || 'clang'
diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake
index 2c160683d..bef9b8618 100644
--- a/tasks/toolchains/gcc.rake
+++ b/tasks/toolchains/gcc.rake
@@ -1,5 +1,5 @@
MRuby::Toolchain.new(:gcc) do |conf|
- [conf.cc, conf.cxx, conf.objc].each do |cc|
+ [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc|
cc.command = ENV['CC'] || 'gcc'
cc.flags = [ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration)]
cc.include_paths = ["#{root}/include"]