rscons/build_tests/two_sources/cache_strict_deps.rb
Josh Holtrop f8e6666a2c Add 'build' DSL method.
Disallow processing Environments until configuration is performed.
2018-12-17 22:14:35 -05:00

22 lines
736 B
Ruby

class StrictBuilder < Rscons::Builder
def run(options)
target, sources, cache, env = options.values_at(:target, :sources, :cache, :env)
command = %W[gcc -o #{target}] + sources.sort
unless cache.up_to_date?(target, command, sources, env, strict_deps: true)
return false unless env.execute("StrictBuilder #{target}", command)
cache.register_build(target, command, sources, env)
end
target
end
end
build do
Rscons::Environment.new(echo: :command) do |env|
env.add_builder(StrictBuilder.new)
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
end