summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/compile/README.md232
-rwxr-xr-xminirake4
-rw-r--r--mrblib/mrblib.rake1
-rw-r--r--tasks/libmruby.rake10
-rw-r--r--tasks/mrbgem_spec.rake20
-rw-r--r--tasks/mrbgems_test.rake6
-rw-r--r--tasks/mruby_build.rake11
-rw-r--r--tasks/mruby_build_commands.rake35
-rw-r--r--tasks/ruby_ext.rake23
-rw-r--r--tasks/toolchains/vs2012.rake4
-rw-r--r--test/mrbtest.rake3
-rw-r--r--tools/mirb/mirb.rake2
-rw-r--r--tools/mrbc/mrbc.rake2
-rw-r--r--tools/mruby/mruby.rake2
14 files changed, 282 insertions, 73 deletions
diff --git a/doc/compile/README.md b/doc/compile/README.md
index 168417984..a1c915a0e 100644
--- a/doc/compile/README.md
+++ b/doc/compile/README.md
@@ -10,7 +10,7 @@ To compile mruby out of the source code you need the following tools:
* Linker (i.e. ```gcc```)
* Archive utility (i.e. ```ar```)
* Parser generator (i.e. ```bison```)
-* Ruby 1.8 or 1.9
+* Ruby 1.8 or 1.9 (i.e. ```ruby``` or ```jruby```)
Optional:
* GIT (to update mruby source and integrate mrbgems easier)
@@ -25,70 +25,187 @@ of mruby and looks like this for example:
```
MRuby::Build.new do |conf|
- conf.cc = ENV['CC'] || 'gcc'
- conf.ld = ENV['LD'] || 'gcc'
- conf.ar = ENV['AR'] || 'ar'
-
- conf.cflags << (ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration))
- conf.ldflags << (ENV['LDFLAGS'] || %w(-lm))
+ toolchain :gcc
end
```
-All tools necessary to compile mruby can be set or modified here.
-The following options can be configurated:
-
-* conf.cc (C compiler)
-* conf.ld (Linker)
-* conf.ar (Archive utility)
-* conf.cxx (C++ compiler)
-* conf.objcc (Object compiler)
-* conf.asm (Assembler)
-* conf.yacc (Parser Generator)
-* conf.gperf (Hash function Generator)
-* conf.cat (Concatenate utility)
-* conf.git (GIT content tracker)
-* conf.cflags (C compiler flags)
-* conf.ldflags (Linker flags)
-* conf.cxxflags (C++ compiler flags)
-* conf.objccflags (Object compiler flags)
-* conf.asmflags (Assembler flags)
-* conf.gem (A GEM which should be integrated - can be set several times)
-* conf.bins (Build binaries)
+All tools necessary to compile mruby can be set or modified here. In case
+you want to maintain an additional *build_config.rb* you can define a
+customized path using the *$MRUBY_CONFIG* environment variable.
To compile just call ```./minirake``` inside of the mruby source root. To
-generate the test tool environment call ```./minirake test```. To clean
+generate and execute the test tools call ```./minirake test```. To clean
all build files call ```./minirake clean```.
-### Cross-Compilation
+## Build Configuration
+
+Inside of the *build_config.rb* the following options can be configurated
+based on your environment.
+
+### Toolchains
+
+The mruby build system contains already a set of toolchain templates which
+configurates the build environment for specific compiler infrastructures.
+
+#### GCC
+
+Toolchain configuration for the GNU C Compiler.
+
+```
+toolchain :gcc
+```
+
+#### clang
+
+Toolchain configuration for the LLVM C Compiler clang. Mainly equal to the
+GCC toolchain.
+
+```
+toolchain :clang
+```
+
+#### Visual Studio 2012
+
+Toolchain configuration for Visual Studio 2012 on Windows.
+
+```
+toolchain :vs2012
+```
+
+### Binaries
+
+It is possible to select which tools should be compiled during the compilation
+process. The following tools can be selected:
+* mrbc (mruby compiler)
+* mruby (mruby interpreter)
+* mirb (mruby interactive shell
+
+To select all define an array in ```conf.bins```:
+```
+conf.bins = %(mrbc mruby mirb)
+```
+
+### File Separator
+
+Some environments require a different file separator character. It is possible to
+set the character via ```conf.file_separator```.
+
+```
+conf.file_separator = '/'
+```
+
+### C Compiler
+
+Configuration of the C compiler binary, flags and include paths.
+
+```
+conf.cc do |cc|
+ cc.command = ...
+ cc.flags = ...
+ cc.include_paths = ...
+ cc.defines = ...
+ cc.option_include_path = ...
+ cc.option_define = ...
+ cc.compile_options = ...
+end
+```
+
+### Linker
+
+Configuration of the Linker binary, flags and library paths.
+
+```
+conf.linker do |linker|
+ linker.command = ...
+ linker.flags = ...
+ linker.libraries = ...
+ linker.library_paths = ....
+ linker.option_library = ...
+ linker.option_library_path = ...
+ linker.link_options = ...
+end
+```
+
+### Archiver
+
+Configuration of the Archiver binary and flags.
+
+```
+conf.archiver do |archiver|
+ archiver.command = ...
+ archiver.archive_options = ...
+end
+```
+
+### Parser Generator
+
+Configuration of the Parser Generator binary and flags.
+
+```
+conf.yacc do |yacc|
+ yacc.command = ...
+ yacc.compile_options = ...
+end
+```
+
+### GPerf
+
+Configuration of the GPerf binary and flags.
+```
+conf.gperf do |gperf|
+ gperf.command = ...
+ gperf.compile_options = ...
+end
+```
+
+### File Extensions
+
+```
+conf.exts do |exts
+ exts.object = ...
+ exts.executable = ...
+ exts.library = ...
+end
+```
+
+### Mrbgems
+
+Integrate GEMs in the build process.
+
+```
+# Integrate GEM with additional configuration
+conf.gem 'path/to/gem' do |g|
+ g.cc.flags << ...
+end
+
+# Integrate GEM without additional configuration
+conf.gem 'path/to/another/gem'
+```
+
+## Cross-Compilation
mruby can also be cross-compiled from one platform to another. To
achive this the *build_config.rb* needs to contain an instance of
```MRuby::CrossBuild```. This instance defines the compilation
tools and flags for the target platform. An example could look
-like this for example:
+like this:
```
-MRuby::CrossBuild.new('i386') do |conf|
- conf.cc = ENV['CC'] || 'gcc'
- conf.ld = ENV['LD'] || 'gcc'
- conf.ar = ENV['AR'] || 'ar'
+MRuby::CrossBuild.new('32bit') do |conf|
+ toolchain :gcc
- if ENV['OS'] == 'Windows_NT' # MinGW
- conf.cflags = %w(-g -O3 -Wall -Werror-implicit-function-declaration -Di386_MARK)
- conf.ldflags = %w(-s -static)
- else
- conf.cflags << %w(-g -O3 -Wall -Werror-implicit-function-declaration -arch i386)
- conf.ldflags << %w(-arch i386)
- end
+ conf.cc.flags << "-m32"
+ conf.linker.flags << "-m32
end
```
-You can configurate the same options as for a normal build. You can specified your own build_config.rb with *$MRUBY_CONFIG*.
+All configuration options of ```MRuby::Build``` can also be used
+in ```MRuby::CrossBuild```.
## Build process
-During the build process the directory *build* will be created. The
-directory structure will look like this:
+During the build process the directory *build* will be created in the
+root directory. The structure of this directory will look like this:
```
+- build
@@ -132,6 +249,13 @@ link with *build/host/lib/libmruby.a*
* create ```build/host/bin/mirb``` by compile *tools/mirb/mirb.c* and
link with *build/host/lib/libmruby.a*
+```
+ _____ _____ ______ ____ ____ _____ _____ ____
+| CC |->|GEN |->|AR |->|CC |->|CC |->|AR |->|CC |->|CC |
+| *.c | |y.tab| |core.a| |mrbc| |*.rb| |lib.a| |mruby| |mirb|
+ ----- ----- ------ ---- ---- ----- ----- ----
+```
+
### Cross-Compilation
In case of a cross-compilation to *i386* the *build* directory structure looks
@@ -204,6 +328,26 @@ link with *build/i386/lib/libmruby.a*
* create ```build/i386/bin/mrbc``` by cross-compile *tools/mrbc/mrbc.c* and
link with *build/i386/lib/libmruby_core.a*
+```
+ _____________________________________________________________
+| Native Compilation for Host System |
+| _____ ______ _____ ____ ____ _____ |
+|| CC | -> |AR | -> |GEN | -> |CC | -> |CC | -> |AR ||
+|| *.c | |core.a| |y.tab| |mrbc| |*.rb| |lib.a||
+| ----- ------ ----- ---- ---- ----- |
+ -------------------------------------------------------------
+ ||
+ \||/
+ \/
+ ______________________________________________________________
+| Cross Compilation for Target System |
+| _____ _____ _____ ____ ______ _____ |
+|| CC | -> |AR | -> |CC | -> |CC | -> |AR | -> |CC ||
+|| *.c | |lib.a| |mruby| |mirb| |core.a| |mrbc ||
+| ----- ----- ----- ---- ------ ----- |
+ --------------------------------------------------------------
+```
+
## Test Environment
mruby's build process includes a test environment. In case you start the testing
diff --git a/minirake b/minirake
index 00a2e6486..430e730cb 100755
--- a/minirake
+++ b/minirake
@@ -277,7 +277,7 @@ module MiniRake
# Run the system command +cmd+.
def sh(cmd)
- puts cmd
+ puts cmd if $verbose
system(cmd) or fail "Command Failed: [#{cmd}]"
end
@@ -418,7 +418,7 @@ class RakeApp
# Read and handle the command line options.
def handle_options
- $verbose = true
+ $verbose = false
opts = GetoptLong.new(*command_line_options)
opts.each { |opt, value| do_option(opt, value) }
end
diff --git a/mrblib/mrblib.rake b/mrblib/mrblib.rake
index 493207db4..46d8c5a79 100644
--- a/mrblib/mrblib.rake
+++ b/mrblib/mrblib.rake
@@ -7,6 +7,7 @@ MRuby.each_target do
mrbc_, *rbfiles = t.prerequisites
FileUtils.mkdir_p File.dirname(t.name)
open(t.name, 'w') do |f|
+ _pp "GEN *.rb > #{t.name}"
f.puts File.read("#{dir}/init_mrblib.c")
mrbc.run f, rbfiles, 'mrblib_irep'
end
diff --git a/tasks/libmruby.rake b/tasks/libmruby.rake
index c3b9d714f..108f42f59 100644
--- a/tasks/libmruby.rake
+++ b/tasks/libmruby.rake
@@ -1,5 +1,15 @@
MRuby.each_target do
file libfile("#{build_dir}/lib/libmruby") => libmruby.flatten do |t|
archiver.run t.name, t.prerequisites
+ open("#{build_dir}/lib/libmruby.flags.mak", 'w') do |f|
+ f.puts 'CFLAGS = "%s"' % cc.all_flags.gsub('"', '\\"')
+
+ gem_flags = gems.map { |g| g.linker.flags }
+ gem_library_paths = gems.map { |g| g.linker.library_paths }
+ f.puts 'LDFLAGS = "%s"' % linker.all_flags(gem_library_paths, gem_flags).gsub('"', '\\"')
+
+ gem_libraries = gems.map { |g| g.linker.libraries }
+ f.puts 'LIBS = "%s"' % linker.library_flags(gem_libraries).gsub('"', '\\"')
+ end
end
end
diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake
index e21e0b670..906f47ad0 100644
--- a/tasks/mrbgem_spec.rake
+++ b/tasks/mrbgem_spec.rake
@@ -35,22 +35,26 @@ module MRuby
def setup
MRuby::Gem.current = self
- MRuby::Build::COMMANDS.each do |command|
- instance_variable_set("@#{command}", @build.send(command).clone)
- end
- @linker = LinkerConfig.new([], [], [])
- compilers.each do |compiler|
+ @build.compilers.each do |compiler|
compiler.defines -= %w(DISABLE_GEMS)
compiler.include_paths << "#{dir}/include"
end
+ MRuby::Build::COMMANDS.each do |command|
+ instance_variable_set("@#{command}", @build.send(command).clone)
+ end
+ @linker = LinkerConfig.new([], [], [])
@rbfiles = Dir.glob("#{dir}/mrblib/*.rb")
- @objs = Dir.glob("#{dir}/src/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(@dir).to_s.pathmap("#{build_dir}/%X")) }
+ @objs = Dir.glob("#{dir}/src/*.{c,cpp,m,asm,S}").map do |f|
+ objfile(f.relative_path_from(@dir).to_s.pathmap("#{build_dir}/%X"))
+ end
@objs << objfile("#{build_dir}/gem_init")
@test_rbfiles = Dir.glob("#{dir}/test/*.rb")
- @test_objs = Dir.glob("#{dir}/test/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(dir).to_s.pathmap("#{build_dir}/%X")) }
+ @test_objs = Dir.glob("#{dir}/test/*.{c,cpp,m,asm,S}").map do |f|
+ objfile(f.relative_path_from(dir).to_s.pathmap("#{build_dir}/%X"))
+ end
@test_preload = 'test/assert.rb'
instance_eval(&@initializer)
@@ -90,7 +94,7 @@ module MRuby
def define_gem_init_builder
file objfile("#{build_dir}/gem_init") => "#{build_dir}/gem_init.c"
- file "#{build_dir}/gem_init.c" => [build.mrbcfile] + rbfiles do |t|
+ file "#{build_dir}/gem_init.c" => [build.mrbcfile] + [rbfiles].flatten do |t|
FileUtils.mkdir_p build_dir
generate_gem_init("#{build_dir}/gem_init.c")
end
diff --git a/tasks/mrbgems_test.rake b/tasks/mrbgems_test.rake
index 1c495be5b..cb00aba57 100644
--- a/tasks/mrbgems_test.rake
+++ b/tasks/mrbgems_test.rake
@@ -5,16 +5,16 @@ MRuby.each_target do
test_rbc = "#{g.build_dir}/gem_test.c"
test_rbobj = test_rbc.ext(exts.object)
- file g.testlib => g.test_objs + [test_rbobj] do |t|
+ file g.testlib => [g.test_objs, test_rbobj].flatten do |t|
g.build.archiver.run t.name, t.prerequisites
end
file test_rbobj => test_rbc
- file test_rbc => g.test_rbfiles + [g.build.mrbcfile, libfile("#{build_dir}/lib/libmruby")] do |t|
+ file test_rbc => [g.test_rbfiles].flatten + [g.build.mrbcfile, libfile("#{build_dir}/lib/libmruby")] do |t|
open(t.name, 'w') do |f|
g.print_gem_init_header(f)
g.build.mrbc.run f, g.test_preload, "gem_test_irep_#{g.funcname}_preload"
- g.test_rbfiles.each_with_index do |rbfile, i|
+ g.test_rbfiles.flatten.each_with_index do |rbfile, i|
g.build.mrbc.run f, rbfile, "gem_test_irep_#{g.funcname}_#{i}"
end
f.puts %Q[void mrb_#{g.funcname}_gem_test(mrb_state *mrb);] unless g.test_objs.empty?
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index bcae9dfd9..b9e0d2749 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -63,12 +63,11 @@ module MRuby
if ENV['OS'] == 'Windows_NT'
@exts = Exts.new('.o', '.exe', '.a')
- @file_separator = '\\'
else
@exts = Exts.new('.o', '', '.a')
- @file_separator = '/'
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))
@@ -113,7 +112,7 @@ module MRuby
def filename(name)
if name.is_a?(Array)
- name.map { |n| filename(n) }
+ name.flatten.map { |n| filename(n) }
else
'"%s"' % name.gsub('/', file_separator)
end
@@ -121,7 +120,7 @@ module MRuby
def exefile(name)
if name.is_a?(Array)
- name.map { |n| exefile(n) }
+ name.flatten.map { |n| exefile(n) }
else
"#{name}#{exts.executable}"
end
@@ -129,7 +128,7 @@ module MRuby
def objfile(name)
if name.is_a?(Array)
- name.map { |n| objfile(n) }
+ name.flatten.map { |n| objfile(n) }
else
"#{name}#{exts.object}"
end
@@ -137,7 +136,7 @@ module MRuby
def libfile(name)
if name.is_a?(Array)
- name.map { |n| libfile(n) }
+ name.flatten.map { |n| libfile(n) }
else
"#{name}#{exts.library}"
end
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake
index 023b23763..8ffafe9b0 100644
--- a/tasks/mruby_build_commands.rake
+++ b/tasks/mruby_build_commands.rake
@@ -45,12 +45,22 @@ module MRuby
@option_define = '-D%s'
@compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
end
+
+ def all_flags(_defineds=[], _include_paths=[], _flags=[])
+ define_flags = [defines, _defineds].flatten.map{ |d| option_define % d }
+ include_path_flags = [include_paths, _include_paths].flatten.map{ |f| option_include_path % filename(f) }
+ [flags, define_flags, include_path_flags, _flags].flatten.join(' ')
+ end
def run(outfile, infile, _defineds=[], _include_paths=[], _flags=[])
FileUtils.mkdir_p File.dirname(outfile)
define_flags = [defines, _defineds].flatten.map{ |d| option_define % d }
- include_path_flags = [include_paths, _include_paths, File.dirname(infile)].flatten.map{ |f| option_include_path % filename(f) }
- _run compile_options, { :flags => (flags + define_flags + include_path_flags + _flags).join(' '), :infile => filename(infile), :outfile => filename(outfile) }
+ include_path_flags = [include_paths, _include_paths, File.dirname(infile)].flatten.map do |f|
+ option_include_path % filename(f)
+ end
+ _pp "CC #{filename(infile)} > #{filename(outfile)}"
+ _run compile_options, { :flags => (flags + define_flags + include_path_flags + _flags).join(' '),
+ :infile => filename(infile), :outfile => filename(outfile) }
end
def define_rules(build_dir, source_dir='')
@@ -108,11 +118,23 @@ module MRuby
@link_options = "%{flags} -o %{outfile} %{objs} %{libs}"
end
+ def all_flags(_library_paths=[], _flags=[])
+ library_path_flags = [library_paths, _library_paths].flatten.map{ |f| option_library_path % filename(f) }
+ [flags, library_path_flags, _flags].flatten.join(' ')
+ end
+
+ def library_flags(_libraries)
+ [libraries, _libraries].flatten.reverse.map{ |d| option_library % d }.join(' ')
+ end
+
def run(outfile, objfiles, _libraries=[], _library_paths=[], _flags=[])
FileUtils.mkdir_p File.dirname(outfile)
library_flags = [libraries, _libraries].flatten.reverse.map{ |d| option_library % d }
library_path_flags = [library_paths, _library_paths].flatten.map{ |f| option_library_path % filename(f) }
- _run link_options, { :flags => (flags + library_path_flags + _flags).join(' '), :outfile => filename(outfile) , :objs => filename(objfiles).join(' '), :libs => library_flags.join(' ') }
+ _pp "LD #{filename(outfile)}"
+ _run link_options, { :flags => (flags + library_path_flags + _flags).join(' '),
+ :outfile => filename(outfile) , :objs => filename(objfiles).join(' '),
+ :libs => library_flags.join(' ') }
end
end
@@ -127,6 +149,7 @@ module MRuby
def run(outfile, objfiles)
FileUtils.mkdir_p File.dirname(outfile)
+ _pp "AR #{filename(outfile)}"
_run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).join(' ') }
end
end
@@ -142,6 +165,7 @@ module MRuby
def run(outfile, infile)
FileUtils.mkdir_p File.dirname(outfile)
+ _pp "YACC #{filename(infile)} > #{filename(outfile)}"
_run compile_options, { :outfile => filename(outfile) , :infile => filename(infile) }
end
end
@@ -157,6 +181,7 @@ module MRuby
def run(outfile, infile)
FileUtils.mkdir_p File.dirname(outfile)
+ _pp "GPERF #{filename(infile)} > #{filename(outfile)}"
_run compile_options, { :outfile => filename(outfile) , :infile => filename(infile) }
end
end
@@ -173,6 +198,7 @@ module MRuby
end
def run_clone(dir, url, _flags = [])
+ _pp "GIT #{url} > #{filename(dir)}"
_run clone_options, { :flags => [flags, _flags].flatten.join(' '), :url => url, :dir => filename(dir) }
end
end
@@ -188,6 +214,7 @@ module MRuby
@command ||= @build.mrbcfile
IO.popen("#{filename @command} #{@compile_options % {:funcname => funcname}}", 'r+') do |io|
[infiles].flatten.each do |f|
+ _pp " MRBC #{f}"
io.write IO.read(f)
end
io.close_write
@@ -195,4 +222,4 @@ module MRuby
end
end
end
-end \ No newline at end of file
+end
diff --git a/tasks/ruby_ext.rake b/tasks/ruby_ext.rake
index 7422e3faf..2536a2e4b 100644
--- a/tasks/ruby_ext.rake
+++ b/tasks/ruby_ext.rake
@@ -37,3 +37,26 @@ class Symbol
proc { |obj, *args| obj.send(self, *args) }
end
end
+
+$pp_show = true
+
+if $verbose.nil?
+ unless Rake.verbose.nil?
+ if Rake.verbose.class == TrueClass
+ # verbose message logging
+ $pp_show = false
+ else
+ $pp_show = true
+ Rake.verbose(false)
+ end
+ else
+ # could not identify rake version
+ $pp_show = false
+ end
+else
+ $pp_show = false if $verbose
+end
+
+def _pp(msg)
+ puts msg if $pp_show
+end
diff --git a/tasks/toolchains/vs2012.rake b/tasks/toolchains/vs2012.rake
index 8b4212468..1f6ea2d65 100644
--- a/tasks/toolchains/vs2012.rake
+++ b/tasks/toolchains/vs2012.rake
@@ -12,8 +12,8 @@ MRuby::Toolchain.new(:vs2012) do |conf|
conf.linker do |linker|
linker.command = ENV['LD'] || 'link.exe'
linker.flags = [ENV['LDFLAGS'] || %w(/nologo)]
- linkerraries = %w(kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32)
- linkerrary_paths = []
+ linker.libraries = %w(kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32)
+ linker.library_paths = []
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{libs}"
diff --git a/test/mrbtest.rake b/test/mrbtest.rake
index 591b737cd..76ddc30f8 100644
--- a/test/mrbtest.rake
+++ b/test/mrbtest.rake
@@ -8,7 +8,7 @@ MRuby.each_target do
init = "#{dir}/init_mrbtest.c"
asslib = "#{dir}/assert.rb"
- objs = [objfile("#{build_dir}/#{dir}/driver"), mlib]
+ objs = [objfile("#{build_dir}/#{dir}/driver"), mlib].flatten
file exec => objs + gems.map(&:testlib) + [libfile("#{build_dir}/lib/libmruby")] do |t|
gem_flags = gems.map { |g| g.linker.flags }
@@ -19,6 +19,7 @@ MRuby.each_target do
file mlib => [clib]
file clib => [mrbcfile, init, asslib] + mrbs do |t|
+ _pp "GEN *.rb > #{clib}"
open(clib, 'w') do |f|
f.puts IO.read(init)
mrbc.run f, [asslib] + mrbs, 'mrbtest_irep'
diff --git a/tools/mirb/mirb.rake b/tools/mirb/mirb.rake
index 9f41fff64..0c340a2f5 100644
--- a/tools/mirb/mirb.rake
+++ b/tools/mirb/mirb.rake
@@ -3,7 +3,7 @@ MRuby.each_target do
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")) }
+ objs = Dir.glob("#{dir}/*.c").map { |f| objfile(f.pathmap("#{build_dir}/%X")) }.flatten
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 248433cf0..0121b7f81 100644
--- a/tools/mrbc/mrbc.rake
+++ b/tools/mrbc/mrbc.rake
@@ -3,7 +3,7 @@ MRuby.each_target do
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")) }
+ objs = Dir.glob("#{dir}/*.c").map { |f| objfile(f.pathmap("#{build_dir}/%X")) }.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 d380cb9f5..df31b0343 100644
--- a/tools/mruby/mruby.rake
+++ b/tools/mruby/mruby.rake
@@ -3,7 +3,7 @@ MRuby.each_target do
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")) }
+ objs = Dir.glob("#{dir}/*.c").map { |f| objfile(f.pathmap("#{build_dir}/%X")) }.flatten
file exec => objs + [libfile("#{build_dir}/lib/libmruby")] do |t|
gem_flags = gems.map { |g| g.linker.flags }