Module: L::LD::LinkerGCC
- Defined in:
- lib/rub/l/ld/linker/gcc.rb
Class Method Summary collapse
- .available? ⇒ Boolean
-
.find ⇒ Pathname?
Find the linker executable.
- .link_command(opt, files, libs, out, format) ⇒ Object
- .name ⇒ Object
Class Method Details
.available? ⇒ Boolean
32 33 34 |
# File 'lib/rub/l/ld/linker/gcc.rb', line 32 def self.available? !!find end |
.find ⇒ Pathname?
Find the linker executable.
38 39 40 |
# File 'lib/rub/l/ld/linker/gcc.rb', line 38 def self.find C.find_command 'gcc' end |
.link_command(opt, files, libs, out, format) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rub/l/ld/linker/gcc.rb', line 42 def self.link_command(opt, files, libs, out, format) files = R::Tool.make_set_paths files libs = R::Tool.make_set libs out = C.path(out) c = [find, "-o#{out}"] c << opt.args c << case format when :exe [] when :shared ['-shared'] else raise "Unknown/unsupported output #{format}." end c << case opt.optimize when :none D:debug ? '-Og' : '-O0' when :some '-O1' when :full '-O2' when :max '-O3' else raise "Invalid optimization level #{opt.optimize}." end c << if opt.static '-static' else [] end c << opt.library_dirs.map{|d| "-L#{d}"} #c << libs.map{|l| "-l#{l}" } c << libs.map{|l| "#{l}" } c << files.to_a c.flatten end |
.name ⇒ Object
28 29 30 |
# File 'lib/rub/l/ld/linker/gcc.rb', line 28 def self.name :gcc end |