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