Android.mk 中变量含义
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LS_CPP = $(subst $(1)/,,$(wildcard $(1)/*.cpp))
LOCAL_SRC_FILES := $(call LS_CPP,$(LOCAL_PATH))
Android.mk 中变量含义:
-
LOCAL_ variables: These are dedicated to individual module compilation and are defined in Android.mk files.
-
APP_ variables: These refer to application-wide options and are set in Application.mk.
-
NDK_ variables: These are mainly internal variables that usually refer to environment variables (for example, NDK_ROOT, NDK_APP_CFLAGS, or NDK_APP_CPPFLAGS). There are two notable exceptions: NDK_TOOLCHAIN_VERSION and NDK_ APPLICATION_MK. The latter can be passed to the NDK-Build in parameter to define a different Application.mk location.
-
PRIVATE_ prefixed variables: These are for NDK internal use only.
LOCAL_PATH : To specify the root location of source files. Must be defined at the beginning of the Android.mk file before include $(CLEAR_VARS).
LOCAL_SRC_FILES : To define the list of source files to compile, each separated by a space and relative to LOCAL_PATH.
$(wildcard <pattern>) : Selects files and directory names according to a pattern.
$(call <function>) : Allows evaluating a function or macro. One macro we have seen is my-dir, which returns the directory path of the last executed Makefile. This is why LOCAL_PATH := $(call my-dir) is systematically written at the beginning of each Android.mk file to save in the current Makefile directory.
$(subst <from>,<replacement>,<string>) : Replaces each occurrence of a substring by another. The second one is more powerful because it allows using patterns (which must start with "%").
Custom functions can easily be written with the call directive. These functions look somewhat similar to recursively affected variables, except that the arguments can be defined: $(1) for first argument, $(2) for second argument, and so on. A call to a function can be performed in a single line, as shown in the following code:
my_function = $(<do_something> ${1} , ${2})
$(call my_function, myparam)
APP_ABI : List of ABI (that is, "CPU architectures") supported by the application, separated by a space. Currently supported values are armeabi, armeabi-v7a, x86, mips, or all. Each module is recompiled once per ABI. So, the more ABI you support, the more time it will get to build.
APP_STL : The C++ runtime to use. Possible values are system, gabi++_ static, gabi++_shared, stlport_static, stlport_ shared, gnustl_static, gnustl_shared, c++_static, and c++_shared.
[参考文献]
Android NDK- Beginner's Guide - Second Edition
http://www.gnu.org/software/make/manual/make.html#Wildcard-Function
http://code.google.com/p/android-cmake.

浙公网安备 33010602011771号