Commit 24679c6d authored by Yukihiro Matz Matsumoto's avatar Yukihiro Matz Matsumoto

resolve conflict

parents 78b362f8 6440f108
......@@ -8,8 +8,17 @@ load 'tasks/mrbgem_spec.rake'
##############################
# compile flags
MRUBY_CONFIG = File.expand_path(ENV['MRUBY_CONFIG'] || './build_config.rb')
load MRUBY_CONFIG
load 'build_config.rb'
MRUBY_CONFIGS = ['build_config.rb']
if ENV['MRUBY_CONFIG']
MRUBY_CONFIGS << ENV['MRUBY_CONFIG']
load ENV['MRUBY_CONFIG']
end
MRuby.each_target do |build|
build.define_rules
end
load 'src/mruby_core.rake'
load 'mrblib/mrblib.rake'
......
......@@ -74,5 +74,5 @@ end
# conf.cc.flags << "-m32"
# conf.linker.flags << "-m32"
#
# conf.gem 'examples/mrbgems/c_and_ruby_extension_example'
# conf.gem 'doc/mrbgems/c_and_ruby_extension_example'
# end
......@@ -35,7 +35,6 @@ module MRuby
def setup
MRuby::Gem.current = self
@build.compilers.each do |compiler|
compiler.include_paths << "#{dir}/include"
end
......
......@@ -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[/*]
......
......@@ -53,8 +53,9 @@ module MRuby
Exts = Struct.new(:object, :executable, :library)
def initialize(name='host', &block)
MRuby::Build.current = self
@name = name
@name = name.to_s
unless MRuby.targets[@name]
@root = File.expand_path("#{File.dirname(__FILE__)}/..")
if ENV['OS'] == 'Windows_NT'
......@@ -78,18 +79,11 @@ module MRuby
@bins = %w(mruby mrbc mirb)
@gems, @libmruby = [], []
MRuby.targets[name.to_s] = self
instance_eval(&block)
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
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) }
......
......@@ -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()
@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 = []
......
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'
......
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"]
......
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