parameters: (self, outputs, inputs, actions=None, comment=None,
                      order_only=False, force=False, phony=False, command=None)
docstring: Write a Makefile rule, with some extra tricks.
  
      outputs: a list of outputs for the rule (note: this is not directly
               supported by make; see comments below)
      inputs: a list of inputs for the rule
      actions: a list of shell commands to run for the rule
      comment: a comment to put in the Makefile above the rule (also useful
               for making this Python script's code self-documenting)
      order_only: if true, makes the dependency order-only
      force: if true, include FORCE_DO_CMD as an order-only dep
      phony: if true, the rule does not actually generate the named output, the
             output is just a name to run the rule
      command: (optional) command name to generate unambiguous labels
docstring_summary: Write a Makefile rule, with some extra tricks.
docstring_tokens: Write a Makefile rule with some extra tricks .
function: def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
                      order_only=False, force=False, phony=False, command=None):
      """Write a Makefile rule, with some extra tricks.
  
      outputs: a list of outputs for the rule (note: this is not directly
               supported by make; see comments below)
      inputs: a list of inputs for the rule
      actions: a list of shell commands to run for the rule
      comment: a comment to put in the Makefile above the rule (also useful
               for making this Python script's code self-documenting)
      order_only: if true, makes the dependency order-only
      force: if true, include FORCE_DO_CMD as an order-only dep
      phony: if true, the rule does not actually generate the named output, the
             output is just a name to run the rule
      command: (optional) command name to generate unambiguous labels
      """
      outputs = map(QuoteSpaces, outputs)
      inputs = map(QuoteSpaces, inputs)
  
      if comment:
        self.WriteLn('# ' + comment)
      if phony:
        self.WriteLn('.PHONY: ' + ' '.join(outputs))
      if actions:
        self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0])
      force_append = ' FORCE_DO_CMD' if force else ''
  
      if order_only:
        # Order only rule: Just write a simple rule.
        # TODO(evanm): just make order_only a list of deps instead of this hack.
        self.WriteLn('%s: | %s%s' %
                     (' '.join(outputs), ' '.join(inputs), force_append))
      elif len(outputs) == 1:
        # Regular rule, one output: Just write a simple rule.
        self.WriteLn('%s: %s%s' % (outputs[0], ' '.join(inputs), force_append))
      else:
        # Regular rule, more than one output: Multiple outputs are tricky in
        # make. We will write three rules:
        # - All outputs depend on an intermediate file.
        # - Make .INTERMEDIATE depend on the intermediate.
        # - The intermediate file depends on the inputs and executes the
        #   actual command.
        # - The intermediate recipe will 'touch' the intermediate file.
        # - The multi-output rule will have an do-nothing recipe.
        intermediate = "%s.intermediate" % (command if command else self.target)
        self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
        self.WriteLn('\t%s' % '@:');
        self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate))
        self.WriteLn('%s: %s%s' %
                     (intermediate, ' '.join(inputs), force_append))
        actions.insert(0, '$(call do_cmd,touch)')
  
      if actions:
        for action in actions:
          self.WriteLn('\t%s' % action)
      self.WriteLn()
function_tokens: def WriteMakeRule ( self , outputs , inputs , actions = None , comment = None , order_only = False , force = False , phony = False , command = None ) : outputs = map ( QuoteSpaces , outputs ) inputs = map ( QuoteSpaces , inputs ) if comment : self . WriteLn ( '# ' + comment ) if phony : self . WriteLn ( '.PHONY: ' + ' ' . join ( outputs ) ) if actions : self . WriteLn ( "%s: TOOLSET := $(TOOLSET)" % outputs [ 0 ] ) force_append = ' FORCE_DO_CMD' if force else '' if order_only : # Order only rule: Just write a simple rule. # TODO(evanm): just make order_only a list of deps instead of this hack. self . WriteLn ( '%s: | %s%s' % ( ' ' . join ( outputs ) , ' ' . join ( inputs ) , force_append ) ) elif len ( outputs ) == 1 : # Regular rule, one output: Just write a simple rule. self . WriteLn ( '%s: %s%s' % ( outputs [ 0 ] , ' ' . join ( inputs ) , force_append ) ) else : # Regular rule, more than one output: Multiple outputs are tricky in # make. We will write three rules: # - All outputs depend on an intermediate file. # - Make .INTERMEDIATE depend on the intermediate. # - The intermediate file depends on the inputs and executes the #   actual command. # - The intermediate recipe will 'touch' the intermediate file. # - The multi-output rule will have an do-nothing recipe. intermediate = "%s.intermediate" % ( command if command else self . target ) self . WriteLn ( '%s: %s' % ( ' ' . join ( outputs ) , intermediate ) ) self . WriteLn ( '\t%s' % '@:' ) self . WriteLn ( '%s: %s' % ( '.INTERMEDIATE' , intermediate ) ) self . WriteLn ( '%s: %s%s' % ( intermediate , ' ' . join ( inputs ) , force_append ) ) actions . insert ( 0 , '$(call do_cmd,touch)' ) if actions : for action in actions : self . WriteLn ( '\t%s' % action ) self . WriteLn ( )