The builder's #run method will be called repeatedly until it returns true or false. The Builder#wait_for method can be used to cause a builder to wait for a Thread, Command, or another Builder.
25 lines
643 B
Ruby
25 lines
643 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
|
|
|
|
build do
|
|
Environment.new(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
|
|
end
|