parameters: (self, spec, configs, deps, link_deps, extra_outputs,
                    part_of_all)
docstring: Write Makefile code to produce the final target of the gyp spec.
  
      spec, configs: input from gyp.
      deps, link_deps: dependency lists; see ComputeDeps()
      extra_outputs: any extra outputs that our target should depend on
      part_of_all: flag indicating this target is part of 'all'
docstring_summary: Write Makefile code to produce the final target of the gyp spec.
docstring_tokens: Write Makefile code to produce the final target of the gyp spec .
function: def WriteTarget(self, spec, configs, deps, link_deps, extra_outputs,
                    part_of_all):
      """Write Makefile code to produce the final target of the gyp spec.
  
      spec, configs: input from gyp.
      deps, link_deps: dependency lists; see ComputeDeps()
      extra_outputs: any extra outputs that our target should depend on
      part_of_all: flag indicating this target is part of 'all'
      """
  
      self.WriteLn('### Rules for final target.')
  
      if extra_outputs:
        self.WriteMakeRule([self.output], extra_outputs,
                           comment = 'Build our special outputs first.',
                           order_only = True)
        self.WriteMakeRule(extra_outputs, deps,
                           comment=('Preserve order dependency of '
                                    'special output on deps.'),
                           order_only = True,
                           multiple_output_trick = False)
  
      if self.type not in ('settings', 'none'):
        for configname in sorted(configs.keys()):
          config = configs[configname]
          self.WriteList(config.get('ldflags'), 'LDFLAGS_%s' % configname)
        libraries = spec.get('libraries')
        if libraries:
          # Remove duplicate entries
          libraries = gyp.common.uniquer(libraries)
        self.WriteList(libraries, 'LIBS')
        self.WriteLn('%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))' % self.output)
        self.WriteLn('%s: LIBS := $(LIBS)' % self.output)
  
      if self.type == 'executable':
        self.WriteDoCmd([self.output], link_deps, 'link', part_of_all)
      elif self.type == 'static_library':
        self.WriteDoCmd([self.output], link_deps, 'alink', part_of_all)
      elif self.type in ('loadable_module', 'shared_library'):
        self.WriteDoCmd([self.output], link_deps, 'solink', part_of_all)
      elif self.type == 'none':
        # Write a stamp line.
        self.WriteDoCmd([self.output], deps, 'touch', part_of_all)
      elif self.type == 'settings':
        # Only used for passing flags around.
        pass
      else:
        print "WARNING: no output for", self.type, target
  
      # Add an alias for each target (if there are any outputs).
      # Installable target aliases are created below.
      if ((self.output and self.output != self.target) and
          (self.type not in self._INSTALLABLE_TARGETS)):
        self.WriteMakeRule([self.target], [self.output],
                           comment='Add target alias', phony = True)
        if part_of_all:
          self.WriteMakeRule(['all'], [self.target],
                             comment = 'Add target alias to "all" target.',
                             phony = True)
  
      # Add special-case rules for our installable targets.
      # 1) They need to install to the build dir or "product" dir.
      # 2) They get shortcuts for building (e.g. "make chrome").
      # 3) They are part of "make all".
      if self.type in self._INSTALLABLE_TARGETS:
        if self.type == 'shared_library':
          file_desc = 'shared library'
        else:
          file_desc = 'executable'
        install_path = self._InstallableTargetInstallPath()
        installable_deps = [self.output]
        # Point the target alias to the final binary output.
        self.WriteMakeRule([self.target], [install_path],
                           comment='Add target alias', phony = True)
        if install_path != self.output:
          self.WriteDoCmd([install_path], [self.output], 'copy',
                          comment = 'Copy this to the %s output path.' %
                          file_desc, part_of_all=part_of_all)
          installable_deps.append(install_path)
        if self.output != self.alias and self.alias != self.target:
          self.WriteMakeRule([self.alias], installable_deps,
                             comment = 'Short alias for building this %s.' %
                             file_desc, phony = True)
        if part_of_all:
          self.WriteMakeRule(['all'], [install_path],
                             comment = 'Add %s to "all" target.' % file_desc,
                             phony = True)
function_tokens: def WriteTarget ( self , spec , configs , deps , link_deps , extra_outputs , part_of_all ) : self . WriteLn ( '### Rules for final target.' ) if extra_outputs : self . WriteMakeRule ( [ self . output ] , extra_outputs , comment = 'Build our special outputs first.' , order_only = True ) self . WriteMakeRule ( extra_outputs , deps , comment = ( 'Preserve order dependency of ' 'special output on deps.' ) , order_only = True , multiple_output_trick = False ) if self . type not in ( 'settings' , 'none' ) : for configname in sorted ( configs . keys ( ) ) : config = configs [ configname ] self . WriteList ( config . get ( 'ldflags' ) , 'LDFLAGS_%s' % configname ) libraries = spec . get ( 'libraries' ) if libraries : # Remove duplicate entries libraries = gyp . common . uniquer ( libraries ) self . WriteList ( libraries , 'LIBS' ) self . WriteLn ( '%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))' % self . output ) self . WriteLn ( '%s: LIBS := $(LIBS)' % self . output ) if self . type == 'executable' : self . WriteDoCmd ( [ self . output ] , link_deps , 'link' , part_of_all ) elif self . type == 'static_library' : self . WriteDoCmd ( [ self . output ] , link_deps , 'alink' , part_of_all ) elif self . type in ( 'loadable_module' , 'shared_library' ) : self . WriteDoCmd ( [ self . output ] , link_deps , 'solink' , part_of_all ) elif self . type == 'none' : # Write a stamp line. self . WriteDoCmd ( [ self . output ] , deps , 'touch' , part_of_all ) elif self . type == 'settings' : # Only used for passing flags around. pass else : print "WARNING: no output for" , self . type , target # Add an alias for each target (if there are any outputs). # Installable target aliases are created below. if ( ( self . output and self . output != self . target ) and ( self . type not in self . _INSTALLABLE_TARGETS ) ) : self . WriteMakeRule ( [ self . target ] , [ self . output ] , comment = 'Add target alias' , phony = True ) if part_of_all : self . WriteMakeRule ( [ 'all' ] , [ self . target ] , comment = 'Add target alias to "all" target.' , phony = True ) # Add special-case rules for our installable targets. # 1) They need to install to the build dir or "product" dir. # 2) They get shortcuts for building (e.g. "make chrome"). # 3) They are part of "make all". if self . type in self . _INSTALLABLE_TARGETS : if self . type == 'shared_library' : file_desc = 'shared library' else : file_desc = 'executable' install_path = self . _InstallableTargetInstallPath ( ) installable_deps = [ self . output ] # Point the target alias to the final binary output. self . WriteMakeRule ( [ self . target ] , [ install_path ] , comment = 'Add target alias' , phony = True ) if install_path != self . output : self . WriteDoCmd ( [ install_path ] , [ self . output ] , 'copy' , comment = 'Copy this to the %s output path.' % file_desc , part_of_all = part_of_all ) installable_deps . append ( install_path ) if self . output != self . alias and self . alias != self . target : self . WriteMakeRule ( [ self . alias ] , installable_deps , comment = 'Short alias for building this %s.' % file_desc , phony = True ) if part_of_all : self . WriteMakeRule ( [ 'all' ] , [ install_path ] , comment = 'Add %s to "all" target.' % file_desc , phony = True )