Class: Comet::Rules::Merge

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/rules/merge.rb

Instance Method Summary collapse

Constructor Details

#initialize(dependencies) ⇒ Merge

Returns a new instance of Merge.



4
5
6
# File 'lib/comet/rules/merge.rb', line 4

def initialize(dependencies)
  @dependencies = dependencies
end

Instance Method Details

#commandsObject



26
27
28
# File 'lib/comet/rules/merge.rb', line 26

def commands
  { COMET_LINK: 'llvm-link' }
end

#contentsObject



15
16
17
18
19
20
# File 'lib/comet/rules/merge.rb', line 15

def contents
  [
    "#{target}: #{@dependencies.map(&:target).uniq.join ' '} | #{Comet::TMPDIR}",
    "\t#{llvm_link.join ' '} -o $@ $^"
  ]
end

#rulesObject



22
23
24
# File 'lib/comet/rules/merge.rb', line 22

def rules
  @dependencies
end

#targetObject



8
9
10
11
12
13
# File 'lib/comet/rules/merge.rb', line 8

def target
  @target ||= Comet::Makefile.fingerprint Hash[
    command: llvm_link,
    dependencies: Set[@dependencies.map(&:target).uniq]
  ], extension: :ll
end