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"]
|
---|
8 | cc.option_include_path = %q[-I"%s"]
|
---|
9 | cc.option_define = '-D%s'
|
---|
10 | cc.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
|
---|
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"]
|
---|
17 | cxx.option_include_path = %q[-I"%s"]
|
---|
18 | cxx.option_define = '-D%s'
|
---|
19 | cxx.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
|
---|
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'
|
---|
29 | linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
|
---|
30 | end
|
---|
31 |
|
---|
32 | conf.archiver do |archiver|
|
---|
33 | archiver.command = ENV['TARGET_AR']
|
---|
34 | archiver.archive_options = 'rs "%{outfile}" %{objs}'
|
---|
35 | end
|
---|
36 | end
|
---|