|
Boost-Build : |
From: david x callaway (dxc_at_[hidden])
Date: 2006-12-21 20:31:46
I'm using:
Boost.Build V2 (Milestone 11)
Boost.Jam 03.1.13
how can I add files that weren't built to the clean list? I'd like to
be able to do what this makefile fragment does:
-----snip-----
RMV = rm -f
clean:
-$(RMV) *~ $(LIBOBJECTS) $(TARGET)
-----snip-----
the "*~" files are leftover emacs backup files, but they could be
anything. of course I'd like to be able to list arbitrary files as well
as globs, for instance I may know that running a test leaves certain
residue that I want to remove.
there was a bit of code in a thread from 29-aug-2005, however I thought
maybe by now there is a better solution (since it is a pretty common
problem). the code shown doesn't deal with globs, and I don't know what
happens if I use a glob that doesn't produce any files, i.e. "*~" is
just a literal string in bash if no files match. I guess the file test
below would catch that, so maybe it would be ok?
anyway, my first question would be does the rule already exist in m11,
or do I need to add the code below or something similar to make it work?
it would be nice if I could just do
rm-on-clean : *~ *.whatever file1.txt etc.txt ;
thx
dxc
-----snip-----
rule rm-on-clean ( files + )
{
local argv = [ modules.peek : ARGV ] ;
if "clean" in $(argv) || "--clean" in $(argv)
{
import os ;
import path ;
local jamfile_path = [ path.parent [ path.make
$(__file__) ] ] ;
local cmd ;
if [ os.on-windows ]
{
cmd = del ;
}
else
{
cmd = rm ;
}
for local file in $(files)
{
file = [ path.native [ path.root $(file)
$(jamfile_path) ] ] ;
if [ path.exists $(file) ]
{
ECHO "rm $(file)" ;
SHELL "$(cmd) \"$(file)\"" ;
}
}
}
}
-----snip-----
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk