(self, spec, configs, deps, link_deps, 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()
    part_of_all: flag indicating this target is part of 'all'
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 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'
    """
    self.WriteLn('### Rules for final target.')

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

    # 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:
      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:
      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':
      if self.toolset == 'host':
        self.WriteLn('LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)')
      else:
        # Don't install target executables for now, as it results in them being
        # included in ROM. This can be revisited if there's a reason to install
        # them later.
        self.WriteLn('LOCAL_UNINSTALLABLE_MODULE := true')
      self.WriteLn('include $(BUILD_%sEXECUTABLE)' % modifier)
    else:
      self.WriteLn('LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp')
      self.WriteLn('LOCAL_UNINSTALLABLE_MODULE := true')
      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 $@')
def WriteTarget ( self , spec , configs , deps , link_deps , part_of_all ) : self . WriteLn ( '### Rules for final target.' ) if self . type != 'none' : self . WriteTargetFlags ( spec , configs , link_deps ) # 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 : 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 : 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' : if self . toolset == 'host' : self . WriteLn ( 'LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)' ) else : # Don't install target executables for now, as it results in them being # included in ROM. This can be revisited if there's a reason to install # them later. self . WriteLn ( 'LOCAL_UNINSTALLABLE_MODULE := true' ) self . WriteLn ( 'include $(BUILD_%sEXECUTABLE)' % modifier ) else : self . WriteLn ( 'LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp' ) self . WriteLn ( 'LOCAL_UNINSTALLABLE_MODULE := true' ) 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 $@' )