summaryrefslogtreecommitdiffstats
path: root/src/graph.cc
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-09-22 16:04:03 (GMT)
committerPeter Collingbourne <peter@pcc.me.uk>2011-10-15 19:23:50 (GMT)
commit7cf2bdffe2a95ea5e30e9c3166ef4398add8e6b9 (patch)
tree2b8cd622a0fa858beb0b91da121255a82274272b /src/graph.cc
parent07c1f9b14b5f7071a5def7d09414ec852a4372ef (diff)
downloadNinja-7cf2bdffe2a95ea5e30e9c3166ef4398add8e6b9.zip
Ninja-7cf2bdffe2a95ea5e30e9c3166ef4398add8e6b9.tar.gz
Ninja-7cf2bdffe2a95ea5e30e9c3166ef4398add8e6b9.tar.bz2
Implement generator rules
Introduce a rule attribute "generator" which, if present, specifies that this rule is used to re-invoke the generator program. Files built using generator rules are treated specially in two ways: firstly, they will not be rebuilt if the command line changes; and secondly, they are not cleaned by default. A command line flag "-g" is introduced for the clean tool, which causes it to remove generator files. Fixes issue #102.
Diffstat (limited to 'src/graph.cc')
-rw-r--r--src/graph.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/graph.cc b/src/graph.cc
index 0f16519..e1441ea 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -93,8 +93,10 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
(*i)->dirty_ = true;
} else {
// May also be dirty due to the command changing since the last build.
+ // But if this is a generator rule, the command changing does not make us
+ // dirty.
BuildLog::LogEntry* entry;
- if (state->build_log_ &&
+ if (!rule_->generator_ && state->build_log_ &&
(entry = state->build_log_->LookupByOutput((*i)->file_->path_))) {
if (command != entry->command)
(*i)->dirty_ = true;