implement Cache to store info about target dependencies and checksums across invocations

This commit is contained in:
josh committed 2013-07-14 21:51:31 -04:00
1 parent 9c69a45f77
commit 0bf71ae4d1
4 files changed
+81 -23

No files matched your search

+9 -8
View File
@@ -17,19 +17,20 @@ module Rscons
end
def run(target, sources, cache)
unless cache.up_to_date?(target, sources)
vars = {
'TARGET' => target,
'SOURCES' => sources,
'DEPFILE' => target.set_suffix('.mf'),
}
@env.execute("CC #{target}", @env['CCCOM'], vars)
vars = {
'TARGET' => target,
'SOURCES' => sources,
'DEPFILE' => target.set_suffix('.mf'),
}
command = @env.build_command(@env['CCCOM'], vars)
unless cache.up_to_date?(target, command, sources)
return false unless @env.execute("CC #{target}", command)
deps = sources
if File.exists?(vars['DEPFILE'])
deps += @env.parse_makefile_deps(vars['DEPFILE'], target)
FileUtils.rm_f(vars['DEPFILE'])
end
cache.register_build(target, deps.uniq)
cache.register_build(target, command, deps.uniq)
end
target
end
+9 -7
View File
@@ -24,13 +24,15 @@ module Rscons
builder.run(o_file, [source], cache)
end
end
unless cache.up_to_date?(target, sources)
vars = {
'TARGET' => target,
'SOURCES' => sources,
'LD' => @env['LD'] || @env['CC'], # TODO: figure out whether to use CC or CXX
}
@env.execute("LD #{target}", @env['LDCOM'], vars)
vars = {
'TARGET' => target,
'SOURCES' => sources,
'LD' => @env['LD'] || @env['CC'], # TODO: figure out whether to use CC or CXX
}
command = @env.build_command(@env['LDCOM'], vars)
unless cache.up_to_date?(target, command, sources)
return false unless @env.execute("LD #{target}", command)
cache.register_build(target, command, sources)
end
target
end