Class: Autorake::Preprocessor

Inherits:
Builder
  • Object
show all
Defined in:
lib/autorake/compile.rb

Direct Known Subclasses

Compiler

Instance Method Summary collapse

Methods inherited from Builder

#cc, #cxx, tmpfiles

Constructor Details

#initialize(incdirs, macros, *args) ⇒ Preprocessor

Returns a new instance of Preprocessor.



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/autorake/compile.rb', line 104

def initialize incdirs, macros, *args
  @incdirs = incdirs.map { |d| "-I#{d}" }
  @macros = macros.map { |k,v|
    next unless v
    m = "-D#{k}"
    m << "=#{v.to_s.inspect}" unless v == true
    m
  }
  @args = args
  e = ENV[ "CFLAGS"]
  @cflags = e.split if e
end

Instance Method Details

#build(obj, src) ⇒ Object



117
118
119
120
# File 'lib/autorake/compile.rb', line 117

def build obj, src
  io = [ "-o", obj.to_s, "-c", src.to_s]
  super @cflags, @args, @macros, @incdirs, opt_E, io
end