Class: Autorake::CompilerPP

Inherits:
Compiler show all
Defined in:
lib/autorake/compile.rb

Direct Known Subclasses

CompilerC

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of CompilerPP.



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/autorake/compile.rb', line 41

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

Instance Method Details

#cc(obj, src) ⇒ Object



54
55
56
57
# File 'lib/autorake/compile.rb', line 54

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