Class: Comet::Rules::Build
- Inherits:
-
Object
- Object
- Comet::Rules::Build
- Defined in:
- lib/comet/rules/build.rb
Instance Method Summary collapse
- #commands ⇒ Object
- #contents ⇒ Object
-
#initialize(firmware, device) ⇒ Build
constructor
A new instance of Build.
- #rules ⇒ Object
- #target ⇒ Object
Constructor Details
#initialize(firmware, device) ⇒ Build
Returns a new instance of Build.
4 5 6 7 |
# File 'lib/comet/rules/build.rb', line 4 def initialize(firmware, device) @firmware = firmware @device = device end |
Instance Method Details
#commands ⇒ Object
44 45 46 |
# File 'lib/comet/rules/build.rb', line 44 def commands { COMET_CP: 'cp' } end |
#contents ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/comet/rules/build.rb', line 15 def contents contents = [ ".PHONY: #{target}", "#{target}: #{rules.map(&:target).uniq.join ' '}" ] if fw_target.elf? contents.push "\t$(COMET_CP) #{link.target} #{fw_target.elf_output.path}" end if fw_target.bin? contents.push "\t$(COMET_CP) #{bin.target} #{fw_target.bin_output.path}" end if fw_target.hex? contents.push "\t$(COMET_CP) #{hex.target} #{fw_target.hex_output.path}" end if fw_target.map? contents.push "\t$(COMET_CP) #{link.map_file} #{fw_target.map_output.path}" end contents end |
#rules ⇒ Object
40 41 42 |
# File 'lib/comet/rules/build.rb', line 40 def rules @rules ||= [link, bin, hex].compact end |
#target ⇒ Object
9 10 11 12 13 |
# File 'lib/comet/rules/build.rb', line 9 def target @target ||= Comet::Makefile.fingerprint Hash[ dependencies: Set[rules.map(&:target).uniq] ], extension: :phony end |