Home | History | Annotate | Download | only in core
      1 # Copyright (C) 2009 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 # Common definitions for the Android NDK build system
     16 #
     17 
     18 # We use the GNU Make Standard Library
     19 include $(NDK_ROOT)/build/gmsl/gmsl
     20 
     21 # If NDK_TRACE is enabled then calls to the library functions are
     22 # traced to stdout using warning messages with their arguments
     23 
     24 ifdef NDK_TRACE
     25 __ndk_tr1 = $(warning $0('$1'))
     26 __ndk_tr2 = $(warning $0('$1','$2'))
     27 __ndk_tr3 = $(warning $0('$1','$2','$3'))
     28 else
     29 __ndk_tr1 :=
     30 __ndk_tr2 :=
     31 __ndk_tr3 :=
     32 endif
     33 
     34 # -----------------------------------------------------------------------------
     35 # Macro    : empty
     36 # Returns  : an empty macro
     37 # Usage    : $(empty)
     38 # -----------------------------------------------------------------------------
     39 empty :=
     40 
     41 # -----------------------------------------------------------------------------
     42 # Macro    : space
     43 # Returns  : a single space
     44 # Usage    : $(space)
     45 # -----------------------------------------------------------------------------
     46 space  := $(empty) $(empty)
     47 
     48 space4 := $(space)$(space)$(space)$(space)
     49 
     50 # -----------------------------------------------------------------------------
     51 # Function : last2
     52 # Arguments: a list
     53 # Returns  : the penultimate (next-to-last) element of a list
     54 # Usage    : $(call last2, <LIST>)
     55 # -----------------------------------------------------------------------------
     56 last2 = $(word $(words $1), x $1)
     57 
     58 # -----------------------------------------------------------------------------
     59 # Function : last3
     60 # Arguments: a list
     61 # Returns  : the antepenultimate (second-next-to-last) element of a list
     62 # Usage    : $(call last3, <LIST>)
     63 # -----------------------------------------------------------------------------
     64 last3 = $(word $(words $1), x x $1)
     65 
     66 # -----------------------------------------------------------------------------
     67 # Function : remove-duplicates
     68 # Arguments: a list
     69 # Returns  : the list with duplicate items removed, order is preserved.
     70 # Usage    : $(call remove-duplicates, <LIST>)
     71 # Note     : This is equivalent to the 'uniq' function provided by GMSL,
     72 #            however this implementation is non-recursive and *much*
     73 #            faster. It will also not explode the stack with a lot of
     74 #            items like 'uniq' does.
     75 # -----------------------------------------------------------------------------
     76 remove-duplicates = $(strip \
     77   $(eval __uniq_ret :=) \
     78   $(foreach __uniq_item,$1,\
     79     $(if $(findstring $(__uniq_item),$(__uniq_ret)),,\
     80       $(eval __uniq_ret += $(__uniq_item))\
     81     )\
     82   )\
     83   $(__uniq_ret))
     84 
     85 # -----------------------------------------------------------------------------
     86 # Macro    : this-makefile
     87 # Returns  : the name of the current Makefile in the inclusion stack
     88 # Usage    : $(this-makefile)
     89 # -----------------------------------------------------------------------------
     90 this-makefile = $(lastword $(MAKEFILE_LIST))
     91 
     92 # -----------------------------------------------------------------------------
     93 # Macro    : local-makefile
     94 # Returns  : the name of the last parsed Android.mk file
     95 # Usage    : $(local-makefile)
     96 # -----------------------------------------------------------------------------
     97 local-makefile = $(lastword $(filter %Android.mk,$(MAKEFILE_LIST)))
     98 
     99 # -----------------------------------------------------------------------------
    100 # Function : assert-defined
    101 # Arguments: 1: list of variable names
    102 # Returns  : None
    103 # Usage    : $(call assert-defined, VAR1 VAR2 VAR3...)
    104 # Rationale: Checks that all variables listed in $1 are defined, or abort the
    105 #            build
    106 # -----------------------------------------------------------------------------
    107 assert-defined = $(foreach __varname,$(strip $1),\
    108   $(if $(strip $($(__varname))),,\
    109     $(call __ndk_error, Assertion failure: $(__varname) is not defined)\
    110   )\
    111 )
    112 
    113 # -----------------------------------------------------------------------------
    114 # Function : clear-vars
    115 # Arguments: 1: list of variable names
    116 #            2: file where the variable should be defined
    117 # Returns  : None
    118 # Usage    : $(call clear-vars, VAR1 VAR2 VAR3...)
    119 # Rationale: Clears/undefines all variables in argument list
    120 # -----------------------------------------------------------------------------
    121 clear-vars = $(foreach __varname,$1,$(eval $(__varname) := $(empty)))
    122 
    123 # -----------------------------------------------------------------------------
    124 # Function : check-required-vars
    125 # Arguments: 1: list of variable names
    126 #            2: file where the variable(s) should be defined
    127 # Returns  : None
    128 # Usage    : $(call check-required-vars, VAR1 VAR2 VAR3..., <file>)
    129 # Rationale: Checks that all required vars listed in $1 were defined by $2
    130 #            or abort the build with an error
    131 # -----------------------------------------------------------------------------
    132 check-required-vars = $(foreach __varname,$1,\
    133   $(if $(strip $($(__varname))),,\
    134     $(call __ndk_info, Required variable $(__varname) is not defined by $2)\
    135     $(call __ndk_error,Aborting)\
    136   )\
    137 )
    138 
    139 # -----------------------------------------------------------------------------
    140 # Function : host-path
    141 # Arguments: 1: file path
    142 # Returns  : file path, as understood by the host file system
    143 # Usage    : $(call host-path,<path>)
    144 # Rationale: This function is used to translate Cygwin paths into
    145 #            Cygwin-specific ones. On other platforms, it will just
    146 #            return its argument.
    147 # -----------------------------------------------------------------------------
    148 ifeq ($(HOST_OS),cygwin)
    149 host-path = $(if $(strip $1),$(call cygwin-to-host-path,$1))
    150 else
    151 host-path = $1
    152 endif
    153 
    154 # -----------------------------------------------------------------------------
    155 # Function : host-c-includes
    156 # Arguments: 1: list of file paths (e.g. "foo bar")
    157 # Returns  : list of include compiler options (e.g. "-Ifoo -Ibar")
    158 # Usage    : $(call host-c-includes,<paths>)
    159 # Rationale: This function is used to translate Cygwin paths into
    160 #            Cygwin-specific ones. On other platforms, it will just
    161 #            return its argument.
    162 # -----------------------------------------------------------------------------
    163 ifeq ($(HOST_OS),cygwin)
    164 host-c-includes = $(patsubst %,-I%,$(call host-path,$1))
    165 else
    166 host-c-includes = $(1:%=-I%)
    167 endif
    168 
    169 
    170 # -----------------------------------------------------------------------------
    171 # Function : link-whole-archives
    172 # Arguments: 1: list of whole static libraries
    173 # Returns  : linker flags to use the whole static libraries
    174 # Usage    : $(call link-whole-archives,<libraries>)
    175 # Rationale: This function is used to put the list of whole static libraries
    176 #            inside a -Wl,--whole-archive ... -Wl,--no-whole-archive block.
    177 #            If the list is empty, it returns an empty string.
    178 #            This function also calls host-path to translate the library
    179 #            paths.
    180 # -----------------------------------------------------------------------------
    181 link-whole-archives = $(if $(strip $1),$(call link-whole-archive-flags,$1))
    182 link-whole-archive-flags = -Wl,--whole-archive $(call host-path,$1) -Wl,--no-whole-archive
    183 
    184 # =============================================================================
    185 #
    186 # Modules database
    187 #
    188 # The following declarations are used to manage the list of modules
    189 # defined in application's Android.mk files.
    190 #
    191 # Technical note:
    192 #    We use __ndk_modules to hold the list of all modules corresponding
    193 #    to a given application.
    194 #
    195 #    For each module 'foo', __ndk_modules.foo.<field> is used
    196 #    to store module-specific information.
    197 #
    198 #        type         -> type of module (e.g. 'static', 'shared', ...)
    199 #        depends      -> list of other modules this module depends on
    200 #
    201 #    Also, LOCAL_XXXX values defined for a module are recorded in XXXX, e.g.:
    202 #
    203 #        PATH   -> recorded LOCAL_PATH for the module
    204 #        CFLAGS -> recorded LOCAL_CFLAGS for the module
    205 #        ...
    206 #
    207 #    Some of these are created by build scripts like BUILD_STATIC_LIBRARY:
    208 #
    209 #        MAKEFILE -> The Android.mk where the module is defined.
    210 #        LDFLAGS  -> Final linker flags
    211 #        OBJECTS  -> List of module objects
    212 #        BUILT_MODULE -> location of module built file (e.g. obj/<app>/<abi>/libfoo.so)
    213 #
    214 #    Note that some modules are never installed (e.g. static libraries).
    215 #
    216 # =============================================================================
    217 
    218 # The list of LOCAL_XXXX variables that are recorded for each module definition
    219 # These are documented by docs/ANDROID-MK.TXT. Exception is LOCAL_MODULE
    220 #
    221 modules-LOCALS := \
    222     MODULE \
    223     MODULE_FILENAME \
    224     PATH \
    225     SRC_FILES \
    226     CPP_EXTENSION \
    227     C_INCLUDES \
    228     CFLAGS \
    229     CXXFLAGS \
    230     CPPFLAGS \
    231     STATIC_LIBRARIES \
    232     WHOLE_STATIC_LIBRARIES \
    233     SHARED_LIBRARIES \
    234     LDLIBS \
    235     ALLOW_UNDEFINED_SYMBOLS \
    236     ARM_MODE \
    237     ARM_NEON \
    238     DISABLE_NO_EXECUTE \
    239     EXPORT_CFLAGS \
    240     EXPORT_CPPFLAGS \
    241     EXPORT_LDLIBS \
    242     EXPORT_C_INCLUDES \
    243     FILTER_ASM \
    244     CPP_FEATURES \
    245 
    246 # The following are generated by the build scripts themselves
    247 
    248 # LOCAL_MAKEFILE will contain the path to the Android.mk defining the module
    249 modules-LOCALS += MAKEFILE
    250 
    251 # LOCAL_LDFLAGS will contain the set of final linker flags for the module
    252 modules-LOCALS += LDFLAGS
    253 
    254 # LOCAL_OBJECTS will contain the list of object files generated from the
    255 # module's sources, if any.
    256 modules-LOCALS += OBJECTS
    257 
    258 # LOCAL_BUILT_MODULE will contain the location of the symbolic version of
    259 # the generated module (i.e. the one containing all symbols used during
    260 # native debugging). It is generally under $PROJECT/obj/local/
    261 modules-LOCALS += BUILT_MODULE
    262 
    263 # LOCAL_OBJS_DIR will contain the location where the object files for
    264 # this module will be stored. Usually $PROJECT/obj/local/<module>/obj
    265 modules-LOCALS += OBJS_DIR
    266 
    267 # LOCAL_INSTALLED will contain the location of the installed version
    268 # of the module. Usually $PROJECT/libs/<abi>/<prefix><module><suffix>
    269 # where <prefix> and <suffix> depend on the module class.
    270 modules-LOCALS += INSTALLED
    271 
    272 # LOCAL_MODULE_CLASS will contain the type of the module
    273 # (e.g. STATIC_LIBRARY, SHARED_LIBRARY, etc...)
    274 modules-LOCALS += MODULE_CLASS
    275 
    276 # the list of managed fields per module
    277 modules-fields = depends \
    278                  $(modules-LOCALS)
    279 
    280 # -----------------------------------------------------------------------------
    281 # Function : modules-clear
    282 # Arguments: None
    283 # Returns  : None
    284 # Usage    : $(call modules-clear)
    285 # Rationale: clears the list of defined modules known by the build system
    286 # -----------------------------------------------------------------------------
    287 modules-clear = \
    288     $(foreach __mod,$(__ndk_modules),\
    289         $(foreach __field,$(modules-fields),\
    290             $(eval __ndk_modules.$(__mod).$(__field) := $(empty))\
    291         )\
    292     )\
    293     $(eval __ndk_modules := $(empty_set)) \
    294     $(eval __ndk_top_modules := $(empty)) \
    295     $(eval __ndk_import_list := $(empty)) \
    296     $(eval __ndk_import_depth := $(empty))
    297 
    298 # -----------------------------------------------------------------------------
    299 # Function : modules-get-list
    300 # Arguments: None
    301 # Returns  : The list of all recorded modules
    302 # Usage    : $(call modules-get-list)
    303 # -----------------------------------------------------------------------------
    304 modules-get-list = $(__ndk_modules)
    305 
    306 # -----------------------------------------------------------------------------
    307 # Function : modules-get-top-list
    308 # Arguments: None
    309 # Returns  : The list of all recorded non-imported modules
    310 # Usage    : $(call modules-get-top-list)
    311 # -----------------------------------------------------------------------------
    312 modules-get-top-list = $(__ndk_top_modules)
    313 
    314 # -----------------------------------------------------------------------------
    315 # Function : module-add
    316 # Arguments: 1: module name
    317 # Returns  : None
    318 # Usage    : $(call module-add,<modulename>)
    319 # Rationale: add a new module. If it is already defined, print an error message
    320 #            and abort. This will record all LOCAL_XXX variables for the module.
    321 # -----------------------------------------------------------------------------
    322 module-add = \
    323   $(call assert-defined,LOCAL_MAKEFILE LOCAL_BUILT_MODULE LOCAL_OBJS_DIR LOCAL_MODULE_CLASS)\
    324   $(if $(call set_is_member,$(__ndk_modules),$1),\
    325     $(call __ndk_info,Trying to define local module '$1' in $(LOCAL_MAKEFILE).)\
    326     $(call __ndk_info,But this module was already defined by $(__ndk_modules.$1.MAKEFILE).)\
    327     $(call __ndk_error,Aborting.)\
    328   )\
    329   $(eval __ndk_modules := $(call set_insert,$(__ndk_modules),$1))\
    330   $(if $(strip $(__ndk_import_depth)),,\
    331     $(eval __ndk_top_modules := $(call set_insert,$(__ndk_top_modules),$1))\
    332   )\
    333   $(if $(call module-class-is-installable,$(LOCAL_MODULE_CLASS)),\
    334     $(eval LOCAL_INSTALLED := $(NDK_APP_DST_DIR)/$(notdir $(LOCAL_BUILT_MODULE)))\
    335   )\
    336   $(foreach __local,$(modules-LOCALS),\
    337     $(eval __ndk_modules.$1.$(__local) := $(LOCAL_$(__local)))\
    338   )\
    339   $(call module-handle-c++-features,$1)
    340 
    341 
    342 # Retrieve the class of module $1
    343 module-get-class = $(__ndk_modules.$1.MODULE_CLASS)
    344 
    345 # Retrieve built location of module $1
    346 module-get-built = $(__ndk_modules.$1.BUILT_MODULE)
    347 
    348 # Returns $(true) is module $1 is installable
    349 # An installable module is one that will be copied to $PROJECT/libs/<abi>/
    350 # (e.g. shared libraries).
    351 #
    352 module-is-installable = $(call module-class-is-installable,$(call module-get-class,$1))
    353 
    354 # Returns $(true) if module $1 is prebuilt
    355 # A prebuilt module is one declared with BUILD_PREBUILT_SHARED_LIBRARY or
    356 # BUILD_PREBUILT_STATIC_LIBRARY
    357 #
    358 module-is-prebuilt = $(call module-class-is-prebuilt,$(call module-get-class,$1))
    359 
    360 # -----------------------------------------------------------------------------
    361 # Function : module-get-export
    362 # Arguments: 1: module name
    363 #            2: export variable name without LOCAL_EXPORT_ prefix (e.g. 'CFLAGS')
    364 # Returns  : Exported value
    365 # Usage    : $(call module-get-export,<modulename>,<varname>)
    366 # Rationale: Return the recorded value of LOCAL_EXPORT_$2, if any, for module $1
    367 # -----------------------------------------------------------------------------
    368 module-get-export = $(__ndk_modules.$1.EXPORT_$2)
    369 
    370 # -----------------------------------------------------------------------------
    371 # Function : module-get-listed-export
    372 # Arguments: 1: list of module names
    373 #            2: export variable name without LOCAL_EXPORT_ prefix (e.g. 'CFLAGS')
    374 # Returns  : Exported values
    375 # Usage    : $(call module-get-listed-export,<module-list>,<varname>)
    376 # Rationale: Return the recorded value of LOCAL_EXPORT_$2, if any, for modules
    377 #            listed in $1.
    378 # -----------------------------------------------------------------------------
    379 module-get-listed-export = $(strip \
    380     $(foreach __listed_module,$1,\
    381         $(call module-get-export,$(__listed_module),$2)\
    382     ))
    383 
    384 # -----------------------------------------------------------------------------
    385 # Function : modules-restore-locals
    386 # Arguments: 1: module name
    387 # Returns  : None
    388 # Usage    : $(call module-restore-locals,<modulename>)
    389 # Rationale: Restore the recorded LOCAL_XXX definitions for a given module.
    390 # -----------------------------------------------------------------------------
    391 module-restore-locals = \
    392     $(foreach __local,$(modules-LOCALS),\
    393         $(eval LOCAL_$(__local) := $(__ndk_modules.$1.$(__local)))\
    394     )
    395 
    396 # Dump all module information. Only use this for debugging
    397 modules-dump-database = \
    398     $(info Modules: $(__ndk_modules)) \
    399     $(foreach __mod,$(__ndk_modules),\
    400         $(info $(space4)$(__mod):)\
    401         $(foreach __field,$(modules-fields),\
    402             $(eval __fieldval := $(strip $(__ndk_modules.$(__mod).$(__field))))\
    403             $(if $(__fieldval),\
    404                 $(if $(filter 1,$(words $(__fieldval))),\
    405                     $(info $(space4)$(space4)$(__field): $(__fieldval)),\
    406                     $(info $(space4)$(space4)$(__field): )\
    407                     $(foreach __fielditem,$(__fieldval),\
    408                         $(info $(space4)$(space4)$(space4)$(__fielditem))\
    409                     )\
    410                 )\
    411             )\
    412         )\
    413     )\
    414     $(info --- end of modules list)
    415 
    416 
    417 # -----------------------------------------------------------------------------
    418 # Function : module-add-static-depends
    419 # Arguments: 1: module name
    420 #            2: list/set of static library modules this module depends on.
    421 # Returns  : None
    422 # Usage    : $(call module-add-static-depends,<modulename>,<list of module names>)
    423 # Rationale: Record that a module depends on a set of static libraries.
    424 #            Use module-get-static-dependencies to retrieve final list.
    425 # -----------------------------------------------------------------------------
    426 module-add-static-depends = \
    427     $(call module-add-depends-any,$1,$2,depends) \
    428 
    429 # -----------------------------------------------------------------------------
    430 # Function : module-add-shared-depends
    431 # Arguments: 1: module name
    432 #            2: list/set of shared library modules this module depends on.
    433 # Returns  : None
    434 # Usage    : $(call module-add-shared-depends,<modulename>,<list of module names>)
    435 # Rationale: Record that a module depends on a set of shared libraries.
    436 #            Use modulge-get-shared-dependencies to retrieve final list.
    437 # -----------------------------------------------------------------------------
    438 module-add-shared-depends = \
    439     $(call module-add-depends-any,$1,$2,depends) \
    440 
    441 # Used internally by module-add-static-depends and module-add-shared-depends
    442 # NOTE: this function must not modify the existing dependency order when new depends are added.
    443 #
    444 module-add-depends-any = \
    445     $(eval __ndk_modules.$1.$3 += $(filter-out $(__ndk_modules.$1.$3),$(call strip-lib-prefix,$2)))
    446 
    447 # Used to recompute all dependencies once all module information has been recorded.
    448 #
    449 modules-compute-dependencies = \
    450     $(foreach __module,$(__ndk_modules),\
    451         $(call module-compute-depends,$(__module))\
    452     )
    453 
    454 module-compute-depends = \
    455     $(call module-add-static-depends,$1,$(__ndk_modules.$1.STATIC_LIBRARIES))\
    456     $(call module-add-static-depends,$1,$(__ndk_modules.$1.WHOLE_STATIC_LIBRARIES))\
    457     $(call module-add-shared-depends,$1,$(__ndk_modules.$1.SHARED_LIBRARIES))\
    458 
    459 module-get-installed = $(__ndk_modules.$1.INSTALLED)
    460 
    461 # -----------------------------------------------------------------------------
    462 # Function : modules-get-all-dependencies
    463 # Arguments: 1: list of module names
    464 # Returns  : List of all the modules $1 depends on transitively.
    465 # Usage    : $(call modules-all-get-dependencies,<list of module names>)
    466 # Rationale: This computes the closure of all module dependencies starting from $1
    467 # -----------------------------------------------------------------------------
    468 module-get-all-dependencies = $(strip \
    469     $(call modules-get-closure,$1,depends))
    470 
    471 modules-get-closure = \
    472     $(eval __closure_deps  := $(strip $(call strip-lib-prefix,$1))) \
    473     $(eval __closure_wq    := $(__closure_deps)) \
    474     $(eval __closure_field := $(strip $2)) \
    475     $(call modules-closure)\
    476     $(__closure_deps)
    477 
    478 # Used internally by modules-get-all-dependencies
    479 # Note the tricky use of conditional recursion to work around the fact that
    480 # the GNU Make language does not have any conditional looping construct
    481 # like 'while'.
    482 #
    483 modules-closure = \
    484     $(eval __closure_mod := $(call first,$(__closure_wq))) \
    485     $(eval __closure_wq  := $(call rest,$(__closure_wq))) \
    486     $(eval __closure_val := $(call strip-lib-prefix,$(__ndk_modules.$(__closure_mod).$(__closure_field)))) \
    487     $(eval __closure_new := $(filter-out $(__closure_deps),$(__closure_val)))\
    488     $(eval __closure_deps += $(__closure_new)) \
    489     $(eval __closure_wq   := $(strip $(__closure_wq) $(__closure_new)))\
    490     $(if $(__closure_wq),$(call modules-closure)) \
    491 
    492 # -----------------------------------------------------------------------------
    493 # Function : module-get-depends
    494 # Arguments: 1: list of module names
    495 #            2: local module type (e.g. SHARED_LIBRARIES)
    496 # Returns  : List all the <local-type> modules $1 depends on transitively.
    497 # Usage    : $(call module-get-depends,<list of module names>,<local-type>)
    498 # Rationale: This computes the closure of all local module dependencies starting from $1
    499 # -----------------------------------------------------------------------------
    500 module-get-depends = $(strip $(call modules-get-closure,$1,$2))
    501 
    502 
    503 # -----------------------------------------------------------------------------
    504 # Function : modules-get-all-installable
    505 # Arguments: 1: list of module names
    506 # Returns  : List of all the installable modules $1 depends on transitively.
    507 # Usage    : $(call modules-all-get-installable,<list of module names>)
    508 # Rationale: This computes the closure of all installable module dependencies starting from $1
    509 # -----------------------------------------------------------------------------
    510 # For now, only the closure of LOCAL_SHARED_LIBRARIES is enough
    511 modules-get-all-installable = $(strip \
    512     $(foreach __alldep,$(call module-get-depends,$1,depends),\
    513         $(if $(call module-is-installable,$(__alldep)),$(__alldep))\
    514     ))
    515 
    516 # Return the C++ extension of a given module
    517 # $1: module name
    518 module-get-cpp-extension = $(strip \
    519     $(if $(__ndk_modules.$1.CPP_EXTENSION),\
    520         $(__ndk_modules.$1.CPP_EXTENSION),\
    521         .cpp\
    522     ))
    523 
    524 # Return the list of C++ sources of a given module
    525 #
    526 module-get-c++-sources = \
    527     $(filter %$(call module-get-cpp-extension,$1),$(__ndk_modules.$1.SRC_FILES))
    528 
    529 # Returns true if a module has C++ sources
    530 #
    531 module-has-c++-sources = $(strip $(call module-get-c++-sources,$1))
    532 
    533 
    534 # Add C++ dependencies to any module that has C++ sources.
    535 # $1: list of C++ runtime static libraries (if any)
    536 # $2: list of C++ runtime shared libraries (if any)
    537 #
    538 modules-add-c++-dependencies = \
    539     $(foreach __module,$(__ndk_modules),\
    540         $(if $(call module-has-c++-sources,$(__module)),\
    541             $(call ndk_log,Module '$(__module)' has C++ sources)\
    542             $(call module-add-c++-deps,$(__module),$1,$2),\
    543         )\
    544     )
    545 
    546 
    547 # Return the compiler flags used to compile a C++ module
    548 # Order matters and should match the one used by the build command
    549 module-get-c++-flags = $(strip \
    550     $(__ndk_modules.$1.CFLAGS) \
    551     $(__ndk_modules.$1.CPPFLAGS) \
    552     $(__ndk_modules.$1.CXXFLAGS))
    553 
    554 # This function is used to remove certain flags from a module compiler flags
    555 # $1: Module name
    556 # $2: List of flags to remove
    557 #
    558 module-filter-out-compiler-flags = \
    559     $(eval __ndk_modules.$1.CFLAGS   := $(filter-out $2,$(__ndk_modules.$1.CFLAGS)))\
    560     $(eval __ndk_modules.$1.CPPFLAGS := $(filter-out $2,$(__ndk_modules.$1.CPPFLAGS)))\
    561     $(eval __ndk_modules.$1.CXXFLAGS := $(filter-out $2,$(__ndk_modules.$1.CXXFLAGS)))
    562 
    563 # Return true if a module's compiler flags enable rtti
    564 # We just look at -frtti and -fno-rtti on the command-line
    565 # and keep the last one of these flags.
    566 module-flags-have-rtti = $(strip \
    567         $(filter -frtti,\
    568             $(lastword $(filter -frtti -fno-rtti,$(call module-get-c++-flags,$1)))\
    569         )\
    570     )
    571 
    572 # Same with C++ exception support (i.e. -fexceptions and -fno-exceptions)
    573 #
    574 module-flags-have-exceptions = $(strip \
    575         $(filter -fexceptions,\
    576             $(lastword $(filter -fexceptions -fno-execeptions,$(call module-get-c++-flags,$1)))\
    577         )\
    578     )
    579 
    580 # Handle the definition of LOCAL_CPP_FEATURES, i.e.:
    581 #
    582 #  - If it is defined, check that it only contains valid values
    583 #  - If it is undefined, try to compute its value automatically by
    584 #    looking at the C++ compiler flags used to build the module
    585 #
    586 # After this, we remove all features flags from the module's command-line
    587 # And add only the correct ones back in LOCAL_CPP_FLAGS
    588 #
    589 module-handle-c++-features = \
    590     $(if $(strip $(__ndk_modules.$1.CPP_FEATURES)),\
    591         $(eval __cxxbad := $(filter-out rtti exceptions,$(__ndk_modules.$1.CPP_FEATURES)))\
    592         $(if $(__cxxbad),\
    593             $(call __ndk_info,WARNING: Ignoring invalid values in LOCAL_CPP_FEATURES definition in $(__ndk_modules.$1.MAKEFILE): $(__cxxbad))\
    594             $(eval __ndk_modules.$1.CPP_FEATURES := $(strip $(filter-out $(__cxxbad),$(__ndk_modules.$1.CPP_FEATURES))))\
    595         )\
    596     ,\
    597         $(eval __ndk_modules.$1.CPP_FEATURES := $(strip \
    598             $(if $(call module-flags-have-rtti,$1),rtti) \
    599             $(if $(call module-flags-have-exceptions,$1),exceptions) \
    600         )) \
    601     )\
    602     $(call module-filter-out-compiler-flags,$1,-frtti -fno-rtti -fexceptions -fno-exceptions)\
    603 
    604 # Returns true if a module or its dependencies have specific C++ features
    605 # (i.e. RTTI or Exceptions)
    606 #
    607 # $1: module name
    608 # $2: list of features (e.g. 'rtti' or 'exceptions')
    609 #
    610 module-has-c++-features = $(strip \
    611     $(eval __cxxdeps  := $(call module-get-all-dependencies,$1))\
    612     $(eval __cxxflags := $(foreach __cxxdep,$(__cxxdeps),$(__ndk_modules.$(__cxxdep).CPP_FEATURES)))\
    613     $(if $(filter $2,$(__cxxflags)),true,)\
    614     )
    615 
    616 # Add standard C++ dependencies to a given module
    617 #
    618 # $1: module name
    619 # $2: list of C++ runtime static libraries (if any)
    620 # $3: list of C++ runtime shared libraries (if any)
    621 #
    622 module-add-c++-deps = \
    623     $(eval __ndk_modules.$1.STATIC_LIBRARIES += $(2))\
    624     $(eval __ndk_modules.$1.SHARED_LIBRARIES += $(3))
    625 
    626 
    627 # =============================================================================
    628 #
    629 # Utility functions
    630 #
    631 # =============================================================================
    632 
    633 # -----------------------------------------------------------------------------
    634 # Function : parent-dir
    635 # Arguments: 1: path
    636 # Returns  : Parent dir or path of $1, with final separator removed.
    637 # -----------------------------------------------------------------------------
    638 parent-dir = $(patsubst %/,%,$(dir $1))
    639 
    640 
    641 # -----------------------------------------------------------------------------
    642 # Function : pretty-dir
    643 # Arguments: 1: path
    644 # Returns  : Remove NDK_PROJECT_PATH prefix from a given path. This can be
    645 #            used to perform pretty-printing for logs.
    646 # -----------------------------------------------------------------------------
    647 pretty-dir = $(patsubst $(NDK_ROOT)/%,<NDK>/%,\
    648                  $(patsubst $(NDK_PROJECT_PATH)/%,%,$1))
    649 
    650 # -----------------------------------------------------------------------------
    651 # Function : check-user-define
    652 # Arguments: 1: name of variable that must be defined by the user
    653 #            2: name of Makefile where the variable should be defined
    654 #            3: name/description of the Makefile where the check is done, which
    655 #               must be included by $2
    656 # Returns  : None
    657 # -----------------------------------------------------------------------------
    658 check-user-define = $(if $(strip $($1)),,\
    659   $(call __ndk_error,Missing $1 before including $3 in $2))
    660 
    661 # -----------------------------------------------------------------------------
    662 # This is used to check that LOCAL_MODULE is properly defined by an Android.mk
    663 # file before including one of the $(BUILD_SHARED_LIBRARY), etc... files.
    664 #
    665 # Function : check-user-LOCAL_MODULE
    666 # Arguments: 1: name/description of the included build Makefile where the
    667 #               check is done
    668 # Returns  : None
    669 # Usage    : $(call check-user-LOCAL_MODULE, BUILD_SHARED_LIBRARY)
    670 # -----------------------------------------------------------------------------
    671 check-defined-LOCAL_MODULE = \
    672   $(call check-user-define,LOCAL_MODULE,$(local-makefile),$(1)) \
    673   $(if $(call seq,$(words $(LOCAL_MODULE)),1),,\
    674     $(call __ndk_info,LOCAL_MODULE definition in $(local-makefile) must not contain space)\
    675     $(call __ndk_error,Please correct error. Aborting)\
    676   )
    677 
    678 # -----------------------------------------------------------------------------
    679 # This is used to check that LOCAL_MODULE_FILENAME, if defined, is correct.
    680 #
    681 # Function : check-user-LOCAL_MODULE_FILENAME
    682 # Returns  : None
    683 # Usage    : $(call check-user-LOCAL_MODULE_FILENAME)
    684 # -----------------------------------------------------------------------------
    685 check-LOCAL_MODULE_FILENAME = \
    686   $(if $(strip $(LOCAL_MODULE_FILENAME)),\
    687     $(if $(call seq,$(words $(LOCAL_MODULE_FILENAME)),1),,\
    688         $(call __ndk_info,$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_MODULE_FILENAME must not contain spaces)\
    689         $(call __ndk_error,Plase correct error. Aborting)\
    690     )\
    691     $(if $(filter %.a %.so,$(LOCAL_MODULE_FILENAME)),\
    692         $(call __ndk_info,$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_MODULE_FILENAME should not include file extensions)\
    693     )\
    694   )
    695 
    696 # -----------------------------------------------------------------------------
    697 # Function  : handle-module-filename
    698 # Arguments : 1: default file prefix
    699 #             2: file suffix
    700 # Returns   : None
    701 # Usage     : $(call handle-module-filename,<prefix>,<suffix>)
    702 # Rationale : To be used to check and or set the module's filename through
    703 #             the LOCAL_MODULE_FILENAME variable.
    704 # -----------------------------------------------------------------------------
    705 handle-module-filename = $(eval $(call ev-handle-module-filename,$1,$2))
    706 
    707 #
    708 # Check that LOCAL_MODULE_FILENAME is properly defined
    709 # - with one single item
    710 # - without a library file extension
    711 # - with no directory separators
    712 #
    713 define ev-check-module-filename
    714 ifneq (1,$$(words $$(LOCAL_MODULE_FILENAME)))
    715     $$(call __ndk_info,$$(LOCAL_MAKEFILE):$$(LOCAL_MODULE): LOCAL_MODULE_FILENAME must not contain any space)
    716     $$(call __ndk_error,Aborting)
    717 endif
    718 ifneq (,$$(filter %.a %.so,$$(LOCAL_MODULE_FILENAME)))
    719     $$(call __ndk_info,$$(LOCAL_MAKEFILE):$$(LOCAL_MODULE): LOCAL_MODULE_FILENAME must not contain a file extension)
    720     $$(call __ndk_error,Aborting)
    721 endif
    722 ifneq (1,$$(words $$(subst /, ,$$(LOCAL_MODULE_FILENAME))))
    723     $$(call __ndk_info,$$(LOCAL_MAKEFILE):$$(LOCAL_MODULE): LOCAL_MODULE_FILENAME must not contain directory separators)
    724     $$(call __ndk_error,Aborting)
    725 endif
    726 endef
    727 
    728 #
    729 # Check the definition of LOCAL_MODULE_FILENAME. If none exists,
    730 # infer it from the LOCAL_MODULE name.
    731 #
    732 # $1: default file prefix
    733 # $2: default file suffix
    734 #
    735 define ev-handle-module-filename
    736 LOCAL_MODULE_FILENAME := $$(strip $$(LOCAL_MODULE_FILENAME))
    737 ifndef LOCAL_MODULE_FILENAME
    738     LOCAL_MODULE_FILENAME := $1$$(LOCAL_MODULE)
    739 endif
    740 $$(eval $$(call ev-check-module-filename))
    741 LOCAL_MODULE_FILENAME := $$(LOCAL_MODULE_FILENAME)$2
    742 endef
    743 
    744 handle-prebuilt-module-filename = $(eval $(call ev-handle-prebuilt-module-filename,$1))
    745 
    746 #
    747 # Check the definition of LOCAL_MODULE_FILENAME for a _prebuilt_ module.
    748 # If none exists, infer it from $(LOCAL_SRC_FILES)
    749 #
    750 # $1: default file suffix
    751 #
    752 define ev-handle-prebuilt-module-filename
    753 LOCAL_MODULE_FILENAME := $$(strip $$(LOCAL_MODULE_FILENAME))
    754 ifndef LOCAL_MODULE_FILENAME
    755     LOCAL_MODULE_FILENAME := $$(notdir $(LOCAL_SRC_FILES))
    756     LOCAL_MODULE_FILENAME := $$(LOCAL_MODULE_FILENAME:%.a=%)
    757     LOCAL_MODULE_FILENAME := $$(LOCAL_MODULE_FILENAME:%.so=%)
    758 endif
    759 LOCAL_MODULE_FILENAME := $$(LOCAL_MODULE_FILENAME)$1
    760 $$(eval $$(call ev-check-module-filename))
    761 endef
    762 
    763 
    764 # -----------------------------------------------------------------------------
    765 # Function  : handle-module-built
    766 # Returns   : None
    767 # Usage     : $(call handle-module-built)
    768 # Rationale : To be used to automatically compute the location of the generated
    769 #             binary file, and the directory where to place its object files.
    770 # -----------------------------------------------------------------------------
    771 handle-module-built = \
    772     $(eval LOCAL_BUILT_MODULE := $(TARGET_OUT)/$(LOCAL_MODULE_FILENAME))\
    773     $(eval LOCAL_OBJS_DIR     := $(TARGET_OBJS)/$(LOCAL_MODULE))
    774 
    775 # -----------------------------------------------------------------------------
    776 # Strip any 'lib' prefix in front of a given string.
    777 #
    778 # Function : strip-lib-prefix
    779 # Arguments: 1: module name
    780 # Returns  : module name, without any 'lib' prefix if any
    781 # Usage    : $(call strip-lib-prefix,$(LOCAL_MODULE))
    782 # -----------------------------------------------------------------------------
    783 strip-lib-prefix = $(1:lib%=%)
    784 
    785 # -----------------------------------------------------------------------------
    786 # This is used to strip any lib prefix from LOCAL_MODULE, then check that
    787 # the corresponding module name is not already defined.
    788 #
    789 # Function : check-user-LOCAL_MODULE
    790 # Arguments: 1: path of Android.mk where this LOCAL_MODULE is defined
    791 # Returns  : None
    792 # Usage    : $(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
    793 # -----------------------------------------------------------------------------
    794 check-LOCAL_MODULE = \
    795   $(eval LOCAL_MODULE := $$(call strip-lib-prefix,$$(LOCAL_MODULE)))
    796 
    797 # -----------------------------------------------------------------------------
    798 # Macro    : my-dir
    799 # Returns  : the directory of the current Makefile
    800 # Usage    : $(my-dir)
    801 # -----------------------------------------------------------------------------
    802 my-dir = $(call parent-dir,$(lastword $(MAKEFILE_LIST)))
    803 
    804 # -----------------------------------------------------------------------------
    805 # Function : all-makefiles-under
    806 # Arguments: 1: directory path
    807 # Returns  : a list of all makefiles immediately below some directory
    808 # Usage    : $(call all-makefiles-under, <some path>)
    809 # -----------------------------------------------------------------------------
    810 all-makefiles-under = $(wildcard $1/*/Android.mk)
    811 
    812 # -----------------------------------------------------------------------------
    813 # Macro    : all-subdir-makefiles
    814 # Returns  : list of all makefiles in subdirectories of the current Makefile's
    815 #            location
    816 # Usage    : $(all-subdir-makefiles)
    817 # -----------------------------------------------------------------------------
    818 all-subdir-makefiles = $(call all-makefiles-under,$(call my-dir))
    819 
    820 # =============================================================================
    821 #
    822 # Source file tagging support.
    823 #
    824 # Each source file listed in LOCAL_SRC_FILES can have any number of
    825 # 'tags' associated to it. A tag name must not contain space, and its
    826 # usage can vary.
    827 #
    828 # For example, the 'debug' tag is used to sources that must be built
    829 # in debug mode, the 'arm' tag is used for sources that must be built
    830 # using the 32-bit instruction set on ARM platforms, and 'neon' is used
    831 # for sources that must be built with ARM Advanced SIMD (a.k.a. NEON)
    832 # support.
    833 #
    834 # More tags might be introduced in the future.
    835 #
    836 #  LOCAL_SRC_TAGS contains the list of all tags used (initially empty)
    837 #  LOCAL_SRC_FILES contains the list of all source files.
    838 #  LOCAL_SRC_TAG.<tagname> contains the set of source file names tagged
    839 #      with <tagname>
    840 #  LOCAL_SRC_FILES_TAGS.<filename> contains the set of tags for a given
    841 #      source file name
    842 #
    843 # Tags are processed by a toolchain-specific function (e.g. TARGET-compute-cflags)
    844 # which will call various functions to compute source-file specific settings.
    845 # These are currently stored as:
    846 #
    847 #  LOCAL_SRC_FILES_TARGET_CFLAGS.<filename> contains the list of
    848 #      target-specific C compiler flags used to compile a given
    849 #      source file. This is set by the function TARGET-set-cflags
    850 #      defined in the toolchain's setup.mk script.
    851 #
    852 #  LOCAL_SRC_FILES_TEXT.<filename> contains the 'text' that will be
    853 #      displayed along the label of the build output line. For example
    854 #      'thumb' or 'arm  ' with ARM-based toolchains.
    855 #
    856 # =============================================================================
    857 
    858 # -----------------------------------------------------------------------------
    859 # Macro    : clear-all-src-tags
    860 # Returns  : remove all source file tags and associated data.
    861 # Usage    : $(clear-all-src-tags)
    862 # -----------------------------------------------------------------------------
    863 clear-all-src-tags = \
    864 $(foreach __tag,$(LOCAL_SRC_TAGS), \
    865     $(eval LOCAL_SRC_TAG.$(__tag) := $(empty)) \
    866 ) \
    867 $(foreach __src,$(LOCAL_SRC_FILES), \
    868     $(eval LOCAL_SRC_FILES_TAGS.$(__src) := $(empty)) \
    869     $(eval LOCAL_SRC_FILES_TARGET_CFLAGS.$(__src) := $(empty)) \
    870     $(eval LOCAL_SRC_FILES_TEXT.$(__src) := $(empty)) \
    871 ) \
    872 $(eval LOCAL_SRC_TAGS := $(empty_set))
    873 
    874 # -----------------------------------------------------------------------------
    875 # Macro    : tag-src-files
    876 # Arguments: 1: list of source files to tag
    877 #            2: tag name (must not contain space)
    878 # Usage    : $(call tag-src-files,<list-of-source-files>,<tagname>)
    879 # Rationale: Add a tag to a list of source files
    880 # -----------------------------------------------------------------------------
    881 tag-src-files = \
    882 $(eval LOCAL_SRC_TAGS := $(call set_insert,$2,$(LOCAL_SRC_TAGS))) \
    883 $(eval LOCAL_SRC_TAG.$2 := $(call set_union,$1,$(LOCAL_SRC_TAG.$2))) \
    884 $(foreach __src,$1, \
    885     $(eval LOCAL_SRC_FILES_TAGS.$(__src) += $2) \
    886 )
    887 
    888 # -----------------------------------------------------------------------------
    889 # Macro    : get-src-files-with-tag
    890 # Arguments: 1: tag name
    891 # Usage    : $(call get-src-files-with-tag,<tagname>)
    892 # Return   : The list of source file names that have been tagged with <tagname>
    893 # -----------------------------------------------------------------------------
    894 get-src-files-with-tag = $(LOCAL_SRC_TAG.$1)
    895 
    896 # -----------------------------------------------------------------------------
    897 # Macro    : get-src-files-without-tag
    898 # Arguments: 1: tag name
    899 # Usage    : $(call get-src-files-without-tag,<tagname>)
    900 # Return   : The list of source file names that have NOT been tagged with <tagname>
    901 # -----------------------------------------------------------------------------
    902 get-src-files-without-tag = $(filter-out $(LOCAL_SRC_TAG.$1),$(LOCAL_SRC_FILES))
    903 
    904 # -----------------------------------------------------------------------------
    905 # Macro    : set-src-files-target-cflags
    906 # Arguments: 1: list of source files
    907 #            2: list of compiler flags
    908 # Usage    : $(call set-src-files-target-cflags,<sources>,<flags>)
    909 # Rationale: Set or replace the set of compiler flags that will be applied
    910 #            when building a given set of source files. This function should
    911 #            normally be called from the toolchain-specific function that
    912 #            computes all compiler flags for all source files.
    913 # -----------------------------------------------------------------------------
    914 set-src-files-target-cflags = $(foreach __src,$1,$(eval LOCAL_SRC_FILES_TARGET_CFLAGS.$(__src) := $2))
    915 
    916 # -----------------------------------------------------------------------------
    917 # Macro    : add-src-files-target-cflags
    918 # Arguments: 1: list of source files
    919 #            2: list of compiler flags
    920 # Usage    : $(call add-src-files-target-cflags,<sources>,<flags>)
    921 # Rationale: A variant of set-src-files-target-cflags that can be used
    922 #            to append, instead of replace, compiler flags for specific
    923 #            source files.
    924 # -----------------------------------------------------------------------------
    925 add-src-files-target-cflags = $(foreach __src,$1,$(eval LOCAL_SRC_FILES_TARGET_CFLAGS.$(__src) += $2))
    926 
    927 # -----------------------------------------------------------------------------
    928 # Macro    : get-src-file-target-cflags
    929 # Arguments: 1: single source file name
    930 # Usage    : $(call get-src-file-target-cflags,<source>)
    931 # Rationale: Return the set of target-specific compiler flags that must be
    932 #            applied to a given source file. These must be set prior to this
    933 #            call using set-src-files-target-cflags or add-src-files-target-cflags
    934 # -----------------------------------------------------------------------------
    935 get-src-file-target-cflags = $(LOCAL_SRC_FILES_TARGET_CFLAGS.$1)
    936 
    937 # -----------------------------------------------------------------------------
    938 # Macro    : set-src-files-text
    939 # Arguments: 1: list of source files
    940 #            2: text
    941 # Usage    : $(call set-src-files-text,<sources>,<text>)
    942 # Rationale: Set or replace the 'text' associated to a set of source files.
    943 #            The text is a very short string that complements the build
    944 #            label. For example, it will be either 'thumb' or 'arm  ' for
    945 #            ARM-based toolchains. This function must be called by the
    946 #            toolchain-specific functions that processes all source files.
    947 # -----------------------------------------------------------------------------
    948 set-src-files-text = $(foreach __src,$1,$(eval LOCAL_SRC_FILES_TEXT.$(__src) := $2))
    949 
    950 # -----------------------------------------------------------------------------
    951 # Macro    : get-src-file-text
    952 # Arguments: 1: single source file
    953 # Usage    : $(call get-src-file-text,<source>)
    954 # Rationale: Return the 'text' associated to a given source file when
    955 #            set-src-files-text was called.
    956 # -----------------------------------------------------------------------------
    957 get-src-file-text = $(LOCAL_SRC_FILES_TEXT.$1)
    958 
    959 # This should only be called for debugging the source files tagging system
    960 dump-src-file-tags = \
    961 $(info LOCAL_SRC_TAGS := $(LOCAL_SRC_TAGS)) \
    962 $(info LOCAL_SRC_FILES = $(LOCAL_SRC_FILES)) \
    963 $(foreach __tag,$(LOCAL_SRC_TAGS),$(info LOCAL_SRC_TAG.$(__tag) = $(LOCAL_SRC_TAG.$(__tag)))) \
    964 $(foreach __src,$(LOCAL_SRC_FILES),$(info LOCAL_SRC_FILES_TAGS.$(__src) = $(LOCAL_SRC_FILES_TAGS.$(__src)))) \
    965 $(info WITH arm = $(call get-src-files-with-tag,arm)) \
    966 $(info WITHOUT arm = $(call get-src-files-without-tag,arm)) \
    967 $(foreach __src,$(LOCAL_SRC_FILES),$(info LOCAL_SRC_FILES_TARGET_CFLAGS.$(__src) = $(LOCAL_SRC_FILES_TARGET_CFLAGS.$(__src)))) \
    968 $(foreach __src,$(LOCAL_SRC_FILES),$(info LOCAL_SRC_FILES_TEXT.$(__src) = $(LOCAL_SRC_FILES_TEXT.$(__src)))) \
    969 
    970 
    971 # =============================================================================
    972 #
    973 # Application.mk support
    974 #
    975 # =============================================================================
    976 
    977 # the list of variables that *must* be defined in Application.mk files
    978 NDK_APP_VARS_REQUIRED :=
    979 
    980 # the list of variables that *may* be defined in Application.mk files
    981 NDK_APP_VARS_OPTIONAL := APP_OPTIM APP_CPPFLAGS APP_CFLAGS APP_CXXFLAGS \
    982                          APP_PLATFORM APP_BUILD_SCRIPT APP_ABI APP_MODULES \
    983                          APP_PROJECT_PATH APP_STL
    984 
    985 # the list of all variables that may appear in an Application.mk file
    986 # or defined by the build scripts.
    987 NDK_APP_VARS := $(NDK_APP_VARS_REQUIRED) \
    988                 $(NDK_APP_VARS_OPTIONAL) \
    989                 APP_DEBUG \
    990                 APP_DEBUGGABLE \
    991                 APP_MANIFEST
    992 
    993 # =============================================================================
    994 #
    995 # Android.mk support
    996 #
    997 # =============================================================================
    998 
    999 # =============================================================================
   1000 #
   1001 # Build commands support
   1002 #
   1003 # =============================================================================
   1004 
   1005 get-object-name = $(strip \
   1006     $(subst ../,__/,\
   1007         $(eval __obj := $1)\
   1008         $(foreach __ext,.c .s .S $(LOCAL_CPP_EXTENSION),\
   1009             $(eval __obj := $(__obj:%$(__ext)=%.o))\
   1010         )\
   1011         $(__obj)\
   1012     ))
   1013 
   1014 # -----------------------------------------------------------------------------
   1015 # Macro    : hide
   1016 # Returns  : nothing
   1017 # Usage    : $(hide)<make commands>
   1018 # Rationale: To be used as a prefix for Make build commands to hide them
   1019 #            by default during the build. To show them, set V=1 in your
   1020 #            environment or command-line.
   1021 #
   1022 #            For example:
   1023 #
   1024 #                foo.o: foo.c
   1025 #                -->|$(hide) <build-commands>
   1026 #
   1027 #            Where '-->|' stands for a single tab character.
   1028 #
   1029 # -----------------------------------------------------------------------------
   1030 ifeq ($(V),1)
   1031 hide = $(empty)
   1032 else
   1033 hide = @
   1034 endif
   1035 
   1036 # cmd-convert-deps
   1037 #
   1038 # On Cygwin, we need to convert the .d dependency file generated by
   1039 # the gcc toolchain by transforming any WIndows paths inside it into
   1040 # Cygwin paths that GNU Make can understand (i.e. C:/Foo => /cygdrive/c/Foo)
   1041 #
   1042 # To do that, we will force the compiler to write the dependency file to
   1043 # <foo>.d.org, which will will later convert through a clever Awk script.
   1044 #
   1045 # The result will be written to <foo>.d and <foo>.d.org erased.
   1046 # Note that it is important to use different file names here.
   1047 #
   1048 #
   1049 # On other systems, we simply tell the compiler to write to the .d file directly.
   1050 #
   1051 # NOTE: In certain cases, no dependency file will be generated by the
   1052 #       compiler (e.g. when compiling an assembly file as foo.s)
   1053 #
   1054 # convert-deps is used to compute the name of the compiler-generated dependency file
   1055 # cmd-convert-deps is a command used to convert it to a Cygwin-specific path
   1056 #
   1057 ifeq ($(HOST_OS),cygwin)
   1058 convert-deps = $1.org
   1059 cmd-convert-deps = \
   1060     && ( if [ -f "$1.org" ]; then \
   1061           $(HOST_AWK) -f $(BUILD_AWK)/convert-deps-to-cygwin.awk $1.org > $1 && \
   1062           rm -f $1.org; \
   1063       fi )
   1064 else
   1065 convert-deps = $1
   1066 cmd-convert-deps = 
   1067 endif
   1068 
   1069 # This assumes that many variables have been pre-defined:
   1070 # _SRC: source file
   1071 # _OBJ: destination file
   1072 # _CC: 'compiler' command
   1073 # _FLAGS: 'compiler' flags
   1074 # _TEXT: Display text (e.g. "Compile++ thumb", must be EXACTLY 15 chars long)
   1075 #
   1076 define ev-build-file
   1077 $$(_OBJ): PRIVATE_SRC      := $$(_SRC)
   1078 $$(_OBJ): PRIVATE_OBJ      := $$(_OBJ)
   1079 $$(_OBJ): PRIVATE_DEPS     := $$(call host-path,$$(_OBJ).d)
   1080 $$(_OBJ): PRIVATE_MODULE   := $$(LOCAL_MODULE)
   1081 $$(_OBJ): PRIVATE_TEXT     := "$$(_TEXT)"
   1082 $$(_OBJ): PRIVATE_CC       := $$(_CC)
   1083 $$(_OBJ): PRIVATE_CFLAGS   := $$(_FLAGS)
   1084 $$(_OBJ): $$(_SRC) $$(LOCAL_MAKEFILE) $$(NDK_APP_APPLICATION_MK)
   1085 	@mkdir -p $$(dir $$(PRIVATE_OBJ))
   1086 	@echo "$$(PRIVATE_TEXT)  : $$(PRIVATE_MODULE) <= $$(notdir $$(PRIVATE_SRC))"
   1087 	$(hide) $$(PRIVATE_CC) -MMD -MP -MF $$(call convert-deps,$$(PRIVATE_DEPS)) $$(PRIVATE_CFLAGS) $$(call host-path,$$(PRIVATE_SRC)) -o $$(call host-path,$$(PRIVATE_OBJ)) \
   1088 	$$(call cmd-convert-deps,$$(PRIVATE_DEPS))
   1089 endef
   1090 
   1091 # This assumes the same things than ev-build-file, but will handle
   1092 # the definition of LOCAL_FILTER_ASM as well.
   1093 define ev-build-source-file
   1094 LOCAL_DEPENDENCY_DIRS += $$(dir $$(_OBJ))
   1095 ifndef LOCAL_FILTER_ASM
   1096   # Trivial case: Directly generate an object file
   1097   $$(eval $$(call ev-build-file))
   1098 else
   1099   # This is where things get hairy, we first transform
   1100   # the source into an assembler file, send it to the
   1101   # filter, then generate a final object file from it.
   1102   #
   1103 
   1104   # First, remember the original settings and compute
   1105   # the location of our temporary files.
   1106   #
   1107   _ORG_SRC := $$(_SRC)
   1108   _ORG_OBJ := $$(_OBJ)
   1109   _ORG_FLAGS := $$(_FLAGS)
   1110   _ORG_TEXT  := $$(_TEXT)
   1111 
   1112   _OBJ_ASM_ORIGINAL := $$(patsubst %.o,%.s,$$(_ORG_OBJ))
   1113   _OBJ_ASM_FILTERED := $$(patsubst %.o,%.filtered.s,$$(_ORG_OBJ))
   1114 
   1115   # If the source file is a plain assembler file, we're going to
   1116   # use it directly in our filter.
   1117   ifneq (,$$(filter %.s,$$(_SRC)))
   1118     _OBJ_ASM_ORIGINAL := $$(_SRC)
   1119   endif
   1120 
   1121   #$$(info SRC=$$(_SRC) OBJ=$$(_OBJ) OBJ_ORIGINAL=$$(_OBJ_ASM_ORIGINAL) OBJ_FILTERED=$$(_OBJ_ASM_FILTERED))
   1122 
   1123   # We need to transform the source into an assembly file, instead of
   1124   # an object. The proper way to do that depends on the file extension.
   1125   #
   1126   # For C and C++ source files, simply replace the -c by an -S in the
   1127   # compilation command (this forces the compiler to generate an
   1128   # assembly file).
   1129   #
   1130   # For assembler templates (which end in .S), replace the -c with -E
   1131   # to send it to the preprocessor instead.
   1132   #
   1133   # Don't do anything for plain assembly files (which end in .s)
   1134   #
   1135   ifeq (,$$(filter %.s,$$(_SRC)))
   1136     _OBJ   := $$(_OBJ_ASM_ORIGINAL)
   1137     ifneq (,$$(filter %.S,$$(_SRC)))
   1138       _FLAGS := $$(patsubst -c,-E,$$(_ORG_FLAGS))
   1139     else
   1140       _FLAGS := $$(patsubst -c,-S,$$(_ORG_FLAGS))
   1141     endif
   1142     $$(eval $$(call ev-build-file))
   1143   endif
   1144 
   1145   # Next, process the assembly file with the filter
   1146   $$(_OBJ_ASM_FILTERED): PRIVATE_SRC    := $$(_OBJ_ASM_ORIGINAL)
   1147   $$(_OBJ_ASM_FILTERED): PRIVATE_DST    := $$(_OBJ_ASM_FILTERED)
   1148   $$(_OBJ_ASM_FILTERED): PRIVATE_FILTER := $$(LOCAL_FILTER_ASM)
   1149   $$(_OBJ_ASM_FILTERED): PRIVATE_MODULE := $$(LOCAL_MODULE)
   1150   $$(_OBJ_ASM_FILTERED): $$(_OBJ_ASM_ORIGINAL)
   1151 	@echo "AsmFilter      : $$(PRIVATE_MODULE) <= $$(notdir $$(PRIVATE_SRC))"
   1152 	$(hide) $$(PRIVATE_FILTER) $$(PRIVATE_SRC) $$(PRIVATE_DST)
   1153 
   1154   # Then, generate the final object, we need to keep assembler-specific
   1155   # flags which look like -Wa,<option>:
   1156   _SRC   := $$(_OBJ_ASM_FILTERED)
   1157   _OBJ   := $$(_ORG_OBJ)
   1158   _FLAGS := $$(filter -Wa%,$$(_ORG_FLAGS)) -c
   1159   _TEXT  := "Assembly     "
   1160   $$(eval $$(call ev-build-file))
   1161 endif
   1162 endef
   1163 
   1164 # -----------------------------------------------------------------------------
   1165 # Template  : ev-compile-c-source
   1166 # Arguments : 1: single C source file name (relative to LOCAL_PATH)
   1167 #             2: target object file (without path)
   1168 # Returns   : None
   1169 # Usage     : $(eval $(call ev-compile-c-source,<srcfile>,<objfile>)
   1170 # Rationale : Internal template evaluated by compile-c-source and
   1171 #             compile-s-source
   1172 # -----------------------------------------------------------------------------
   1173 define  ev-compile-c-source
   1174 _SRC:=$$(LOCAL_PATH)/$(1)
   1175 _OBJ:=$$(LOCAL_OBJS_DIR)/$(2)
   1176 
   1177 _FLAGS := $$($$(my)CFLAGS) \
   1178           $$(call get-src-file-target-cflags,$(1)) \
   1179           $$(call host-c-includes,$$(LOCAL_C_INCLUDES) $$(LOCAL_PATH)) \
   1180           $$(LOCAL_CFLAGS) \
   1181           $$(NDK_APP_CFLAGS) \
   1182           $$(call host-c-includes,$$($(my)C_INCLUDES)) \
   1183           -c \
   1184 
   1185 _TEXT := "Compile $$(call get-src-file-text,$1)"
   1186 _CC   := $$(NDK_CCACHE) $$(TARGET_CC)
   1187 
   1188 $$(eval $$(call ev-build-source-file))
   1189 endef
   1190 
   1191 # -----------------------------------------------------------------------------
   1192 # Function  : compile-c-source
   1193 # Arguments : 1: single C source file name (relative to LOCAL_PATH)
   1194 #             2: object file
   1195 # Returns   : None
   1196 # Usage     : $(call compile-c-source,<srcfile>,<objfile>)
   1197 # Rationale : Setup everything required to build a single C source file
   1198 # -----------------------------------------------------------------------------
   1199 compile-c-source = $(eval $(call ev-compile-c-source,$1,$2))
   1200 
   1201 # -----------------------------------------------------------------------------
   1202 # Function  : compile-s-source
   1203 # Arguments : 1: single Assembly source file name (relative to LOCAL_PATH)
   1204 #             2: object file
   1205 # Returns   : None
   1206 # Usage     : $(call compile-s-source,<srcfile>,<objfile>)
   1207 # Rationale : Setup everything required to build a single Assembly source file
   1208 # -----------------------------------------------------------------------------
   1209 compile-s-source = $(eval $(call ev-compile-c-source,$1,$2))
   1210 
   1211 
   1212 # -----------------------------------------------------------------------------
   1213 # Template  : ev-compile-cpp-source
   1214 # Arguments : 1: single C++ source file name (relative to LOCAL_PATH)
   1215 #             2: target object file (without path)
   1216 # Returns   : None
   1217 # Usage     : $(eval $(call ev-compile-cpp-source,<srcfile>,<objfile>)
   1218 # Rationale : Internal template evaluated by compile-cpp-source
   1219 # -----------------------------------------------------------------------------
   1220 
   1221 define  ev-compile-cpp-source
   1222 _SRC:=$$(LOCAL_PATH)/$(1)
   1223 _OBJ:=$$(LOCAL_OBJS_DIR)/$(2)
   1224 _FLAGS := $$($$(my)CXXFLAGS) \
   1225           $$(call get-src-file-target-cflags,$(1)) \
   1226           $$(call host-c-includes, $$(LOCAL_C_INCLUDES) $$(LOCAL_PATH)) \
   1227           $$(LOCAL_CFLAGS) \
   1228           $$(LOCAL_CPPFLAGS) \
   1229           $$(LOCAL_CXXFLAGS) \
   1230           $$(NDK_APP_CFLAGS) \
   1231           $$(NDK_APP_CPPFLAGS) \
   1232           $$(NDK_APP_CXXFLAGS) \
   1233           $$(call host-c-includes,$$($(my)C_INCLUDES)) \
   1234           -c \
   1235 
   1236 _CC   := $$(NDK_CCACHE) $$($$(my)CXX)
   1237 _TEXT := "Compile++ $$(call get-src-file-text,$1)"
   1238 
   1239 $$(eval $$(call ev-build-source-file))
   1240 endef
   1241 
   1242 # -----------------------------------------------------------------------------
   1243 # Function  : compile-cpp-source
   1244 # Arguments : 1: single C++ source file name (relative to LOCAL_PATH)
   1245 #           : 2: object file name
   1246 # Returns   : None
   1247 # Usage     : $(call compile-c-source,<srcfile>)
   1248 # Rationale : Setup everything required to build a single C++ source file
   1249 # -----------------------------------------------------------------------------
   1250 compile-cpp-source = $(eval $(call ev-compile-cpp-source,$1,$2))
   1251 
   1252 # -----------------------------------------------------------------------------
   1253 # Command   : cmd-install-file
   1254 # Arguments : 1: source file
   1255 #             2: destination file
   1256 # Returns   : None
   1257 # Usage     : $(call cmd-install-file,<srcfile>,<dstfile>)
   1258 # Rationale : To be used as a Make build command to copy/install a file to
   1259 #             a given location.
   1260 # -----------------------------------------------------------------------------
   1261 define cmd-install-file
   1262 @mkdir -p $(dir $2)
   1263 $(hide) cp -fp $1 $2
   1264 endef
   1265 
   1266 
   1267 #
   1268 #  Module imports
   1269 #
   1270 
   1271 # Initialize import list
   1272 import-init = $(eval __ndk_import_dirs :=)
   1273 
   1274 # Add an optional single directory to the list of import paths
   1275 #
   1276 import-add-path-optional = \
   1277   $(if $(strip $(wildcard $1)),\
   1278     $(call ndk_log,Adding import directory: $1)\
   1279     $(eval __ndk_import_dirs += $1)\
   1280   )\
   1281 
   1282 # Add a directory to the list of import paths
   1283 # This will warn if the directory does not exist
   1284 #
   1285 import-add-path = \
   1286   $(if $(strip $(wildcard $1)),\
   1287     $(call ndk_log,Adding import directory: $1)\
   1288     $(eval __ndk_import_dirs += $1)\
   1289   ,\
   1290     $(call __ndk_info,WARNING: Ignoring unknown import directory: $1)\
   1291   )\
   1292 
   1293 import-find-module = $(strip \
   1294       $(eval __imported_module :=)\
   1295       $(foreach __import_dir,$(__ndk_import_dirs),\
   1296         $(if $(__imported_module),,\
   1297           $(call ndk_log,  Probing $(__import_dir)/$1/Android.mk)\
   1298           $(if $(strip $(wildcard $(__import_dir)/$1/Android.mk)),\
   1299             $(eval __imported_module := $(__import_dir)/$1)\
   1300           )\
   1301         )\
   1302       )\
   1303       $(__imported_module)\
   1304     )
   1305 
   1306 # described in docs/IMPORT-MODULE.TXT
   1307 # $1: tag name for the lookup
   1308 #
   1309 # Small technical note on __ndk_import_depth: we use this variable to
   1310 # record the depth of recursive import-module calls. The variable is
   1311 # initially empty, and we append a "x" to it each time import-module is
   1312 # called. I.e. for three recursive calls to import-module, we would get
   1313 # the values:
   1314 #
   1315 #   first call:   x
   1316 #   second call:  xx
   1317 #   third call:   xxx
   1318 #
   1319 # This is used in module-add to add the top-level modules (i.e. those
   1320 # that are not added with import-module) to __ndk_top_modules, corresponding
   1321 # to the default list of wanted modules (see setup-toolchain.mk).
   1322 #
   1323 import-module = \
   1324     $(eval __import_tag := $(strip $1))\
   1325     $(if $(call seq,$(words $(__import_tag)),1),,\
   1326       $(call __ndk_info,$(call local-makefile): Cannot import module with spaces in tag: '$(__import_tag)')\
   1327     )\
   1328     $(if $(call set_is_member,$(__ndk_import_list),$(__import_tag)),\
   1329       $(call ndk_log,Skipping duplicate import for module with tag '$(__import_tag)')\
   1330     ,\
   1331       $(call ndk_log,Looking for imported module with tag '$(__import_tag)')\
   1332       $(eval __imported_path := $(call import-find-module,$(__import_tag)))\
   1333       $(if $(__imported_path),\
   1334         $(call ndk_log,    Found in $(__imported_path))\
   1335         $(eval __ndk_import_depth := $(__ndk_import_depth)x) \
   1336         $(eval __ndk_import_list := $(call set_insert,$(__ndk_import_list),$(__import_tag)))\
   1337         $(eval include $(__imported_path)/Android.mk)\
   1338         $(eval __ndk_import_depth := $(__ndk_import_depth:%x=%))\
   1339       ,\
   1340         $(call __ndk_info,$(call local-makefile): Cannot find module with tag '$(__import_tag)' in import path)\
   1341         $(call __ndk_info,Are you sure your NDK_MODULE_PATH variable is properly defined ?)\
   1342         $(call __ndk_info,The following directories were searched:)\
   1343         $(for __import_dir,$(__ndk_import_dirs),\
   1344           $(call __ndk_info,    $(__import_dir))\
   1345         )\
   1346         $(call __ndk_error,Aborting.)\
   1347       )\
   1348    )
   1349 
   1350 # Only used for debugging
   1351 #
   1352 import-debug = \
   1353     $(info IMPORT DIRECTORIES:)\
   1354     $(foreach __dir,$(__ndk_import_dirs),\
   1355       $(info -- $(__dir))\
   1356     )\
   1357 
   1358 #
   1359 #  Module classes
   1360 #
   1361 NDK_MODULE_CLASSES :=
   1362 
   1363 # Register a new module class
   1364 # $1: class name (e.g. STATIC_LIBRARY)
   1365 # $2: optional file prefix (e.g. 'lib')
   1366 # $3: optional file suffix (e.g. '.so')
   1367 #
   1368 module-class-register = \
   1369     $(eval NDK_MODULE_CLASSES += $1) \
   1370     $(eval NDK_MODULE_CLASS.$1.FILE_PREFIX := $2) \
   1371     $(eval NDK_MODULE_CLASS.$1.FILE_SUFFIX := $3) \
   1372     $(eval NDK_MODULE_CLASS.$1.INSTALLABLE := $(false)) \
   1373 
   1374 # Same a module-class-register, for installable modules
   1375 #
   1376 # An installable module is one that will be copied to $PROJECT/libs/<abi>/
   1377 # during the NDK build.
   1378 #
   1379 # $1: class name
   1380 # $2: optional file prefix
   1381 # $3: optional file suffix
   1382 #
   1383 module-class-register-installable = \
   1384     $(call module-class-register,$1,$2,$3) \
   1385     $(eval NDK_MODULE_CLASS.$1.INSTALLABLE := $(true))
   1386 
   1387 module-class-set-prebuilt = \
   1388     $(eval NDK_MODULE_CLASS.$1.PREBUILT := $(true))
   1389 
   1390 # Returns $(true) if $1 is a valid/registered LOCAL_MODULE_CLASS value
   1391 #
   1392 module-class-check = $(call set_is_member,$(NDK_MODULE_CLASSES),$1)
   1393 
   1394 # Returns $(true) if $1 corresponds to an installable module class
   1395 #
   1396 module-class-is-installable = $(if $(NDK_MODULE_CLASS.$1.INSTALLABLE),$(true),$(false))
   1397 
   1398 # Returns $(true) if $1 corresponds to an installable module class
   1399 #
   1400 module-class-is-prebuilt = $(if $(NDK_MODULE_CLASS.$1.PREBUILT),$(true),$(false))
   1401 
   1402 #
   1403 # Register valid module classes
   1404 #
   1405 
   1406 # static libraries:
   1407 # <foo> -> lib<foo>.a by default
   1408 $(call module-class-register,STATIC_LIBRARY,lib,.a)
   1409 
   1410 # shared libraries:
   1411 # <foo> -> lib<foo>.so
   1412 # a shared library is installable.
   1413 $(call module-class-register-installable,SHARED_LIBRARY,lib,.so)
   1414 
   1415 # executable
   1416 # <foo> -> <foo>
   1417 # an executable is installable.
   1418 $(call module-class-register-installable,EXECUTABLE,,)
   1419 
   1420 # prebuilt shared library
   1421 # <foo> -> <foo>  (we assume it is already well-named)
   1422 # it is installable
   1423 $(call module-class-register-installable,PREBUILT_SHARED_LIBRARY,,)
   1424 $(call module-class-set-prebuilt,PREBUILT_SHARED_LIBRARY)
   1425 
   1426 # prebuilt static library
   1427 # <foo> -> <foo> (we assume it is already well-named)
   1428 $(call module-class-register,PREBUILT_STATIC_LIBRARY,,)
   1429 $(call module-class-set-prebuilt,PREBUILT_STATIC_LIBRARY)
   1430 
   1431 #
   1432 # C++ STL support
   1433 #
   1434 
   1435 # The list of registered STL implementations we support
   1436 NDK_STL_LIST :=
   1437 
   1438 # Used internally to register a given STL implementation, see below.
   1439 #
   1440 # $1: STL name as it appears in APP_STL (e.g. system)
   1441 # $2: STL module name (e.g. cxx-stl/system)
   1442 # $3: list of static libraries all modules will depend on
   1443 # $4: list of shared libraries all modules will depend on
   1444 #
   1445 ndk-stl-register = \
   1446     $(eval __ndk_stl := $(strip $1)) \
   1447     $(eval NDK_STL_LIST += $(__ndk_stl)) \
   1448     $(eval NDK_STL.$(__ndk_stl).IMPORT_MODULE := $(strip $2)) \
   1449     $(eval NDK_STL.$(__ndk_stl).STATIC_LIBS := $(strip $3)) \
   1450     $(eval NDK_STL.$(__ndk_stl).SHARED_LIBS := $(strip $4))
   1451 
   1452 # Called to check that the value of APP_STL is a valid one.
   1453 # $1: STL name as it apperas in APP_STL (e.g. 'system')
   1454 #
   1455 ndk-stl-check = \
   1456     $(if $(call set_is_member,$(NDK_STL_LIST),$1),,\
   1457         $(call __ndk_info,Invalid APP_STL value: $1)\
   1458         $(call __ndk_info,Please use one of the following instead: $(NDK_STL_LIST))\
   1459         $(call __ndk_error,Aborting))
   1460 
   1461 # Called before the top-level Android.mk is parsed to
   1462 # select the STL implementation.
   1463 # $1: STL name as it appears in APP_STL (e.g. system)
   1464 #
   1465 ndk-stl-select = \
   1466     $(call import-module,$(NDK_STL.$1.IMPORT_MODULE))
   1467 
   1468 # Called after all Android.mk files are parsed to add
   1469 # proper STL dependencies to every C++ module.
   1470 # $1: STL name as it appears in APP_STL (e.g. system)
   1471 #
   1472 ndk-stl-add-dependencies = \
   1473     $(call modules-add-c++-dependencies,\
   1474         $(NDK_STL.$1.STATIC_LIBS),\
   1475         $(NDK_STL.$1.SHARED_LIBS))
   1476 
   1477 #
   1478 #
   1479 
   1480 # Register the 'system' STL implementation
   1481 #
   1482 $(call ndk-stl-register,\
   1483     system,\
   1484     cxx-stl/system,\
   1485     libstdc++,\
   1486     )
   1487 
   1488 # Register the 'stlport_static' STL implementation
   1489 #
   1490 $(call ndk-stl-register,\
   1491     stlport_static,\
   1492     cxx-stl/stlport,\
   1493     stlport_static,\
   1494     )
   1495 
   1496 # Register the 'stlport_shared' STL implementation
   1497 #
   1498 $(call ndk-stl-register,\
   1499     stlport_shared,\
   1500     cxx-stl/stlport,\
   1501     ,\
   1502     stlport_shared\
   1503     )
   1504 
   1505 # Register the 'gnustl_static' STL implementation
   1506 #
   1507 $(call ndk-stl-register,\
   1508     gnustl_static,\
   1509     cxx-stl/gnu-libstdc++,\
   1510     gnustl_static,\
   1511     \
   1512     )
   1513 
   1514 $(call ndk-stl-register,\
   1515     gnustl_shared,\
   1516     cxx-stl/gnu-libstdc++,\
   1517     ,\
   1518     gnustl_shared\
   1519     )
   1520 
   1521 # Register the static version of the GAbi++ C++ runtime
   1522 #
   1523 $(call ndk-stl-register,\
   1524     gabi++_static,\
   1525     cxx-stl/gabi++,\
   1526     gabi++_static,\
   1527     )
   1528 
   1529 # Register the shared version of the GAbi++ C++ runtime
   1530 #
   1531 $(call ndk-stl-register,\
   1532     gabi++_shared,\
   1533     cxx-stl/gabi++,\
   1534     gabi++_shared,\
   1535     )
   1536 
   1537 # The 'none' APP_STL value corresponds to no C++ support at
   1538 # all. Used by some of the STLport and GAbi++ test projects.
   1539 #
   1540 $(call ndk-stl-register,\
   1541     none,\
   1542     cxx-stl/system,\
   1543     )
   1544