32 lines
794 B
Ruby

module Rscons
class CC < Builder
def self.default_variables(env)
{
'CC' => 'gcc',
'CFLAGS' => [],
'CPPFLAGS' => [],
'OBJSUFFIX' => '.o',
'CEXTS' => ['.c'],
'CCCOM' => ['$CC', '-c', '-o', '$TARGET', '$CPPFLAGS', '$CFLAGS', '$SOURCES']
}
end
def self.produces?(env, suffix)
suffix == env['OBJSUFFIX']
end
def run(env, target, source)
raise "String expected, not #{source.inspect}" unless source.is_a?(String)
unless Cache.open.up_to_date?(target, [source])
vars = {
'TARGET' => target,
'SOURCES' => source,
}
env.execute("CC #{target}", env['CCCOM'], vars)
Cache.open.register_build(target, [source])
end
target
end
end
end