Home | History | Annotate | Download | only in core
      1 # Copyright (C) 2008 The Android Open Source Project
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #      http://www.apache.org/licenses/LICENSE-2.0
      8 #
      9 # Unless required by applicable law or agreed to in writing, software
     10 # distributed under the License is distributed on an "AS IS" BASIS,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 #
     15 
     16 # Check that LOCAL_MODULE is defined, then restore its LOCAL_XXXX values
     17 $(call assert-defined,LOCAL_MODULE)
     18 $(call module-restore-locals,$(LOCAL_MODULE))
     19 
     20 # For now, only support target (device-specific modules).
     21 # We may want to introduce support for host modules in the future
     22 # but that is too experimental for now.
     23 #
     24 my := TARGET_
     25 
     26 # LOCAL_MAKEFILE must also exist and name the Android.mk that
     27 # included the module build script.
     28 #
     29 $(call assert-defined,LOCAL_MAKEFILE LOCAL_BUILD_SCRIPT LOCAL_BUILT_MODULE)
     30 
     31 include $(BUILD_SYSTEM)/import-locals.mk
     32 
     33 #
     34 # Ensure that 'make <module>' and 'make clean-<module>' work
     35 #
     36 .PHONY: $(LOCAL_MODULE)
     37 $(LOCAL_MODULE): $(LOCAL_BUILT_MODULE)
     38 
     39 cleantarget := clean-$(LOCAL_MODULE)-$(TARGET_ARCH_ABI)
     40 .PHONY: $(cleantarget)
     41 clean: $(cleantarget)
     42 
     43 $(cleantarget): PRIVATE_MODULE      := $(LOCAL_MODULE)
     44 $(cleantarget): PRIVATE_TEXT        := [$(TARGET_ARCH_ABI)]
     45 ifneq ($(LOCAL_BUILT_MODULE_NOT_COPIED),true)
     46 $(cleantarget): PRIVATE_CLEAN_FILES := $(LOCAL_BUILT_MODULE) \
     47                                        $($(my)OBJS)
     48 else
     49 $(cleantarget): PRIVATE_CLEAN_FILES := $($(my)OBJS)
     50 endif
     51 $(cleantarget)::
     52 	@$(HOST_ECHO) "Clean: $(PRIVATE_MODULE) $(PRIVATE_TEXT)"
     53 	$(hide) $(call host-rmdir,$(PRIVATE_CLEAN_FILES))
     54 
     55 ifeq ($(NDK_APP_DEBUGGABLE),true)
     56 $(NDK_APP_GDBSETUP): PRIVATE_SRC_DIRS += $(LOCAL_C_INCLUDES) $(LOCAL_PATH)
     57 endif
     58 
     59 # list of generated object files
     60 LOCAL_OBJECTS :=
     61 
     62 # always define ANDROID when building binaries
     63 #
     64 LOCAL_CFLAGS := -DANDROID $(LOCAL_CFLAGS)
     65 
     66 # enable PIE for executable beyond certain API level
     67 ifeq ($(NDK_APP_PIE),true)
     68   ifeq ($(call module-get-class,$(LOCAL_MODULE)),EXECUTABLE)
     69     LOCAL_CFLAGS += -fPIE
     70     LOCAL_LDFLAGS += -fPIE -pie
     71   endif
     72 endif
     73 
     74 #
     75 # Add the default system shared libraries to the build
     76 #
     77 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
     78   LOCAL_SHARED_LIBRARIES += $(TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
     79 else
     80   LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
     81 endif
     82 
     83 #
     84 # Check LOCAL_CPP_EXTENSION, use '.cpp' by default
     85 #
     86 bad_cpp_extensions := $(strip $(filter-out .%,$(LOCAL_CPP_EXTENSION)))
     87 ifdef bad_cpp_extensions
     88     $(call __ndk_info,WARNING: Invalid LOCAL_CPP_EXTENSION values: $(bad_cpp_extensions))
     89     LOCAL_CPP_EXTENSION := $(filter $(bad_cpp_extensions),$(LOCAL_CPP_EXTENSIONS))
     90 endif
     91 LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
     92 ifeq ($(LOCAL_CPP_EXTENSION),)
     93   # Match the default GCC C++ extensions.
     94   LOCAL_CPP_EXTENSION := $(default-c++-extensions)
     95 else
     96 endif
     97 
     98 #
     99 # If LOCAL_ALLOW_UNDEFINED_SYMBOLS is not true, the linker will allow the generation
    100 # of a binary that uses undefined symbols.
    101 #
    102 ifneq ($(LOCAL_ALLOW_UNDEFINED_SYMBOLS),true)
    103   LOCAL_LDFLAGS += $($(my)NO_UNDEFINED_LDFLAGS)
    104 endif
    105 
    106 # Toolchain by default disallows generated code running from the heap and stack.
    107 # If LOCAL_DISABLE_NO_EXECUTE is true, we allow that
    108 #
    109 ifeq ($(LOCAL_DISABLE_NO_EXECUTE),true)
    110   LOCAL_CFLAGS += $($(my)DISABLE_NO_EXECUTE_CFLAGS)
    111   LOCAL_LDFLAGS += $($(my)DISABLE_NO_EXECUTE_LDFLAGS)
    112 else
    113   LOCAL_CFLAGS += $($(my)NO_EXECUTE_CFLAGS)
    114   LOCAL_LDFLAGS += $($(my)NO_EXECUTE_LDFLAGS)
    115 endif
    116 
    117 # Toolchain by default provides relro and GOT protections.
    118 # If LOCAL_DISABLE_RELRO is true, we disable the protections.
    119 #
    120 ifeq ($(LOCAL_DISABLE_RELRO),true)
    121   LOCAL_LDFLAGS += $($(my)DISABLE_RELRO_LDFLAGS)
    122 else
    123   LOCAL_LDFLAGS += $($(my)RELRO_LDFLAGS)
    124 endif
    125 
    126 #
    127 # The original Android build system allows you to use the .arm prefix
    128 # to a source file name to indicate that it should be defined in either
    129 # 'thumb' or 'arm' mode, depending on the value of LOCAL_ARM_MODE
    130 #
    131 # First, check LOCAL_ARM_MODE, it should be empty, 'thumb' or 'arm'
    132 # We make the default 'thumb'
    133 #
    134 LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
    135 ifdef LOCAL_ARM_MODE
    136   ifneq ($(words $(LOCAL_ARM_MODE)),1)
    137       $(call __ndk_info,   LOCAL_ARM_MODE in $(LOCAL_MAKEFILE) must be one word, not '$(LOCAL_ARM_MODE)')
    138       $(call __ndk_error, Aborting)
    139   endif
    140   # check that LOCAL_ARM_MODE is defined to either 'arm' or 'thumb'
    141   $(if $(filter-out thumb arm, $(LOCAL_ARM_MODE)),\
    142       $(call __ndk_info,   LOCAL_ARM_MODE must be defined to either 'arm' or 'thumb' in $(LOCAL_MAKEFILE) not '$(LOCAL_ARM_MODE)')\
    143       $(call __ndk_error, Aborting)\
    144   )
    145 endif
    146 
    147 # As a special case, the original Android build system
    148 # allows one to specify that certain source files can be
    149 # forced to build in ARM mode by using a '.arm' suffix
    150 # after the extension, e.g.
    151 #
    152 #  LOCAL_SRC_FILES := foo.c.arm
    153 #
    154 # to build source file $(LOCAL_PATH)/foo.c as ARM
    155 #
    156 
    157 $(call clear-all-src-tags)
    158 
    159 # As a special extension, the NDK also supports the .neon extension suffix
    160 # to indicate that a single file can be compiled with ARM NEON support
    161 # We must support both foo.c.neon and foo.c.arm.neon here
    162 #
    163 # Also, if LOCAL_ARM_NEON is set to 'true', force Neon mode for all source
    164 # files
    165 #
    166 
    167 neon_sources  := $(filter %.neon,$(LOCAL_SRC_FILES))
    168 neon_sources  := $(neon_sources:%.neon=%)
    169 
    170 LOCAL_ARM_NEON := $(strip $(LOCAL_ARM_NEON))
    171 ifdef LOCAL_ARM_NEON
    172   $(if $(filter-out true false,$(LOCAL_ARM_NEON)),\
    173     $(call __ndk_info,LOCAL_ARM_NEON must be defined either to 'true' or 'false' in $(LOCAL_MAKEFILE), not '$(LOCAL_ARM_NEON)')\
    174     $(call __ndk_error,Aborting) \
    175   )
    176 endif
    177 ifeq ($(LOCAL_ARM_NEON),true)
    178   neon_sources += $(LOCAL_SRC_FILES:%.neon=%)
    179 endif
    180 
    181 neon_sources := $(strip $(neon_sources))
    182 ifdef neon_sources
    183   ifneq ($(TARGET_ARCH_ABI),armeabi-v7a)
    184     $(call __ndk_info,NEON support is only possible for armeabi-v7a ABI)
    185     $(call __ndk_info,Please add checks against TARGET_ARCH_ABI in $(LOCAL_MAKEFILE))
    186     $(call __ndk_error,Aborting)
    187   endif
    188   $(call tag-src-files,$(neon_sources:%.arm=%),neon)
    189 endif
    190 
    191 LOCAL_SRC_FILES := $(LOCAL_SRC_FILES:%.neon=%)
    192 
    193 # strip the .arm suffix from LOCAL_SRC_FILES
    194 # and tag the relevant sources with the 'arm' tag
    195 #
    196 arm_sources     := $(filter %.arm,$(LOCAL_SRC_FILES))
    197 arm_sources     := $(arm_sources:%.arm=%)
    198 thumb_sources   := $(filter-out %.arm,$(LOCAL_SRC_FILES))
    199 LOCAL_SRC_FILES := $(LOCAL_SRC_FILES:%.arm=%)
    200 
    201 ifeq ($(LOCAL_ARM_MODE),arm)
    202     arm_sources := $(LOCAL_SRC_FILES)
    203 endif
    204 ifeq ($(LOCAL_ARM_MODE),thumb)
    205     arm_sources := $(empty)
    206 endif
    207 $(call tag-src-files,$(arm_sources),arm)
    208 
    209 # tag debug if APP_OPTIM is 'debug'
    210 #
    211 ifeq ($(APP_OPTIM),debug)
    212     $(call tag-src-files,$(LOCAL_SRC_FILES),debug)
    213 endif
    214 
    215 # Process all source file tags to determine toolchain-specific
    216 # target compiler flags, and text.
    217 #
    218 $(call TARGET-process-src-files-tags)
    219 
    220 # only call dump-src-file-tags during debugging
    221 #$(dump-src-file-tags)
    222 
    223 LOCAL_DEPENDENCY_DIRS :=
    224 
    225 # all_source_patterns contains the list of filename patterns that correspond
    226 # to source files recognized by our build system
    227 all_source_extensions := .c .s .S $(LOCAL_CPP_EXTENSION)
    228 all_source_patterns   := $(foreach _ext,$(all_source_extensions),%$(_ext))
    229 all_cpp_patterns      := $(foreach _ext,$(LOCAL_CPP_EXTENSION),%$(_ext))
    230 
    231 unknown_sources := $(strip $(filter-out $(all_source_patterns),$(LOCAL_SRC_FILES)))
    232 ifdef unknown_sources
    233     $(call __ndk_info,WARNING: Unsupported source file extensions in $(LOCAL_MAKEFILE) for module $(LOCAL_MODULE))
    234     $(call __ndk_info,  $(unknown_sources))
    235 endif
    236 
    237 # LOCAL_OBJECTS will list all object files corresponding to the sources
    238 # listed in LOCAL_SRC_FILES, in the *same* order.
    239 #
    240 LOCAL_OBJECTS := $(LOCAL_SRC_FILES)
    241 $(foreach _ext,$(all_source_extensions),\
    242     $(eval LOCAL_OBJECTS := $$(LOCAL_OBJECTS:%$(_ext)=%$$(TARGET_OBJ_EXTENSION)))\
    243 )
    244 LOCAL_OBJECTS := $(filter %$(TARGET_OBJ_EXTENSION),$(LOCAL_OBJECTS))
    245 LOCAL_OBJECTS := $(subst ../,__/,$(LOCAL_OBJECTS))
    246 LOCAL_OBJECTS := $(foreach _obj,$(LOCAL_OBJECTS),$(LOCAL_OBJS_DIR)/$(_obj))
    247 
    248 # If the module has any kind of C++ features, enable them in LOCAL_CPPFLAGS
    249 #
    250 ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),rtti))
    251     LOCAL_CPPFLAGS += -frtti
    252 endif
    253 ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),exceptions))
    254     LOCAL_CPPFLAGS += -fexceptions
    255 endif
    256 
    257 # If we're using the 'system' STL and use rtti or exceptions, then
    258 # automatically link against the GNU libsupc++ for now.
    259 #
    260 ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),rtti exceptions))
    261     ifeq (system,$(NDK_APP_STL))
    262       LOCAL_LDLIBS := $(LOCAL_LDLIBS) $(call host-path,$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI)/libsupc++$(TARGET_LIB_EXTENSION))
    263     endif
    264 endif
    265 
    266 # Build the sources to object files
    267 #
    268 
    269 $(foreach src,$(filter %.c,$(LOCAL_SRC_FILES)), $(call compile-c-source,$(src),$(call get-object-name,$(src))))
    270 $(foreach src,$(filter %.S %.s,$(LOCAL_SRC_FILES)), $(call compile-s-source,$(src),$(call get-object-name,$(src))))
    271 
    272 $(foreach src,$(filter $(all_cpp_patterns),$(LOCAL_SRC_FILES)),\
    273     $(call compile-cpp-source,$(src),$(call get-object-name,$(src)))\
    274 )
    275 
    276 #
    277 # The compile-xxx-source calls updated LOCAL_OBJECTS and LOCAL_DEPENDENCY_DIRS
    278 #
    279 ALL_DEPENDENCY_DIRS += $(sort $(LOCAL_DEPENDENCY_DIRS))
    280 CLEAN_OBJS_DIRS     += $(LOCAL_OBJS_DIR)
    281 
    282 #
    283 # Handle the static and shared libraries this module depends on
    284 #
    285 
    286 # If LOCAL_LDLIBS contains anything like -l<library> then
    287 # prepend a -L$(SYSROOT_LINK)/usr/lib to it to ensure that the linker
    288 # looks in the right location
    289 #
    290 ifneq ($(filter -l%,$(LOCAL_LDLIBS)),)
    291     LOCAL_LDLIBS := -L$(call host-path,$(SYSROOT_LINK)/usr/lib) $(LOCAL_LDLIBS)
    292 endif
    293 
    294 # When LOCAL_SHORT_COMMANDS is defined to 'true' we are going to write the
    295 # list of all object files and/or static/shared libraries that appear on the
    296 # command line to a file, then use the @<listfile> syntax to invoke it.
    297 #
    298 # This allows us to link or archive a huge number of stuff even on Windows
    299 # with its puny 8192 max character limit on its command-line.
    300 #
    301 LOCAL_SHORT_COMMANDS := $(strip $(LOCAL_SHORT_COMMANDS))
    302 ifndef LOCAL_SHORT_COMMANDS
    303     LOCAL_SHORT_COMMANDS := $(strip $(NDK_APP_SHORT_COMMANDS))
    304 endif
    305 
    306 $(call generate-file-dir,$(LOCAL_BUILT_MODULE))
    307 
    308 $(LOCAL_BUILT_MODULE): PRIVATE_OBJECTS := $(LOCAL_OBJECTS)
    309 $(LOCAL_BUILT_MODULE): PRIVATE_LIBGCC := $(TARGET_LIBGCC)
    310 
    311 $(LOCAL_BUILT_MODULE): PRIVATE_LD := $(TARGET_LD)
    312 $(LOCAL_BUILT_MODULE): PRIVATE_LDFLAGS := $(TARGET_LDFLAGS) $(LOCAL_LDFLAGS) $(NDK_APP_LDFLAGS)
    313 $(LOCAL_BUILT_MODULE): PRIVATE_LDLIBS  := $(LOCAL_LDLIBS) $(TARGET_LDLIBS)
    314 
    315 $(LOCAL_BUILT_MODULE): PRIVATE_NAME := $(notdir $(LOCAL_BUILT_MODULE))
    316 $(LOCAL_BUILT_MODULE): PRIVATE_CXX := $(TARGET_CXX)
    317 $(LOCAL_BUILT_MODULE): PRIVATE_CC := $(TARGET_CC)
    318 $(LOCAL_BUILT_MODULE): PRIVATE_SYSROOT_LINK := $(SYSROOT_LINK)
    319 
    320 ifeq ($(call module-get-class,$(LOCAL_MODULE)),STATIC_LIBRARY)
    321 
    322 #
    323 # This is a static library module, things are very easy. We only need
    324 # to build the object files and archive them with 'ar'. Note that module
    325 # dependencies can be ignored here, i.e. if the module depends on other
    326 # static or shared libraries, there is no need to actually build them
    327 # before, so don't add Make dependencies to them.
    328 #
    329 # In other words, consider the following graph:
    330 #
    331 #     libfoo.so -> libA.a ->libB.a
    332 #
    333 # then libA.a and libB.a can be built in parallel, only linking libfoo.so
    334 # depends on their completion.
    335 #
    336 
    337 ar_objects := $(call host-path,$(LOCAL_OBJECTS))
    338 
    339 ifeq ($(LOCAL_SHORT_COMMANDS),true)
    340     $(call ndk_log,Building static library module '$(LOCAL_MODULE)' with linker list file)
    341     ar_list_file := $(LOCAL_OBJS_DIR)/archiver.list
    342     $(call generate-list-file,$(ar_objects),$(ar_list_file))
    343     ar_objects   := @$(call host-path,$(ar_list_file))
    344     $(LOCAL_BUILT_MODULE): $(ar_list_file)
    345 endif
    346 
    347 $(LOCAL_BUILT_MODULE): PRIVATE_AR := $(TARGET_AR) $(TARGET_ARFLAGS)
    348 $(LOCAL_BUILT_MODULE): PRIVATE_AR_OBJECTS := $(ar_objects)
    349 $(LOCAL_BUILT_MODULE): PRIVATE_BUILD_STATIC_LIB := $(cmd-build-static-library)
    350 
    351 $(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
    352 	@ $(HOST_ECHO) "StaticLibrary  : $(PRIVATE_NAME)"
    353 	$(hide) $(call host-rm,$@)
    354 	$(hide) $(PRIVATE_BUILD_STATIC_LIB)
    355 
    356 ALL_STATIC_LIBRARIES += $(LOCAL_BUILT_MODULE)
    357 
    358 endif
    359 
    360 ifneq (,$(filter SHARED_LIBRARY EXECUTABLE,$(call module-get-class,$(LOCAL_MODULE))))
    361 
    362 #
    363 # This is a shared library or an executable, so computing dependencies properly is
    364 # crucial. The general rule to apply is the following:
    365 #
    366 #   - collect the list of all static libraries that need to be part
    367 #     of the link, and in the right order. To do so, get the transitive
    368 #     closure of LOCAL_STATIC_LIBRARIES and LOCAL_WHOLE_STATIC_LIBRARIES
    369 #     and ensure they are ordered topologically.
    370 #
    371 #  - collect the list of all shared libraries that need to be part of
    372 #    the link. This is the transitive closure of the list of
    373 #    LOCAL_SHARED_LIBRARIES for the module and all its dependent static
    374 #    libraries identified in the step above. Of course, need to be
    375 #    ordered topologically too.
    376 #
    377 #  - add Make dependencies to ensure that all these libs are built
    378 #    before the module itself too.
    379 #
    380 # A few quick examples:
    381 #
    382 #    main.exe -> libA.a -> libB.a -> libfoo.so -> libC.a
    383 #
    384 #      static_libs(main.exe) = libA.a libB.a  (i.e. no libC.a)
    385 #      shared_libs(main.exe) = libfoo.so
    386 #      static_libs(libfoo.so) = libC.a
    387 #
    388 #    main.exe -> libA.a ---> libB.a
    389 #                  |           ^
    390 #                  v           |
    391 #                libC.a  ------
    392 #
    393 #      static_libs(main.exe) = libA.a libC.a libB.a
    394 #             (i.e. libB.a must appear after all libraries that depend on it).
    395 #
    396 all_libs := $(call module-get-link-libs,$(LOCAL_MODULE))
    397 shared_libs := $(call module-filter-shared-libraries,$(all_libs))
    398 static_libs := $(call module-filter-static-libraries,$(all_libs))
    399 whole_static_libs := $(call module-extract-whole-static-libs,$(LOCAL_MODULE),$(static_libs))
    400 static_libs := $(filter-out $(whole_static_libs),$(static_libs))
    401 
    402 $(call -ndk-mod-debug,module $(LOCAL_MODULE) [$(LOCAL_BUILT_MODULE)])
    403 $(call -ndk-mod-debug,.  all_libs='$(all_libs)')
    404 $(call -ndk-mod-debug,.  shared_libs='$(shared_libs)')
    405 $(call -ndk-mod-debug,.  static_libs='$(static_libs)')
    406 $(call -ndk-mod-debug,.  whole_static_libs='$(whole_static_libs)')
    407 
    408 shared_libs       := $(call map,module-get-built,$(shared_libs))\
    409                      $(TARGET_PREBUILT_SHARED_LIBRARIES)
    410 static_libs       := $(call map,module-get-built,$(static_libs))
    411 whole_static_libs := $(call map,module-get-built,$(whole_static_libs))
    412 
    413 $(call -ndk-mod-debug,.  built_shared_libs='$(shared_libs)')
    414 $(call -ndk-mod-debug,.  built_static_libs='$(static_libs)')
    415 $(call -ndk-mod-debug,.  built_whole_static_libs='$(whole_static_libs)')
    416 
    417 ifeq ($(LOCAL_SHORT_COMMANDS),true)
    418     $(call ndk_log,Building ELF binary module '$(LOCAL_MODULE)' with linker list file)
    419     linker_options   := $(linker_objects_and_libraries)
    420     linker_list_file := $(LOCAL_OBJS_DIR)/linker.list
    421     linker_objects_and_libraries := @$(call host-path,$(linker_list_file))
    422     $(call generate-list-file,$(linker_options),$(linker_list_file))
    423     $(LOCAL_BUILT_MODULE): $(linker_list_file)
    424 endif
    425 
    426 # The list of object/static/shared libraries passed to the linker when
    427 # building shared libraries and executables. order is important.
    428 #
    429 # Cannot use immediate evaluation because PRIVATE_LIBGCC may not be defined at this point.
    430 linker_objects_and_libraries = $(strip $(call TARGET-get-linker-objects-and-libraries,\
    431     $(LOCAL_OBJECTS), \
    432     $(static_libs), \
    433     $(whole_static_libs), \
    434     $(shared_libs)))
    435 
    436 $(LOCAL_BUILT_MODULE): $(shared_libs) $(static_libs) $(whole_static_libs)
    437 $(LOCAL_BUILT_MODULE): PRIVATE_LINKER_OBJECTS_AND_LIBRARIES := $(linker_objects_and_libraries)
    438 $(LOCAL_BUILT_MODULE): PRIVATE_STATIC_LIBRARIES := $(static_libs)
    439 $(LOCAL_BUILT_MODULE): PRIVATE_WHOLE_STATIC_LIBRARIES := $(whole_static_libs))
    440 $(LOCAL_BUILT_MODULE): PRIVATE_SHARED_LIBRARIES := $(shared_libs))
    441 
    442 endif
    443 
    444 #
    445 # If this is a shared library module
    446 #
    447 ifeq ($(call module-get-class,$(LOCAL_MODULE)),SHARED_LIBRARY)
    448 $(LOCAL_BUILT_MODULE): PRIVATE_BUILD_SHARED_LIB := $(cmd-build-shared-library)
    449 $(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
    450 	@ $(HOST_ECHO) "SharedLibrary  : $(PRIVATE_NAME)"
    451 	$(hide) $(PRIVATE_BUILD_SHARED_LIB)
    452 
    453 ALL_SHARED_LIBRARIES += $(LOCAL_BUILT_MODULE)
    454 endif
    455 
    456 #
    457 # If this is an executable module
    458 #
    459 ifeq ($(call module-get-class,$(LOCAL_MODULE)),EXECUTABLE)
    460 $(LOCAL_BUILT_MODULE): PRIVATE_BUILD_EXECUTABLE := $(cmd-build-executable)
    461 $(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
    462 	@ $(HOST_ECHO) "Executable     : $(PRIVATE_NAME)"
    463 	$(hide) $(PRIVATE_BUILD_EXECUTABLE)
    464 
    465 ALL_EXECUTABLES += $(LOCAL_BUILT_MODULE)
    466 endif
    467 
    468 #
    469 # If this is a copyable prebuilt module
    470 #
    471 ifeq ($(call module-is-copyable,$(LOCAL_MODULE)),$(true))
    472 $(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
    473 	@ $(HOST_ECHO) "Prebuilt       : $(PRIVATE_NAME) <= $(call pretty-dir,$(dir $<))"
    474 	$(hide) $(call host-cp,$<,$@)
    475 endif
    476 
    477 #
    478 # If this is an installable module
    479 #
    480 ifeq ($(call module-is-installable,$(LOCAL_MODULE)),$(true))
    481 $(LOCAL_INSTALLED): PRIVATE_NAME      := $(notdir $(LOCAL_BUILT_MODULE))
    482 $(LOCAL_INSTALLED): PRIVATE_SRC       := $(LOCAL_BUILT_MODULE)
    483 $(LOCAL_INSTALLED): PRIVATE_DST_DIR   := $(NDK_APP_DST_DIR)
    484 $(LOCAL_INSTALLED): PRIVATE_DST       := $(LOCAL_INSTALLED)
    485 $(LOCAL_INSTALLED): PRIVATE_STRIP     := $(TARGET_STRIP)
    486 $(LOCAL_INSTALLED): PRIVATE_STRIP_CMD := $(call cmd-strip, $(PRIVATE_DST))
    487 
    488 $(LOCAL_INSTALLED): $(LOCAL_BUILT_MODULE) clean-installed-binaries
    489 	@$(HOST_ECHO) "Install        : $(PRIVATE_NAME) => $(call pretty-dir,$(PRIVATE_DST))"
    490 	$(hide) $(call host-install,$(PRIVATE_SRC),$(PRIVATE_DST))
    491 	$(hide) $(PRIVATE_STRIP_CMD)
    492 
    493 $(call generate-file-dir,$(LOCAL_INSTALLED))
    494 
    495 endif
    496