Do not rebuild targets when they are up to date
Store dependencies and file checksums in a cache file
This commit is contained in:
1 parent
8af27d7775
commit
119f3c9f0f
5 files changed
+110
-17
No files matched your search
@@ -17,14 +17,17 @@ module Rscons
|
||||
def run(env, target, source)
|
||||
raise "String expected, not #{source.inspect}" unless source.is_a?(String)
|
||||
o_file = "#{env.stem(source)}#{env['OBJSUFFIX']}"
|
||||
command = [
|
||||
env['CC'],
|
||||
*env['CPPFLAGS'],
|
||||
*env['CFLAGS'],
|
||||
'-o', o_file,
|
||||
source
|
||||
]
|
||||
env.execute("CC #{o_file}", command)
|
||||
unless Cache.open.up_to_date?(target, [source])
|
||||
command = [
|
||||
env['CC'],
|
||||
*env['CPPFLAGS'],
|
||||
*env['CFLAGS'],
|
||||
'-o', o_file,
|
||||
source
|
||||
]
|
||||
env.execute("CC #{o_file}", command)
|
||||
Cache.open.register_build(target, [source])
|
||||
end
|
||||
o_file
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,6 +11,7 @@ module Rscons
|
||||
|
||||
def run(env, target, sources)
|
||||
sources = [sources] if sources.is_a?(String)
|
||||
# convert sources to object file names
|
||||
sources = sources.map do |source|
|
||||
if source =~ /#{env['OBJSUFFIX']}$/ or source =~ /#{env['LIBSUFFIX']}$/
|
||||
source
|
||||
@@ -24,15 +25,18 @@ module Rscons
|
||||
end
|
||||
end
|
||||
end
|
||||
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)
|
||||
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}"}
|
||||
]
|
||||
env.execute("LINK #{target}", command)
|
||||
Cache.open.register_build(target, sources)
|
||||
end
|
||||
target
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user