Class: Comet::Rules::Link
- Inherits:
-
Object
- Object
- Comet::Rules::Link
- Defined in:
- lib/comet/rules/link.rb
Instance Method Summary collapse
- #commands ⇒ Object
- #contents ⇒ Object
-
#initialize(linker, dependency, libraries, native_sources) ⇒ Link
constructor
A new instance of Link.
- #map_file ⇒ Object
- #rules ⇒ Object
- #target ⇒ Object
Constructor Details
#initialize(linker, dependency, libraries, native_sources) ⇒ Link
Returns a new instance of Link.
4 5 6 7 8 9 |
# File 'lib/comet/rules/link.rb', line 4 def initialize(linker, dependency, libraries, native_sources) @linker = linker @dependency = dependency @libraries = libraries @native_sources = native_sources end |
Instance Method Details
#commands ⇒ Object
41 42 43 |
# File 'lib/comet/rules/link.rb', line 41 def commands { COMET_LD: 'clang' } end |
#contents ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/comet/rules/link.rb', line 28 def contents obj_dependencies = "#{@dependency.target} #{@native_sources.join ' '}" [ "#{target}: #{obj_dependencies} #{@linker.script_ || ''} | #{Comet::TMPDIR}", "\t#{clang_link} #{formatted_script} #{formatted_flags.join ' '} -Wl,-Map=#{map_file} -o $@ #{obj_dependencies} #{formatted_libraries}" ] end |
#map_file ⇒ Object
24 25 26 |
# File 'lib/comet/rules/link.rb', line 24 def map_file target.gsub(/.elf$/, '.map') end |
#rules ⇒ Object
37 38 39 |
# File 'lib/comet/rules/link.rb', line 37 def rules [@dependency] end |
#target ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/comet/rules/link.rb', line 11 def target @target ||= Comet::Makefile.fingerprint Hash[ dependency: @dependency.target, triple: @linker.triple, isa: @linker.isa, cpu: @linker.cpu, script: @linker.script_, libraries: formatted_libraries, native_sources: @native_sources, flags: formatted_flags ], extension: :elf end |