1# caller might have included aux_toolchain, e.g. if custom build steps are defined 2ifeq ($(LOCAL_IS_AUX_MODULE),) 3include $(BUILD_SYSTEM)/aux_toolchain.mk 4endif 5 6ifeq ($(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 15ifeq ($(strip $(LOCAL_MODULE_CLASS)),) 16LOCAL_MODULE_CLASS := EXECUTABLES 17endif 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. 33include $(BUILD_SYSTEM)/configure_module_stem.mk 34 35intermediates := $(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. 41linked_module := $(intermediates)/LINKED/$(my_built_module_stem) 42 43ALL_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. 50LOCAL_INTERMEDIATE_TARGETS += $(linked_module) 51 52################################### 53include $(BUILD_SYSTEM)/binary.mk 54################################### 55 56aux_output := $(linked_module) 57 58ifneq ($(LOCAL_CUSTOM_BUILD_STEP_INPUT),) 59ifneq ($(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 67aux_output := $(LOCAL_CUSTOM_BUILD_STEP_OUTPUT) 68 69endif 70endif 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 77INSTALLED_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_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD) 84 85ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) 86$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES) 87 $(transform-o-to-aux-static-executable) 88 $(PRIVATE_POST_LINK_CMD) 89else 90$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES) 91 $(transform-o-to-aux-executable) 92 $(PRIVATE_POST_LINK_CMD) 93endif 94 95endif # AUX_BUILD_NOT_COMPATIBLE 96