parameters: (rule_or_module, variable_name, condition, values = [])
docstring: Specifies the flags (variables) that must be set on targets under certain
          conditions, described by arguments.
          rule_or_module:   If contains dot, should be a rule name.
                            The flags will be applied when that rule is
                            used to set up build actions.
  
                            If does not contain dot, should be a module name.
                            The flags will be applied for all rules in that
                            module.
                            If module for rule is different from the calling
                            module, an error is issued.
  
           variable_name:   Variable that should be set on target
  
           condition        A condition when this flag should be applied.
                            Should be set of property sets. If one of
                            those property sets is contained in build
                            properties, the flag will be used.
                            Implied values are not allowed:
                            "<toolset>gcc" should be used, not just
                            "gcc". Subfeatures, like in "<toolset>gcc-3.2"
                            are allowed. If left empty, the flag will
                            always used.
  
                            Propery sets may use value-less properties
                            ('<a>'  vs. '<a>value') to match absent
                            properties. This allows to separately match
  
                               <architecture>/<address-model>64
                               <architecture>ia64/<address-model>
  
                            Where both features are optional. Without this
                            syntax we'd be forced to define "default" value.
  
           values:          The value to add to variable. If <feature>
                            is specified, then the value of 'feature'
                            will be added.
docstring_summary: Specifies the flags (variables) that must be set on targets under certain
          conditions, described by arguments.
          rule_or_module:   If contains dot, should be a rule name.
                            The flags will be applied when that rule is
                            used to set up build actions.
docstring_tokens: Specifies the flags ( variables ) that must be set on targets under certain conditions described by arguments . rule_or_module : If contains dot should be a rule name . The flags will be applied when that rule is used to set up build actions .
function: def flags(rule_or_module, variable_name, condition, values = []):
      """ Specifies the flags (variables) that must be set on targets under certain
          conditions, described by arguments.
          rule_or_module:   If contains dot, should be a rule name.
                            The flags will be applied when that rule is
                            used to set up build actions.
  
                            If does not contain dot, should be a module name.
                            The flags will be applied for all rules in that
                            module.
                            If module for rule is different from the calling
                            module, an error is issued.
  
           variable_name:   Variable that should be set on target
  
           condition        A condition when this flag should be applied.
                            Should be set of property sets. If one of
                            those property sets is contained in build
                            properties, the flag will be used.
                            Implied values are not allowed:
                            "<toolset>gcc" should be used, not just
                            "gcc". Subfeatures, like in "<toolset>gcc-3.2"
                            are allowed. If left empty, the flag will
                            always used.
  
                            Propery sets may use value-less properties
                            ('<a>'  vs. '<a>value') to match absent
                            properties. This allows to separately match
  
                               <architecture>/<address-model>64
                               <architecture>ia64/<address-model>
  
                            Where both features are optional. Without this
                            syntax we'd be forced to define "default" value.
  
           values:          The value to add to variable. If <feature>
                            is specified, then the value of 'feature'
                            will be added.
      """
      assert isinstance(rule_or_module, basestring)
      assert isinstance(variable_name, basestring)
      assert is_iterable_typed(condition, basestring)
      assert is_iterable(values) and all(isinstance(v, (basestring, type(None))) for v in values)
      caller = bjam.caller()
      if not '.' in rule_or_module and caller and caller[:-1].startswith("Jamfile"):
          # Unqualified rule name, used inside Jamfile. Most likely used with
          # 'make' or 'notfile' rules. This prevents setting flags on the entire
          # Jamfile module (this will be considered as rule), but who cares?
          # Probably, 'flags' rule should be split into 'flags' and
          # 'flags-on-module'.
          rule_or_module = qualify_jam_action(rule_or_module, caller)
      else:
          # FIXME: revive checking that we don't set flags for a different
          # module unintentionally
          pass
  
      if condition and not replace_grist (condition, ''):
          # We have condition in the form '<feature>', that is, without
          # value. That's a previous syntax:
          #
          #   flags gcc.link RPATH <dll-path> ;
          # for compatibility, convert it to
          #   flags gcc.link RPATH : <dll-path> ;
          values = [ condition ]
          condition = None
  
      if condition:
          transformed = []
          for c in condition:
              # FIXME: 'split' might be a too raw tool here.
              pl = [property.create_from_string(s,False,True) for s in c.split('/')]
              pl = feature.expand_subfeatures(pl);
              transformed.append(property_set.create(pl))
          condition = transformed
  
          property.validate_property_sets(condition)
  
      __add_flag (rule_or_module, variable_name, condition, values)
function_tokens: def flags ( rule_or_module , variable_name , condition , values = [ ] ) : assert isinstance ( rule_or_module , basestring ) assert isinstance ( variable_name , basestring ) assert is_iterable_typed ( condition , basestring ) assert is_iterable ( values ) and all ( isinstance ( v , ( basestring , type ( None ) ) ) for v in values ) caller = bjam . caller ( ) if not '.' in rule_or_module and caller and caller [ : - 1 ] . startswith ( "Jamfile" ) : # Unqualified rule name, used inside Jamfile. Most likely used with # 'make' or 'notfile' rules. This prevents setting flags on the entire # Jamfile module (this will be considered as rule), but who cares? # Probably, 'flags' rule should be split into 'flags' and # 'flags-on-module'. rule_or_module = qualify_jam_action ( rule_or_module , caller ) else : # FIXME: revive checking that we don't set flags for a different # module unintentionally pass if condition and not replace_grist ( condition , '' ) : # We have condition in the form '<feature>', that is, without # value. That's a previous syntax: # #   flags gcc.link RPATH <dll-path> ; # for compatibility, convert it to #   flags gcc.link RPATH : <dll-path> ; values = [ condition ] condition = None if condition : transformed = [ ] for c in condition : # FIXME: 'split' might be a too raw tool here. pl = [ property . create_from_string ( s , False , True ) for s in c . split ( '/' ) ] pl = feature . expand_subfeatures ( pl ) transformed . append ( property_set . create ( pl ) ) condition = transformed property . validate_property_sets ( condition ) __add_flag ( rule_or_module , variable_name , condition , values )