diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-09-22 16:04:03 (GMT) |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-10-15 19:23:50 (GMT) |
commit | 7cf2bdffe2a95ea5e30e9c3166ef4398add8e6b9 (patch) | |
tree | 2b8cd622a0fa858beb0b91da121255a82274272b /misc/ninja_syntax.py | |
parent | 07c1f9b14b5f7071a5def7d09414ec852a4372ef (diff) | |
download | Ninja-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 'misc/ninja_syntax.py')
-rw-r--r-- | misc/ninja_syntax.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/misc/ninja_syntax.py b/misc/ninja_syntax.py index aa7e124..6e8a87c 100644 --- a/misc/ninja_syntax.py +++ b/misc/ninja_syntax.py @@ -28,13 +28,16 @@ class Writer(object): value = ' '.join(value) self._line('%s = %s' % (key, value), indent) - def rule(self, name, command, description=None, depfile=None): + def rule(self, name, command, description=None, depfile=None, + generator=False): self._line('rule %s' % name) self.variable('command', command, indent=1) if description: self.variable('description', description, indent=1) if depfile: self.variable('depfile', depfile, indent=1) + if generator: + self.variable('generator', '1', indent=1) def build(self, outputs, rule, inputs=None, implicit=None, order_only=None, variables=None): |