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

Constructor Details

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

Returns a new instance of Preprocessor.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/autorake/compile.rb', line 53

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



66
67
68
69
# File 'lib/autorake/compile.rb', line 66

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