[331] | 1 | # usage of environmental variables to set the
|
---|
| 2 | # cross compiling toolchain proper
|
---|
| 3 | MRuby::Toolchain.new(:openwrt) do |conf|
|
---|
| 4 | [conf.cc, conf.objc, conf.asm].each do |cc|
|
---|
| 5 | cc.command = ENV['TARGET_CC']
|
---|
| 6 | cc.flags = ENV['TARGET_CFLAGS']
|
---|
| 7 | cc.include_paths = ["#{MRUBY_ROOT}/include"]
|
---|
[439] | 8 | cc.option_include_path = %q[-I"%s"]
|
---|
[331] | 9 | cc.option_define = '-D%s'
|
---|
[439] | 10 | cc.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
|
---|
[331] | 11 | end
|
---|
| 12 |
|
---|
| 13 | [conf.cxx].each do |cxx|
|
---|
| 14 | cxx.command = ENV['TARGET_CXX']
|
---|
| 15 | cxx.flags = ENV['TARGET_CXXFLAGS']
|
---|
| 16 | cxx.include_paths = ["#{MRUBY_ROOT}/include"]
|
---|
[439] | 17 | cxx.option_include_path = %q[-I"%s"]
|
---|
[331] | 18 | cxx.option_define = '-D%s'
|
---|
[439] | 19 | cxx.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
|
---|
[331] | 20 | end
|
---|
| 21 |
|
---|
| 22 | conf.linker do |linker|
|
---|
| 23 | linker.command = ENV['TARGET_CC']
|
---|
| 24 | linker.flags = ENV['TARGET_LDFLAGS']
|
---|
| 25 | linker.libraries = %w(m)
|
---|
| 26 | linker.library_paths = []
|
---|
| 27 | linker.option_library = '-l%s'
|
---|
| 28 | linker.option_library_path = '-L%s'
|
---|
[439] | 29 | linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
|
---|
[331] | 30 | end
|
---|
| 31 |
|
---|
| 32 | conf.archiver do |archiver|
|
---|
| 33 | archiver.command = ENV['TARGET_AR']
|
---|
[439] | 34 | archiver.archive_options = 'rs "%{outfile}" %{objs}'
|
---|
[331] | 35 | end
|
---|
| 36 | end
|
---|