add Environment.execute(); implement first version of Program builder
This commit is contained in:
parent
3b8763a424
commit
62e9bfa5d3
@ -7,7 +7,7 @@ module Rscons
|
|||||||
'OBJSUFFIX' => '.o',
|
'OBJSUFFIX' => '.o',
|
||||||
}
|
}
|
||||||
|
|
||||||
def run(env, sources)
|
def run(env, target, sources)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,10 +5,20 @@ module Rscons
|
|||||||
'OBJSUFFIX' => '.o',
|
'OBJSUFFIX' => '.o',
|
||||||
'LIBSUFFIX' => '.a',
|
'LIBSUFFIX' => '.a',
|
||||||
'LDFLAGS' => [],
|
'LDFLAGS' => [],
|
||||||
|
'LIBPATHS' => [],
|
||||||
'LIBS' => [],
|
'LIBS' => [],
|
||||||
}
|
}
|
||||||
|
|
||||||
def run(env, sources)
|
def run(env, target, sources)
|
||||||
|
command = [
|
||||||
|
env['LD'] || env['CC'],
|
||||||
|
'-o', target,
|
||||||
|
*env['LDFLAGS'],
|
||||||
|
*sources,
|
||||||
|
*env['LIBPATHS'].map {|lp| "-L#{lp}"},
|
||||||
|
*env['LIBS'].map {|lib| "-l#{lib}"}
|
||||||
|
]
|
||||||
|
env.execute("LINK #{target}", command)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -44,11 +44,20 @@ module Rscons
|
|||||||
@build_dirs[src_dir] = build_dir
|
@build_dirs[src_dir] = build_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def execute(short_desc, command)
|
||||||
|
if @echo == :command
|
||||||
|
puts command.join(' ')
|
||||||
|
elsif @echo == :short
|
||||||
|
puts short_desc
|
||||||
|
end
|
||||||
|
system(*command)
|
||||||
|
end
|
||||||
|
|
||||||
def method_missing(method, *args)
|
def method_missing(method, *args)
|
||||||
if @builders.has_key?(method.to_s)
|
if @builders.has_key?(method.to_s)
|
||||||
# TODO: build sources if necessary
|
# TODO: build sources if necessary
|
||||||
builder = @builders[method.to_s].new
|
builder = @builders[method.to_s].new
|
||||||
builder.run(self, args.first)
|
builder.run(self, *args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user