change builder VARIABLE_DEFAULTS constant to default_variables() class method
This commit is contained in:
parent
256e341e5e
commit
a724d9b2a9
@ -1,6 +1,7 @@
|
||||
module Rscons
|
||||
class CC < Builder
|
||||
VARIABLE_DEFAULTS = {
|
||||
def self.default_variables(env)
|
||||
{
|
||||
'CC' => 'gcc',
|
||||
'CFLAGS' => [],
|
||||
'CPPFLAGS' => [],
|
||||
@ -8,6 +9,7 @@ module Rscons
|
||||
'CEXTS' => ['.c'],
|
||||
'CCCOM' => ['$CC', '-c', '-o', '$TARGET', '$CPPFLAGS', '$CFLAGS', '$SOURCES']
|
||||
}
|
||||
end
|
||||
|
||||
def self.produces?(env, suffix)
|
||||
suffix == env['OBJSUFFIX']
|
||||
|
@ -1,6 +1,7 @@
|
||||
module Rscons
|
||||
class Program < Builder
|
||||
VARIABLE_DEFAULTS = {
|
||||
def self.default_variables(env)
|
||||
{
|
||||
'LD' => nil,
|
||||
'OBJSUFFIX' => '.o',
|
||||
'LIBSUFFIX' => '.a',
|
||||
@ -9,6 +10,7 @@ module Rscons
|
||||
'LIBS' => [],
|
||||
'LDCOM' => ['$LD', '-o', '$TARGET', '$LDFLAGS', '$SOURCES', '-L$[LIBPATHS]', '-l$[LIBS]']
|
||||
}
|
||||
end
|
||||
|
||||
def run(env, target, sources)
|
||||
sources = [sources] if sources.is_a?(String)
|
||||
|
@ -25,7 +25,7 @@ module Rscons
|
||||
|
||||
def add_builder(builder_class)
|
||||
@builders[builder_class.to_s.split(':').last] = builder_class
|
||||
var_defs = builder_class.const_get('VARIABLE_DEFAULTS')
|
||||
var_defs = builder_class.default_variables(self)
|
||||
if var_defs
|
||||
var_defs.each_pair do |var, val|
|
||||
unless @variables.has_key?(var)
|
||||
|
Loading…
x
Reference in New Issue
Block a user