summaryrefslogtreecommitdiffstats
path: root/src/clean.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-06-30 17:20:54 (GMT)
committerEvan Martin <martine@danga.com>2011-06-30 17:22:10 (GMT)
commitdf560ebcacc7d69c532add1c4b834efafda55db7 (patch)
tree51cea96db883e7c408400a8007838f001d5b5ff2 /src/clean.cc
parent71a7edcee3b670f234d353fe1cb46810b9f2e414 (diff)
downloadNinja-df560ebcacc7d69c532add1c4b834efafda55db7.zip
Ninja-df560ebcacc7d69c532add1c4b834efafda55db7.tar.gz
Ninja-df560ebcacc7d69c532add1c4b834efafda55db7.tar.bz2
clean: don't delete phony targets
Based on a patch from John Birtley.
Diffstat (limited to 'src/clean.cc')
-rw-r--r--src/clean.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/clean.cc b/src/clean.cc
index e86793e..d6436ad 100644
--- a/src/clean.cc
+++ b/src/clean.cc
@@ -102,12 +102,15 @@ int Cleaner::CleanAll() {
Reset();
PrintHeader();
for (vector<Edge*>::iterator e = state_->edges_.begin();
- e != state_->edges_.end();
- ++e)
+ e != state_->edges_.end(); ++e) {
+ // Do not try to remove phony targets
+ if ((*e)->rule_ == &State::kPhonyRule)
+ continue;
for (vector<Node*>::iterator out_node = (*e)->outputs_.begin();
- out_node != (*e)->outputs_.end();
- ++out_node)
+ out_node != (*e)->outputs_.end(); ++out_node) {
Remove((*out_node)->file_->path_);
+ }
+ }
PrintFooter();
return status_;
}