rscons/build_tests/two_sources/cache_strict_deps.rb
Josh Holtrop ef7e9259cb Add shortcut method for creating environments - close #149
Add env() method to create environments.
Process all environments created at build script top level before
executing any autoconf-enabled tasks, or if no tasks are specified by
the user.
2022-02-12 21:59:52 -05:00

23 lines
604 B
Ruby

class StrictBuilder < Rscons::Builder
def run(options)
if @command
finalize_command
else
@command = %W[gcc -o #{@target}] + @sources.sort
if @cache.up_to_date?(@target, @command, @sources, @env, strict_deps: true)
true
else
register_command("#{name} #{@target}", @command)
end
end
end
end
env(echo: :command) do |env|
env.add_builder(StrictBuilder)
env.Object("one.o", "one.c", "CCFLAGS" => %w[-DONE])
env.Object("two.o", "two.c")
sources = File.read("sources", mode: "rb").split(" ")
env.StrictBuilder("program.exe", sources)
end