From 1dc59875ed1e072a0c87b10e1bb43d7be2311ec8 Mon Sep 17 00:00:00 2001
From: Mike Buland <eichlan@xagasoft.com>
Date: Tue, 12 Sep 2006 19:33:43 +0000
Subject: clean now works, the -c option will come later.

---
 build.conf         |  2 +-
 src/targetfile.cpp | 20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/build.conf b/build.conf
index 43f176d..18e4eec 100644
--- a/build.conf
+++ b/build.conf
@@ -1,7 +1,7 @@
 # build.conf for build, kind of whacky, eh?
 
 default action: check targets()
-"clean" action: clean "build"
+"clean" action: clean targets()
 "rebuild" action: clean "build", check "build"
 
 set "CXXFLAGS" += "-ggdb -Ilibbu++/src"
diff --git a/src/targetfile.cpp b/src/targetfile.cpp
index ddb1c18..3743297 100644
--- a/src/targetfile.cpp
+++ b/src/targetfile.cpp
@@ -61,7 +61,25 @@ void TargetFile::check( Build &bld )
 
 void TargetFile::clean( Build &bld )
 {
-	printf("Target file cleaning:  %s\n", getName().c_str() );
+	Rule *pRule = bld.getRule( getRule() );
+	PerformList lPerf;
+	pRule->setTarget( getName() );
+	StringList lFinal = pRule->execute( bld, getInput(), lPerf );
+	
+	bld.getView()->beginPerforms( lPerf.size() );
+
+	for( PerformList::iterator i = lPerf.begin(); i != lPerf.end(); i++ )
+	{
+		if( access( (*i)->getTarget().c_str(), W_OK ) == 0 )
+		{
+			bld.getView()->beginPerform( *i );
+			unlink( (*i)->getTarget().c_str() );
+			bld.getView()->endPerform();
+		}
+
+	}
+	
+	bld.getView()->endPerforms();
 }
 
 time_t TargetFile::getTime( Build &bld, std::string str )
-- 
cgit v1.2.3