From: david x callaway (dxc_at_[hidden])
Date: 2007-01-03 08:15:34
this mail bounced the first time, sorry if it ends up double-posted.
does the solution below seem correct?
common.Clean doesn't appear to be conditioned on --clean:
actions piecemeal together existing Clean
I got a variation of the code I sent earlier (see below) to work. with
this I can say
rm-on-clean *~ relative/path/blah.txt name.txt ; # etc
and it seems to work, including files and directories with whitespace in
them. if you insist, you can give a file like "x\\y.txt" on linux, and
it seems to correctly get flipped, so I assume the opposite would happen
with unix-style paths on windows. I don't have a windows box though, so
I'm not sure about that.
the major problem I had was getting it to work in subdirectory Jamfiles.
does the code look right? it seems to work, but it seems awfully
complicated to do something simple. the idea is to flip the '/' or '\\'
first, then build the full path to the (possible) pattern, then glob,
then delete the files.
it won't delete things over in the install directories because these are
not generated files, but I don't care about that since I will typically
just wipe them from the top.
rule rm-on-clean ( files * )
local argv = [ modules.peek : ARGV ] ;
if "clean" in $(argv) || "--clean" in $(argv)
local cmd ;
if [ os.on-windows ]
cmd = "del /f /q" ;
cmd = "rm -f" ;
local native_names ;
# flip the leaning toothpicks before expansion
for local name in $(files)
local normalized = [ path.make $(name) ] ;
native_names += [ path.native $(normalized) ] ;
local caller = [ utility.caller-file ] ;
local dirname = [ path.parent $(caller) ] ;
for local name in $(native_names)
local del_list = [ path.glob $(dirname) : $(name) ] ;
for local file in $(del_list)
if [ path.exists $(file) ]
ECHO "$(cmd) $(file)" ;
SHELL "$(cmd) \"$(file)\"" ;
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