[Scons-users] global cleanup
Francis Bolduc
fbolduc at gmail.com
Thu Aug 23 08:33:44 EDT 2012
> prg = env.Program()
> env.Clean("clean", [prg, "config.log"])
There is no need to explicitly call "Clean" on files that SCons knows,
such as the product of a builder like "Program". Since SCons knows
them, they will be deleted when you invoke "scons -c" at the
top-level.
Moreover, the "Clean" method takes a target as it's first argument.
The previous code will only work if the target of your SCons
invocation is the "clean" file or directory. What I would do instead
is the following:
prg = env.Program()
env.Clean(prg, "config.log")
This will tell SCons to delete the "config.log" file when deleting the
product of the "Program" builder.
> So I would like to summarize all "clean" calls, so that I can run
> scons cleanall
> and everything is cleared
Here's how I would do it:
bin = env.Program()
a = env.Library()
so = env.SharedLibrary()
allfiles = env.Alias("allfiles", [bin, a, so, "config.log", Glob(...),
Glob(...)])
cleanall = env.Alias("cleanall")
env.Clean(cleanall, allfiles)
Then you invoke "scons -c cleanall" and SCons should remove
everything. If you don't want to invoke SCons with the "-c" option
(the one who activates the "Clean" method), you could also try to use
the "Delete" method. Like this:
env.Delete(cleanall, allfiles)
Then you simply invoke "scons cleanall".
More information about the Scons-users
mailing list