class Shog::Link

Attributes

bin[RW]
implicit_input[RW]

Public Class Methods

new() click to toggle source
# File lib/rule/link.rb, line 7
def initialize
  @implicit_input = PathSet.new
end

Public Instance Methods

id() click to toggle source
# File lib/rule/link.rb, line 11
def id
  :ld
end
rule() click to toggle source
# File lib/rule/link.rb, line 15
def rule
  {
    "command" => "$bin $ldflags $in -o $out",
    "description" => "Linking $out",
  }
end
target(params) click to toggle source
# File lib/rule/link.rb, line 22
def target(params)
  output = PathSet.make(Path.make(params[:output], :outoftree => true))
  input = PathSet.make(params[:input])
  ldflags = params[:ldflags]
  if ldflags.nil?
    ldflags = ""
  elsif ldflags.is_a?(Array)
    ldflags = ldflags.join(" ")
  end
  variables = {
    "ldflags" => ldflags,
    "bin" => params[:bin] || @bin || "gcc",
  }
  implicit_input = @implicit_input.dup
  implicit_input += params[:implicit_input] if params[:implicit_input]
  {:rule => "ld", :input => input, :implicit_input => implicit_input, :output => output, :variables => variables}
end