parameters: (self, qualified_target, base_path, output_filename, spec, configs,
              part_of_all)
docstring: The main entry point: writes a .mk file for a single target.
  
      Arguments:
        qualified_target: target we're generating
        base_path: path relative to source root we're building in, used to resolve
                   target-relative paths
        output_filename: output .mk file name to write
        spec, configs: gyp info
        part_of_all: flag indicating this target is part of 'all'
docstring_summary: The main entry point: writes a .mk file for a single target.
docstring_tokens: The main entry point : writes a . mk file for a single target .
function: def Write(self, qualified_target, base_path, output_filename, spec, configs,
              part_of_all):
      """The main entry point: writes a .mk file for a single target.
  
      Arguments:
        qualified_target: target we're generating
        base_path: path relative to source root we're building in, used to resolve
                   target-relative paths
        output_filename: output .mk file name to write
        spec, configs: gyp info
        part_of_all: flag indicating this target is part of 'all'
      """
      gyp.common.EnsureDirExists(output_filename)
  
      self.fp = open(output_filename, 'w')
  
      self.fp.write(header)
  
      self.qualified_target = qualified_target
      self.path = base_path
      self.target = spec['target_name']
      self.type = spec['type']
      self.toolset = spec['toolset']
  
      self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec)
      if self.flavor == 'mac' or self.flavor == 'ios':
        self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec)
      else:
        self.xcode_settings = None
  
      deps, link_deps = self.ComputeDeps(spec)
  
      # Some of the generation below can add extra output, sources, or
      # link dependencies.  All of the out params of the functions that
      # follow use names like extra_foo.
      extra_outputs = []
      extra_sources = []
      extra_link_deps = []
      extra_mac_bundle_resources = []
      mac_bundle_deps = []
  
      if self.is_mac_bundle:
        self.output = self.ComputeMacBundleOutput(spec)
        self.output_binary = self.ComputeMacBundleBinaryOutput(spec)
      else:
        self.output = self.output_binary = self.ComputeOutput(spec)
  
      self.is_standalone_static_library = bool(
          spec.get('standalone_static_library', 0))
      self._INSTALLABLE_TARGETS = ('executable', 'loadable_module',
                                   'shared_library')
      if (self.is_standalone_static_library or
          self.type in self._INSTALLABLE_TARGETS):
        self.alias = os.path.basename(self.output)
        install_path = self._InstallableTargetInstallPath()
      else:
        self.alias = self.output
        install_path = self.output
  
      self.WriteLn("TOOLSET := " + self.toolset)
      self.WriteLn("TARGET := " + self.target)
  
      # Actions must come first, since they can generate more OBJs for use below.
      if 'actions' in spec:
        self.WriteActions(spec['actions'], extra_sources, extra_outputs,
                          extra_mac_bundle_resources, part_of_all)
  
      # Rules must be early like actions.
      if 'rules' in spec:
        self.WriteRules(spec['rules'], extra_sources, extra_outputs,
                        extra_mac_bundle_resources, part_of_all)
  
      if 'copies' in spec:
        self.WriteCopies(spec['copies'], extra_outputs, part_of_all)
  
      # Bundle resources.
      if self.is_mac_bundle:
        all_mac_bundle_resources = (
            spec.get('mac_bundle_resources', []) + extra_mac_bundle_resources)
        self.WriteMacBundleResources(all_mac_bundle_resources, mac_bundle_deps)
        self.WriteMacInfoPlist(mac_bundle_deps)
  
      # Sources.
      all_sources = spec.get('sources', []) + extra_sources
      if all_sources:
        self.WriteSources(
            configs, deps, all_sources, extra_outputs,
            extra_link_deps, part_of_all,
            gyp.xcode_emulation.MacPrefixHeader(
                self.xcode_settings, lambda p: Sourceify(self.Absolutify(p)),
                self.Pchify))
        sources = filter(Compilable, all_sources)
        if sources:
          self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1)
          extensions = set([os.path.splitext(s)[1] for s in sources])
          for ext in extensions:
            if ext in self.suffix_rules_srcdir:
              self.WriteLn(self.suffix_rules_srcdir[ext])
          self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT2)
          for ext in extensions:
            if ext in self.suffix_rules_objdir1:
              self.WriteLn(self.suffix_rules_objdir1[ext])
          for ext in extensions:
            if ext in self.suffix_rules_objdir2:
              self.WriteLn(self.suffix_rules_objdir2[ext])
          self.WriteLn('# End of this set of suffix rules')
  
          # Add dependency from bundle to bundle binary.
          if self.is_mac_bundle:
            mac_bundle_deps.append(self.output_binary)
  
      self.WriteTarget(spec, configs, deps, extra_link_deps + link_deps,
                       mac_bundle_deps, extra_outputs, part_of_all)
  
      # Update global list of target outputs, used in dependency tracking.
      target_outputs[qualified_target] = install_path
  
      # Update global list of link dependencies.
      if self.type in ('static_library', 'shared_library'):
        target_link_deps[qualified_target] = self.output_binary
  
      # Currently any versions have the same effect, but in future the behavior
      # could be different.
      if self.generator_flags.get('android_ndk_version', None):
        self.WriteAndroidNdkModuleRule(self.target, all_sources, link_deps)
  
      self.fp.close()
function_tokens: def Write ( self , qualified_target , base_path , output_filename , spec , configs , part_of_all ) : gyp . common . EnsureDirExists ( output_filename ) self . fp = open ( output_filename , 'w' ) self . fp . write ( header ) self . qualified_target = qualified_target self . path = base_path self . target = spec [ 'target_name' ] self . type = spec [ 'type' ] self . toolset = spec [ 'toolset' ] self . is_mac_bundle = gyp . xcode_emulation . IsMacBundle ( self . flavor , spec ) if self . flavor == 'mac' or self . flavor == 'ios' : self . xcode_settings = gyp . xcode_emulation . XcodeSettings ( spec ) else : self . xcode_settings = None deps , link_deps = self . ComputeDeps ( spec ) # Some of the generation below can add extra output, sources, or # link dependencies.  All of the out params of the functions that # follow use names like extra_foo. extra_outputs = [ ] extra_sources = [ ] extra_link_deps = [ ] extra_mac_bundle_resources = [ ] mac_bundle_deps = [ ] if self . is_mac_bundle : self . output = self . ComputeMacBundleOutput ( spec ) self . output_binary = self . ComputeMacBundleBinaryOutput ( spec ) else : self . output = self . output_binary = self . ComputeOutput ( spec ) self . is_standalone_static_library = bool ( spec . get ( 'standalone_static_library' , 0 ) ) self . _INSTALLABLE_TARGETS = ( 'executable' , 'loadable_module' , 'shared_library' ) if ( self . is_standalone_static_library or self . type in self . _INSTALLABLE_TARGETS ) : self . alias = os . path . basename ( self . output ) install_path = self . _InstallableTargetInstallPath ( ) else : self . alias = self . output install_path = self . output self . WriteLn ( "TOOLSET := " + self . toolset ) self . WriteLn ( "TARGET := " + self . target ) # Actions must come first, since they can generate more OBJs for use below. if 'actions' in spec : self . WriteActions ( spec [ 'actions' ] , extra_sources , extra_outputs , extra_mac_bundle_resources , part_of_all ) # Rules must be early like actions. if 'rules' in spec : self . WriteRules ( spec [ 'rules' ] , extra_sources , extra_outputs , extra_mac_bundle_resources , part_of_all ) if 'copies' in spec : self . WriteCopies ( spec [ 'copies' ] , extra_outputs , part_of_all ) # Bundle resources. if self . is_mac_bundle : all_mac_bundle_resources = ( spec . get ( 'mac_bundle_resources' , [ ] ) + extra_mac_bundle_resources ) self . WriteMacBundleResources ( all_mac_bundle_resources , mac_bundle_deps ) self . WriteMacInfoPlist ( mac_bundle_deps ) # Sources. all_sources = spec . get ( 'sources' , [ ] ) + extra_sources if all_sources : self . WriteSources ( configs , deps , all_sources , extra_outputs , extra_link_deps , part_of_all , gyp . xcode_emulation . MacPrefixHeader ( self . xcode_settings , lambda p : Sourceify ( self . Absolutify ( p ) ) , self . Pchify ) ) sources = filter ( Compilable , all_sources ) if sources : self . WriteLn ( SHARED_HEADER_SUFFIX_RULES_COMMENT1 ) extensions = set ( [ os . path . splitext ( s ) [ 1 ] for s in sources ] ) for ext in extensions : if ext in self . suffix_rules_srcdir : self . WriteLn ( self . suffix_rules_srcdir [ ext ] ) self . WriteLn ( SHARED_HEADER_SUFFIX_RULES_COMMENT2 ) for ext in extensions : if ext in self . suffix_rules_objdir1 : self . WriteLn ( self . suffix_rules_objdir1 [ ext ] ) for ext in extensions : if ext in self . suffix_rules_objdir2 : self . WriteLn ( self . suffix_rules_objdir2 [ ext ] ) self . WriteLn ( '# End of this set of suffix rules' ) # Add dependency from bundle to bundle binary. if self . is_mac_bundle : mac_bundle_deps . append ( self . output_binary ) self . WriteTarget ( spec , configs , deps , extra_link_deps + link_deps , mac_bundle_deps , extra_outputs , part_of_all ) # Update global list of target outputs, used in dependency tracking. target_outputs [ qualified_target ] = install_path # Update global list of link dependencies. if self . type in ( 'static_library' , 'shared_library' ) : target_link_deps [ qualified_target ] = self . output_binary # Currently any versions have the same effect, but in future the behavior # could be different. if self . generator_flags . get ( 'android_ndk_version' , None ) : self . WriteAndroidNdkModuleRule ( self . target , all_sources , link_deps ) self . fp . close ( )