diff options
author | Evan Martin <martine@danga.com> | 2011-06-30 17:20:54 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-06-30 17:22:10 (GMT) |
commit | df560ebcacc7d69c532add1c4b834efafda55db7 (patch) | |
tree | 51cea96db883e7c408400a8007838f001d5b5ff2 /src/clean.cc | |
parent | 71a7edcee3b670f234d353fe1cb46810b9f2e414 (diff) | |
download | Ninja-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.cc | 11 |
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_; } |