Class: Shog::ObjCopy

Inherits:
Object show all
Defined in:
lib/rule/objcopy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#binObject

Returns the value of attribute bin.



5
6
7
# File 'lib/rule/objcopy.rb', line 5

def bin
  @bin
end

Instance Method Details

#idObject



7
8
9
# File 'lib/rule/objcopy.rb', line 7

def id
  :objcopy
end

#ruleObject



11
12
13
14
15
16
# File 'lib/rule/objcopy.rb', line 11

def rule
  {
    "command" => "$bin -O $arch $in $out",
    "description" => "Objcopy $out",
  }
end

#target(params) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rule/objcopy.rb', line 18

def target(params)
  input = PathSet.make(params[:input])
  output = if params[:output]
             PathSet.make(Path.make(params[:output], :outoftree => true))
           elsif params[:suffix]
             PathSet.make(Path.make(params[:input], :outoftree => true).with_suffix(params[:suffix]))
           else
             raise "Please either provide output name of suffix for output file"
           end

  variables = {
    "bin" => params[:bin] || @bin || "objcopy",
  }
  variables["arch"] = params[:arch] if params[:arch]
  {:rule => "objcopy", :input => input, :output => output, :variables => variables}
end