module Rscons class CC < Builder VARIABLE_DEFAULTS = { 'CC' => 'gcc', 'CFLAGS' => [], 'CPPFLAGS' => [], 'OBJSUFFIX' => '.o', 'CEXTS' => ['.c'], 'CCCOM' => ['$CC', '-c', '-o', '$TARGET', '$CPPFLAGS', '$CFLAGS', '$SOURCES'] } 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) o_file = "#{env.stem(source)}#{env['OBJSUFFIX']}" unless Cache.open.up_to_date?(target, [source]) vars = { 'TARGET' => o_file, 'SOURCES' => source, } env.execute("CC #{o_file}", env['CCCOM'], vars) Cache.open.register_build(target, [source]) end o_file end end end