Class: Shog::CC
Instance Attribute Summary collapse
-
#bin ⇒ Object
Returns the value of attribute bin.
-
#cflags ⇒ Object
Returns the value of attribute cflags.
-
#implicit_input ⇒ Object
Returns the value of attribute implicit_input.
-
#includes ⇒ Object
Returns the value of attribute includes.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize ⇒ CC
constructor
A new instance of CC.
- #rule ⇒ Object
- #target(params) ⇒ Object
Constructor Details
Instance Attribute Details
#bin ⇒ Object
Returns the value of attribute bin.
5 6 7 |
# File 'lib/rule/cc.rb', line 5 def bin @bin end |
#cflags ⇒ Object
Returns the value of attribute cflags.
5 6 7 |
# File 'lib/rule/cc.rb', line 5 def cflags @cflags end |
#implicit_input ⇒ Object
Returns the value of attribute implicit_input.
5 6 7 |
# File 'lib/rule/cc.rb', line 5 def implicit_input @implicit_input end |
#includes ⇒ Object
Returns the value of attribute includes.
5 6 7 |
# File 'lib/rule/cc.rb', line 5 def includes @includes end |
Instance Method Details
#id ⇒ Object
7 8 9 |
# File 'lib/rule/cc.rb', line 7 def id :cc end |
#rule ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/rule/cc.rb', line 17 def rule { "command" => "$bin $cflags -MMD -MQ $out -MF $out.d -c $in -o $out", "description" => "Compile $in", "deps" => "gcc", "depfile" => "$out.d", } end |
#target(params) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rule/cc.rb', line 26 def target(params) input = PathSet.new input << params[:input] output = PathSet.new if params[:output] output << Path.make(params[:output], :outoftree => true) else output << Path.make(params[:input].single_path, :outoftree => true).with_suffix(".o") end cflags = @cflags.dup cflags << params[:cflags] if params[:cflags] cflags += @includes.map { |i| "-I" + i } includes = params[:includes] if includes includes = PathSet.make(includes) cflags += includes.map { |i| "-I" + i } end variables = { "cflags" => cflags.join(" "), "bin" => params[:bin] || @bin || "gcc", } implicit_input = @implicit_input.dup implicit_input += params[:implicit_input] if params[:implicit_input] {:rule => "cc", :input => input, :implicit_input => implicit_input, :output => output, :variables => variables} end |