add and use LDCOM environment variable

This commit is contained in:
Josh Holtrop 2013-06-26 22:07:44 -04:00
parent fbdc773abb
commit 5d8e3fe1fd

View File

@ -7,6 +7,7 @@ module Rscons
'LDFLAGS' => [],
'LIBPATHS' => [],
'LIBS' => [],
'LDCOM' => ['$LD', '-o', '$TARGET', '$LDFLAGS', '$SOURCES', '-L$[LIBPATHS]', '-l$[LIBS]']
}
def run(env, target, sources)
@ -26,19 +27,12 @@ module Rscons
end
end
unless Cache.open.up_to_date?(target, sources)
command = [
env['LD'] || env['CC'],
'-o', target,
*env['LDFLAGS'],
*sources,
*env['LIBPATHS'].map {|lp| "-L#{lp}"},
*env['LIBS'].map {|lib| "-l#{lib}"}
]
vars = {
'TARGET' => target,
'SOURCES' => sources,
'LD' => env['LD'] || env['CC'], # TODO: figure out whether to use CC or CXX
}
env.execute("LINK #{target}", command, vars)
env.execute("LD #{target}", env['LDCOM'], vars)
Cache.open.register_build(target, sources)
end
target