define and use $CCCOM variable for CC command

This commit is contained in:
Josh Holtrop 2013-06-26 21:37:52 -04:00
parent 0f3a6accd7
commit 5e42e9b868

View File

@ -2,10 +2,11 @@ module Rscons
class CC < Builder
VARIABLE_DEFAULTS = {
'CC' => 'gcc',
'CFLAGS' => ['-c'],
'CFLAGS' => [],
'CPPFLAGS' => [],
'OBJSUFFIX' => '.o',
'CEXTS' => ['.c'],
'CCCOM' => ['$CC', '-c', '-o', '$TARGET', '$CPPFLAGS', '$CFLAGS', '$SOURCES']
}
def self.produces?(env, suffix)
@ -16,18 +17,11 @@ module Rscons
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])
command = [
env['CC'],
*env['CPPFLAGS'],
*env['CFLAGS'],
'-o', o_file,
source
]
vars = {
'TARGET' => o_file,
'SOURCES' => source,
}
env.execute("CC #{o_file}", command, vars)
env.execute("CC #{o_file}", env['CCCOM'], vars)
Cache.open.register_build(target, [source])
end
o_file