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