Home | History | Annotate | Download | only in core
      1 # caller might have included aux_toolchain, e.g. if custom build steps are defined
      2 ifeq ($(LOCAL_IS_AUX_MODULE),)
      3 include $(BUILD_SYSTEM)/aux_toolchain.mk
      4 endif
      5 
      6 ifeq ($(AUX_BUILD_NOT_COMPATIBLE),)
      7 
      8 ###########################################################
      9 ## Standard rules for building an executable file.
     10 ##
     11 ## Additional inputs from base_rules.make:
     12 ## None.
     13 ###########################################################
     14 
     15 ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
     16 LOCAL_MODULE_CLASS := EXECUTABLES
     17 endif
     18 
     19 $(call $(aux-executable-hook))
     20 
     21 ###########################################################
     22 ## Standard rules for building any target-side binaries
     23 ## with dynamic linkage (dynamic libraries or executables
     24 ## that link with dynamic libraries)
     25 ##
     26 ## Files including this file must define a rule to build
     27 ## the target $(linked_module).
     28 ###########################################################
     29 
     30 # The name of the target file, without any path prepended.
     31 # This duplicates logic from base_rules.mk because we need to
     32 # know its results before base_rules.mk is included.
     33 include $(BUILD_SYSTEM)/configure_module_stem.mk
     34 
     35 intermediates := $(call local-intermediates-dir)
     36 
     37 # Define the target that is the unmodified output of the linker.
     38 # The basename of this target must be the same as the final output
     39 # binary name, because it's used to set the "soname" in the binary.
     40 # The includer of this file will define a rule to build this target.
     41 linked_module := $(intermediates)/LINKED/$(my_built_module_stem)
     42 
     43 ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
     44 
     45 # Because AUX_SYMBOL_FILTER_FILE depends on ALL_ORIGINAL_DYNAMIC_BINARIES,
     46 # the linked_module rules won't necessarily inherit the PRIVATE_
     47 # variables from LOCAL_BUILT_MODULE.  This tells binary.make to explicitly
     48 # define the PRIVATE_ variables for linked_module as well as for
     49 # LOCAL_BUILT_MODULE.
     50 LOCAL_INTERMEDIATE_TARGETS += $(linked_module)
     51 
     52 ###################################
     53 include $(BUILD_SYSTEM)/binary.mk
     54 ###################################
     55 
     56 aux_output := $(linked_module)
     57 
     58 ifneq ($(LOCAL_CUSTOM_BUILD_STEP_INPUT),)
     59 ifneq ($(LOCAL_CUSTOM_BUILD_STEP_OUTPUT),)
     60 
     61 # injecting custom build steps
     62 $(LOCAL_CUSTOM_BUILD_STEP_INPUT): $(aux_output)
     63 	@echo "$(AUX_DISPLAY) custom copy: $(PRIVATE_MODULE) ($@)"
     64 	@mkdir -p $(dir $@)
     65 	$(hide) $(copy-file-to-target)
     66 
     67 aux_output := $(LOCAL_CUSTOM_BUILD_STEP_OUTPUT)
     68 
     69 endif
     70 endif
     71 
     72 $(LOCAL_BUILT_MODULE): $(aux_output)
     73 	@echo "$(AUX_DISPLAY) final copy: $(PRIVATE_MODULE) ($@)"
     74 	@mkdir -p $(dir $@)
     75 	$(hide) $(copy-file-to-target)
     76 
     77 INSTALLED_AUX_TARGETS += $(LOCAL_INSTALLED_MODULE)
     78 
     79 $(cleantarget): PRIVATE_CLEAN_FILES += \
     80     $(linked_module) \
     81 
     82 # Define PRIVATE_ variables from global vars
     83 $(linked_module): PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES := $(AUX_OUT_INTERMEDIATE_LIBRARIES)
     84 $(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
     85 
     86 ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
     87 $(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
     88 	$(transform-o-to-aux-static-executable)
     89 	$(PRIVATE_POST_LINK_CMD)
     90 else
     91 $(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
     92 	$(transform-o-to-aux-executable)
     93 	$(PRIVATE_POST_LINK_CMD)
     94 endif
     95 
     96 endif # AUX_BUILD_NOT_COMPATIBLE
     97