(self, spec, configs, deps, link_deps, part_of_all,
                  write_alias_target)
Write Makefile code to produce the final target of the gyp spec.

    spec, configs: input from gyp.
    deps, link_deps: dependency lists; see ComputeDeps()
    part_of_all: flag indicating this target is part of 'all'
    write_alias_target: flag indicating whether to create short aliases for this
                        target
Write Makefile code to produce the final target of the gyp spec.
Write Makefile code to produce the final target of the gyp spec .
def WriteTarget(self, spec, configs, deps, link_deps, part_of_all,
                  write_alias_target):
    """Write Makefile code to produce the final target of the gyp spec.

    spec, configs: input from gyp.
    deps, link_deps: dependency lists; see ComputeDeps()
    part_of_all: flag indicating this target is part of 'all'
    write_alias_target: flag indicating whether to create short aliases for this
                        target
    """
    self.WriteLn('### Rules for final target.')

    if self.type != 'none':
      self.WriteTargetFlags(spec, configs, link_deps)

    settings = spec.get('aosp_build_settings', {})
    if settings:
      self.WriteLn('### Set directly by aosp_build_settings.')
      for k, v in settings.iteritems():
        if isinstance(v, list):
          self.WriteList(v, k)
        else:
          self.WriteLn('%s := %s' % (k, make.QuoteIfNecessary(v)))
      self.WriteLn('')

    # Add to the set of targets which represent the gyp 'all' target. We use the
    # name 'gyp_all_modules' as the Android build system doesn't allow the use
    # of the Make target 'all' and because 'all_modules' is the equivalent of
    # the Make target 'all' on Android.
    if part_of_all and write_alias_target:
      self.WriteLn('# Add target alias to "gyp_all_modules" target.')
      self.WriteLn('.PHONY: gyp_all_modules')
      self.WriteLn('gyp_all_modules: %s' % self.android_module)
      self.WriteLn('')

    # Add an alias from the gyp target name to the Android module name. This
    # simplifies manual builds of the target, and is required by the test
    # framework.
    if self.target != self.android_module and write_alias_target:
      self.WriteLn('# Alias gyp target name.')
      self.WriteLn('.PHONY: %s' % self.target)
      self.WriteLn('%s: %s' % (self.target, self.android_module))
      self.WriteLn('')

    # Add the command to trigger build of the target type depending
    # on the toolset. Ex: BUILD_STATIC_LIBRARY vs. BUILD_HOST_STATIC_LIBRARY
    # NOTE: This has to come last!
    modifier = ''
    if self.toolset == 'host':
      modifier = 'HOST_'
    if self.type == 'static_library':
      self.WriteLn('include $(BUILD_%sSTATIC_LIBRARY)' % modifier)
    elif self.type == 'shared_library':
      self.WriteLn('LOCAL_PRELINK_MODULE := false')
      self.WriteLn('include $(BUILD_%sSHARED_LIBRARY)' % modifier)
    elif self.type == 'executable':
      self.WriteLn('LOCAL_CXX_STL := libc++_static')
      # Executables are for build and test purposes only, so they're installed
      # to a directory that doesn't get included in the system image.
      self.WriteLn('LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)')
      self.WriteLn('include $(BUILD_%sEXECUTABLE)' % modifier)
    else:
      self.WriteLn('LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp')
      self.WriteLn('LOCAL_UNINSTALLABLE_MODULE := true')
      if self.toolset == 'target':
        self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_VAR_PREFIX)')
      else:
        self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_HOST_VAR_PREFIX)')
      self.WriteLn()
      self.WriteLn('include $(BUILD_SYSTEM)/base_rules.mk')
      self.WriteLn()
      self.WriteLn('$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)')
      self.WriteLn('\t$(hide) echo "Gyp timestamp: $@"')
      self.WriteLn('\t$(hide) mkdir -p $(dir $@)')
      self.WriteLn('\t$(hide) touch $@')
      self.WriteLn()
      self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX :=')
def WriteTarget ( self , spec , configs , deps , link_deps , part_of_all , write_alias_target ) : self . WriteLn ( '### Rules for final target.' ) if self . type != 'none' : self . WriteTargetFlags ( spec , configs , link_deps ) settings = spec . get ( 'aosp_build_settings' , { } ) if settings : self . WriteLn ( '### Set directly by aosp_build_settings.' ) for k , v in settings . iteritems ( ) : if isinstance ( v , list ) : self . WriteList ( v , k ) else : self . WriteLn ( '%s := %s' % ( k , make . QuoteIfNecessary ( v ) ) ) self . WriteLn ( '' ) # Add to the set of targets which represent the gyp 'all' target. We use the # name 'gyp_all_modules' as the Android build system doesn't allow the use # of the Make target 'all' and because 'all_modules' is the equivalent of # the Make target 'all' on Android. if part_of_all and write_alias_target : self . WriteLn ( '# Add target alias to "gyp_all_modules" target.' ) self . WriteLn ( '.PHONY: gyp_all_modules' ) self . WriteLn ( 'gyp_all_modules: %s' % self . android_module ) self . WriteLn ( '' ) # Add an alias from the gyp target name to the Android module name. This # simplifies manual builds of the target, and is required by the test # framework. if self . target != self . android_module and write_alias_target : self . WriteLn ( '# Alias gyp target name.' ) self . WriteLn ( '.PHONY: %s' % self . target ) self . WriteLn ( '%s: %s' % ( self . target , self . android_module ) ) self . WriteLn ( '' ) # Add the command to trigger build of the target type depending # on the toolset. Ex: BUILD_STATIC_LIBRARY vs. BUILD_HOST_STATIC_LIBRARY # NOTE: This has to come last! modifier = '' if self . toolset == 'host' : modifier = 'HOST_' if self . type == 'static_library' : self . WriteLn ( 'include $(BUILD_%sSTATIC_LIBRARY)' % modifier ) elif self . type == 'shared_library' : self . WriteLn ( 'LOCAL_PRELINK_MODULE := false' ) self . WriteLn ( 'include $(BUILD_%sSHARED_LIBRARY)' % modifier ) elif self . type == 'executable' : self . WriteLn ( 'LOCAL_CXX_STL := libc++_static' ) # Executables are for build and test purposes only, so they're installed # to a directory that doesn't get included in the system image. self . WriteLn ( 'LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)' ) self . WriteLn ( 'include $(BUILD_%sEXECUTABLE)' % modifier ) else : self . WriteLn ( 'LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp' ) self . WriteLn ( 'LOCAL_UNINSTALLABLE_MODULE := true' ) if self . toolset == 'target' : self . WriteLn ( 'LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_VAR_PREFIX)' ) else : self . WriteLn ( 'LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_HOST_VAR_PREFIX)' ) self . WriteLn ( ) self . WriteLn ( 'include $(BUILD_SYSTEM)/base_rules.mk' ) self . WriteLn ( ) self . WriteLn ( '$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)' ) self . WriteLn ( '\t$(hide) echo "Gyp timestamp: $@"' ) self . WriteLn ( '\t$(hide) mkdir -p $(dir $@)' ) self . WriteLn ( '\t$(hide) touch $@' ) self . WriteLn ( ) self . WriteLn ( 'LOCAL_2ND_ARCH_VAR_PREFIX :=' )