|
Boost-Build : |
From: Daniel Schlyder (daniel_at_[hidden])
Date: 2005-08-28 22:36:29
Hi list,
I want bjam to remove some extra files, not created by building the project,
when invoked with the "clean" target. I've found a way to do this (see code
below) but I can't shake the feeling that there's a much better/simpler way
that I would know about if only I wasn't such a huge BBv2 newbie. :) Help
much appreciated.
My current code:
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)\"" ;
}
}
}
}
-- Daniel Schlyder http://bitblaze.com/
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