当前位置: 首页 > 编程日记 > 正文

Android.mk和Application.mk文件语法规范说明及举例

以下英文内容摘自:http://www.kandroid.org/ndk/docs/OVERVIEW.html
The Android NDK is a set of tools that allows Android application developers to embed native machine code compiled from C and/or C++ source files into their application packages.


NDK development in practice:(1)、Configuring the NDK; (2)、Placing C and C++ sources; (3)、Writing an Android.mk build script; (4)、Writing an Application.mk build file (optional); (5)、Invoke the NDK build system; (6)、Specifying custom output directories.


An Android.mk file is written to describe your sources to the build system.
An Android.mk file is really a tiny GNU Makefile fragment that will be parsed one or more times by the build system.
Only shared libraries will be installed/copied to your application package. Static libraries can be used to generate shared libraries though.
You can define one or more modules in each Android.mk file, and you can use the same source file in several modules.
You don't need to list header files or explicit dependencies between generated files in your Android.mk. The NDK build system will compute these automatically for you.


NDK build system reserves the following variable names:
- names that begin with LOCAL_ (e.g. LOCAL_MODULE)
- names that begin with PRIVATE_, NDK_ or APP_ (used internally)
- lower-case names (used internally, e.g. 'my-dir')

If you need to define your own convenience variables in an Android.mk file, we recommend using the MY_ prefix.


NDK-provided variables:
1、CLEAR_VARS : The CLEAR_VARS variable is provided by the build system and points to a special GNU Makefile that will clear many LOCAL_XXX variables for you(e.g. LOCAL_MODULE, LOCAL_SRC_FILES, LOCAL_STATIC_LIBRARIES, etc...), with the exception of LOCAL_PATH. This is needed because all build control files are parsed in a single GNU Make execution context where all variables are global. Points to a build script that undefines nearly all LOCAL_XXX variables listed in the "Module-description" section below. You must include the script before starting a new module, e.g.: 

include $(CLEAR_VARS)

2、BUILD_SHARED_LIBRARY :The BUILD_SHARED_LIBRARY is a variable provided by the build system that points to a GNU Makefile script that is in charge of collecting all the information you defined in LOCAL_XXX variables since the latest 'include $(CLEAR_VARS)' and determine what to build, and how to do it exactly. Points to a build script that collects all the information about the module you provided in LOCAL_XXX variables and determines how to build a target shared library from the sources you listed. Note that you must have LOCAL_MODULE and LOCAL_SRC_FILES defined, at a minimum before including this file. Example usage:

include $(BUILD_SHARED_LIBRARY) 

Note that this will generate a file named lib$(LOCAL_MODULE).so
3、BUILD_STATIC_LIBRARY : A variant of BUILD_SHARED_LIBRARY that is used to build a target static library instead. Static libraries are not copied into your project/packages but can be used to build shared libraries (see LOCAL_STATIC_LIBRARIES and LOCAL_STATIC_WHOLE_LIBRARIES described below). Example usage:

include $(BUILD_STATIC_LIBRARY) 
Note that this will generate a file named lib$(LOCAL_MODULE).a
4、PREBUILT_SHARED_LIBRARY : Points to a build script used to specify a prebuilt shared library. Unlike BUILD_SHARED_LIBRARY and BUILD_STATIC_LIBRARY, the value of LOCAL_SRC_FILES must be a single path to a prebuilt shared library (e.g. foo/libfoo.so), instead of a source file.
5、PREBUILT_STATIC_LIBRARY : This is the same as PREBUILT_SHARED_LIBRARY, but for a static library file instead.
6、TARGET_ARCH : Name of the target CPU architecture as it is specified by the full Android open-source build. This is 'arm' for any ARM-compatible build, independent of the CPU architecture revision.
7、TARGET_PLATFORM : Name of the target Android platform when this Android.mk is parsed.
8、TARGET_ARCH_ABI : Name of the target CPU+ABI when this Android.mk is parsed. Two values are supported at the moment: armeabi armeabi-v7a , e.g.:

TARGET_ARCH_ABI := armeabi-v7a

NOTE: Up to Android NDK 1.6_r1, this variable was simply defined as 'arm'. However, the value has been redefined to better match what is used internally by the Android platform.
9、TARGET_ABI : The concatenation of target platform and abi, it really is defined as $(TARGET_PLATFORM)-$(TARGET_ARCH_ABI) and is useful when you want to test against a specific target system image for a real device. By default, this will be 'android-3-armeabi' (Up to Android NDK 1.6_r1, this used to be 'android-3-arm' by default).


NDK-provided function macros:
The following are GNU Make 'function' macros, and must be evaluated by using '$(call <function>)'. They return textual information.
1、my-dir : Returns the path of the last included Makefile, which typically is the current Android.mk's directory. This is useful to define LOCAL_PATH at the start of your Android.mk as with:

LOCAL_PATH := $(call my-dir)

IMPORTANT NOTE: Due to the way GNU Make works, this really returns the path of the *last* *included* *Makefile* during the parsing of build scripts. Do not call my-dir after including another file.
2、all-subdir-makefiles : Returns a list of Android.mk located in all sub-directories of the current 'my-dir' path. For example, consider the following hierarchy:
sources/foo/Android.mk sources/foo/lib1/Android.mk sources/foo/lib2/Android.mk
If sources/foo/Android.mk contains the single line:

include $(call all-subdir-makefiles)

Then it will include automatically sources/foo/lib1/Android.mk and sources/foo/lib2/Android.mk
3、this-makefile : Returns the path of the current Makefile (i.e. where the function is called).
4、parent-makefile : Returns the path of the parent Makefile in the inclusion tree, i.e. the path of the Makefile that included the current one.
5、grand-parent-makefile : Guess what...
6、import-module : A function that allows you to find and include the Android.mk of another module by name. A typical example is: $(call import-module,<name>)
And this will look for the module tagged <name> in the list of directories referenced by your NDK_MODULE_PATH environment variable, and include its Android.mk automatically for you.


Module-description variables:
The following variables are used to describe your module to the build system. You should define some of them between an 'include $(CLEAR_VARS)' and an 'include $(BUILD_XXXXX)'. As written previously, $(CLEAR_VARS) is a script that will undefine/clear all of these variables, unless explicitly noted in their description.
1、LOCAL_PATH :  This variable is used to give the path of the current file. You MUST define it at the start of your Android.mk, which can be done with:

LOCAL_PATH := $(call my-dir)

This variable is *not* cleared by $(CLEAR_VARS) so only one definition per Android.mk is needed (in case you define several modules in a single file).
2、LOCAL_MODULE :This is the name of your module. It must be unique among all module names, and shall not contain any space. You MUST define it before including any $(BUILD_XXXX) script. By default, the module name determines the name of generated files, e.g. lib<foo>.so for a shared library module named <foo>. However you should only refer to other modules with their 'normal' name (e.g. <foo>) in your NDK build files (either Android.mk or Application.mk). e.g.:

LOCAL_MODULE := foo

3、LOCAL_MODULE_FILENAME : This variable is optional, and allows you to redefine the name of generated files. By default, module <foo> will always generate a static library named lib<foo>.a or a shared library named lib<foo>.so, which are standard Unix conventions. You can override this by defining LOCAL_MODULE_FILENAME, For example:

LOCAL_MODULE := foo-version-1 
LOCAL_MODULE_FILENAME := libfoo 

NOTE: You should not put a path or file extension in your LOCAL_MODULE_FILENAME, these will be handled automatically by the build system.
4、LOCAL_SRC_FILES : This is a list of source files that will be built for your module. Only list the files that will be passed to a compiler, since the build system automatically computes dependencies for you. Note that source files names are all relative to LOCAL_PATH and you can use path components, e.g.:

LOCAL_SRC_FILES := foo.c \  toto/bar.c 
NOTE: Always use Unix-style forward slashes (/) in build files. Windows-style back-slashes will not be handled properly.
5、LOCAL_CPP_EXTENSION : This is an optional variable that can be defined to indicate the file extension of C++ source files. The default is '.cpp' but you can change it. For example:

LOCAL_CPP_EXTENSION := .cxx

6、LOCAL_C_INCLUDES : An optional list of paths, relative to the NDK *root* directory, which will be appended to the include search path when compiling all sources (C, C++ and Assembly). For example:

LOCAL_C_INCLUDES := sources/foo

Or even:

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../foo

These are placed before any corresponding inclusion flag in LOCAL_CFLAGS / LOCAL_CPPFLAGS
The LOCAL_C_INCLUDES path are also used automatically when launching native debugging with ndk-gdb.
7、LOCAL_CFLAGS : An optional set of compiler flags that will be passed when building C *and* C++ source files. This can be useful to specify additional macro definitions or compile options. IMPORTANT: Try not to change the optimization/debugging level in your Android.mk, this can be handled automatically for you by specifying the appropriate information in your Application.mk, and will let the NDK generate useful data files used during debugging.
NOTE: In android-ndk-1.5_r1, the corresponding flags only applied to C source files, not C++ ones. This has been corrected to match the full Android build system behaviour. (You can use LOCAL_CPPFLAGS to specify flags for C++ sources only now).
8、 LOCAL_CXXFLAGS : An alias for LOCAL_CPPFLAGS. Note that use of this flag is obsolete as it may disappear in future releases of the NDK.
9、 LOCAL_CPPFLAGS : An optional set of compiler flags that will be passed when building C++ source files *only*. They will appear after the LOCAL_CFLAGS on the compiler's command-line.
NOTE: In android-ndk-1.5_r1, the corresponding flags applied to both C and C++ sources. This has been corrected to match the full Android build system. (You can use LOCAL_CFLAGS to specify flags for both C and C++ sources now).
10、LOCAL_STATIC_LIBRARIES : The list of static libraries modules (built with BUILD_STATIC_LIBRARY) that should be linked to this module. This only makes sense in
shared library modules.
11、LOCAL_SHARED_LIBRARIES : The list of shared libraries *modules* this module depends on at runtime. This is necessary at link time and to embed the corresponding information in the generated file.
12、LOCAL_LDLIBS : The list of additional linker flags to be used when building your module. This is useful to pass the name of specific system libraries with the "-l" prefix. For example, the following will tell the linker to generate a module that links to /system/lib/libz.so at load time:

LOCAL_LDLIBS := -lz

It is possible to specify additional include paths with LOCAL_CFLAGS += -I<path>, however, it is better to use LOCAL_C_INCLUDES for this, since the paths will then also be used during native debugging with ndk-gdb.
13、LOCAL_ALLOW_UNDEFINED_SYMBOLS : By default, any undefined reference encountered when trying to build a shared library will result in an "undefined symbol" error. This is a great help to catch bugs in your source code.
14、LOCAL_ARM_MODE : By default, ARM target binaries will be generated in 'thumb' mode, where each instruction are 16-bit wide. You can define this variable to 'arm'
if you want to force the generation of the module's object files in 'arm' (32-bit instructions) mode. E.g.:

LOCAL_ARM_MODE := arm

Note that you can also instruct the build system to only build specific sources in arm mode by appending an '.arm' suffix to its source file
name. For example, with:

LOCAL_SRC_FILES := foo.c bar.c.arm

Tells the build system to always compile 'bar.c' in arm mode, and to build foo.c according to the value of LOCAL_ARM_MODE.
NOTE: Setting APP_OPTIM to 'debug' in your Application.mk will also force the generation of ARM binaries as well. This is due to bugs in the toolchain debugger that don't deal too well with thumb code. However, if for some reason you need to disable this check, set this variable to 'true'. Note that the corresponding shared library may fail to load at runtime.
15、LOCAL_ARM_NEON : Defining this variable to 'true' allows the use of ARM Advanced SIMD (a.k.a. NEON) GCC intrinsics in your C and C++ sources, as well as NEON instructions in Assembly files. You should only define it when targetting the 'armeabi-v7a' ABI that corresponds to the ARMv7 instruction set. Note that not all ARMv7
based CPUs support the NEON instruction set extensions and that you should perform runtime detection to be able to use this code at runtime safely.
Alternatively, you can also specify that only specific source files may be compiled with NEON support by using the '.neon' suffix, as in:

LOCAL_SRC_FILES = foo.c.neon bar.c zoo.c.arm.neon

In this example, 'foo.c' will be compiled in thumb+neon mode, 'bar.c' will be compiled in 'thumb' mode, and 'zoo.c' will be compiled in 'arm+neon' mode.
Note that the '.neon' suffix must appear after the '.arm' suffix if you use both (i.e. foo.c.arm.neon works, but not foo.c.neon.arm !)
16、LOCAL_DISABLE_NO_EXECUTE : Android NDK r4 added support for the "NX bit" security feature. It is enabled by default, but you can disable it if you *really* need to by setting this variable to 'true'.
NOTE: This feature does not modify the ABI and is only enabled on kernels targetting ARMv6+ CPU devices. Machine code generated with this feature enabled will run unmodified on devices running earlier CPU architectures.
17、LOCAL_EXPORT_CFLAGS : Define this variable to record a set of C/C++ compiler flags that will be added to the LOCAL_CFLAGS definition of any other module that uses
this one with LOCAL_STATIC_LIBRARIES or LOCAL_SHARED_LIBRARIES. For example, consider the module 'foo' with the following definition:

	include $(CLEAR_VARS)LOCAL_MODULE := fooLOCAL_SRC_FILES := foo/foo.cLOCAL_EXPORT_CFLAGS := -DFOO=1include $(BUILD_STATIC_LIBRARY)

And another module, named 'bar' that depends on it as:

	include $(CLEAR_VARS)LOCAL_MODULE := barLOCAL_SRC_FILES := bar.cLOCAL_CFLAGS := -DBAR=2LOCAL_STATIC_LIBRARIES := fooinclude $(BUILD_SHARED_LIBRARY)

Then, the flags '-DFOO=1 -DBAR=2' will be passed to the compiler when building bar.c
Exported flags are prepended to your module's LOCAL_CFLAGS so you can easily override them. They are also transitive: if 'zoo' depends on 'bar' which depends on 'foo', then 'zoo' will also inherit all flags exported by 'foo'. Finally, exported flags are *not* used when building the module that exports them. In the above example, -DFOO=1 would not be passed to the compiler when building foo/foo.c.
18、LOCAL_EXPORT_CPPFLAGS : Same as LOCAL_EXPORT_CFLAGS, but for C++ flags only.
19、LOCAL_EXPORT_C_INCLUDES : Same as LOCAL_EXPORT_CFLAGS, but for C include paths. This can be useful if 'bar.c' wants to include headers that are provided by module 'foo'.
20、LOCAL_EXPORT_LDLIBS : Same as LOCAL_EXPORT_CFLAGS, but for linker flags. Note that the imported linker flags will be appended to your module's LOCAL_LDLIBS though, due to the way Unix linkers work. This is typically useful when module 'foo' is a static library and has code that depends on a system library. LOCAL_EXPORT_LDLIBS can then be used to export the dependency. For example:

	include $(CLEAR_VARS)LOCAL_MODULE := fooLOCAL_SRC_FILES := foo/foo.cLOCAL_EXPORT_LDLIBS := -lloginclude $(BUILD_STATIC_LIBRARY)

	include $(CLEAR_VARS)LOCAL_MODULE := barLOCAL_SRC_FILES := bar.cLOCAL_STATIC_LIBRARIES := fooinclude $(BUILD_SHARED_LIBRARY)

There, libbar.so will be built with a -llog at the end of the linker command to indicate that it depends on the system logging library, because it depends on 'foo'.
21、LOCAL_FILTER_ASM : Define this variable to a shell command that will be used to filter the assembly files from, or generated from, your LOCAL_SRC_FILES. When it is defined, the following happens:
- Any C or C++ source file is generated into a temporary assembly
file (instead of being compiled into an object file).
- Any temporary assembly file, and any assembly file listed in
LOCAL_SRC_FILES is sent through the LOCAL_FILTER_ASM command
to generate _another_ temporary assembly file.
- These filtered assembly files are compiled into object file.
In other words, If you have:

	LOCAL_SRC_FILES  := foo.c bar.SLOCAL_FILTER_ASM := myasmfilter

foo.c --1--> $OBJS_DIR/foo.S.original --2--> $OBJS_DIR/foo.S --3--> $OBJS_DIR/foo.o
bar.S --2--> $OBJS_DIR/bar.S --3--> $OBJS_DIR/bar.o
Were "1" corresponds to the compiler, "2" to the filter, and "3" to the assembler. The filter must be a standalone shell command that takes the name of the input file as its first argument, and the name of the output file as the second one, as in:
myasmfilter $OBJS_DIR/foo.S.original $OBJS_DIR/foo.S
myasmfilter bar.S $OBJS_DIR/bar.S


The purpose of Application.mk is to describe which native 'modules' (i.e. static/shared libraries) are needed by your application.
An Application.mk file is usually placed under $PROJECT/jni/Application.mk, where $PROJECT points to your application's project directory.
The Application.mk is really a tiny GNU Makefile fragment that must define a few variables:
1、APP_PROJECT_PATH : This variable should give the *absolute* path to your Application's project root directory. This is used to copy/install stripped versions of the generated JNI shared libraries to a specific location known to the APK-generating tools.
Note that it is optional for $PROJECT/jni/Application.mk, but *mandatory* for $NDK/apps/<myapp>/Application.mk
2、APP_MODULES : This variable is optional. If not defined, the NDK will build by default _all_ the modules declared by your Android.mk, and any sub-makefile it may include. If APP_MODULES is defined, it must be a space-separated list of module names as they appear in the LOCAL_MODULE definitions of Android.mk files. Note that the NDK will compute module dependencies automatically.
3、APP_OPTIM : This optional variable can be defined to either 'release' or 'debug'. This is used to alter the optimization level when building your application's modules. A 'release' mode is the default, and will generate highly optimized binaries. The 'debug' mode will generate un-optimized binaries which are much easier to debug.
Note that if your application is debuggable (i.e. if your manifest sets the android:debuggable attribute to "true" in its <application> tag), the default will be 'debug' instead of 'release'. This can be overridden by setting APP_OPTIM to 'release'.
Note that it is possible to debug both 'release' and 'debug' binaries, but the 'release' builds tend to provide less information during debugging sessions: some variables are optimized out and can't be inspected, code re-ordering can make stepping through the code difficult, stack traces may not be reliable, etc...
4、APP_CFLAGS : A set of C compiler flags passed when compiling any C or C++ source code of any of the modules. This can be used to change the build of a given module depending on the application that needs it, instead of modifying the Android.mk file itself.
5、APP_CXXFLAGS : An alias for APP_CPPFLAGS, to be considered obsolete as it may disappear in a future release of the NDK.
6、APP_CPPFLAGS : A set of C++ compiler flags passed when building C++ sources *only*.
7、APP_BUILD_SCRIPT : By default, the NDK build system will look for a file named Android.mk under $(APP_PROJECT_PATH)/jni, i.e. for the file:

$(APP_PROJECT_PATH)/jni/Android.mk

If you want to override this behaviour, you can define APP_BUILD_SCRIPT to point to an alternate build script. A non-absolute path will always be interpreted as relative to the NDK's top-level directory.
8、APP_ABI : By default, the NDK build system will generate machine code for the 'armeabi' ABI. This corresponds to an ARMv5TE based CPU with software floating point operations. You can use APP_ABI to select a different ABI.
For example, to support hardware FPU instructions on ARMv7 based devices, use:

APP_ABI := armeabi-v7a

Or to support the IA-32 instruction set, use:

APP_ABI := x86

Or to support the MIPS instruction set, use:

APP_ABI := mips

Or to support all at the same time, use:

APP_ABI := armeabi armeabi-v7a x86 mips

Or even better, since NDK r7, you can also use the special value 'all' which means "all ABIs supported by this NDK release":

APP_ABI := all

9、APP_STL : By default, the NDK build system provides C++ headers for the minimal C++ runtime library (/system/lib/libstdc++.so) provided by the Android system.
However, the NDK comes with alternative C++ implementations that you can use or link to in your own applications. Define APP_STL to select one of them. Examples are:

   APP_STL := stlport_static    --> static STLport libraryAPP_STL := stlport_shared    --> shared STLport libraryAPP_STL := system            --> default C++ runtime library

10、APP_GNUSTL_FORCE_CPP_FEATURES : In prior NDK versions, the simple fact of using the GNU libstdc++ runtime (i.e. by setting APP_STL to either 'gnustl_static' or 'gnustl_shared') enforced the support for exceptions and RTTI in all generated machine code. This could be problematic in specific, but rare, cases, and also generated un-necessarily bigger code for projects that don't require these features.
This bug was fixed in NDK r7b, but this means that if your code requires exceptions or RTTI, it should now explicitely say so, either in your APP_CPPFLAGS, or your LOCAL_CPPFLAGS / LOCAL_CPP_FEATURES definitions. To make it easier to port projects to NDK r7b and later, one can optionally defined APP_GNUSTL_CPP_FEATURES to contain one or more of the following values:
exceptions -> to enforce exceptions support for all modules.
rtti -> to enforce rtti support for all modules.
For example, to get the exact same behaviour than NDK r7:

APP_GNUSTL_FORCE_CPP_FEATURES := exceptions rtti

IMPORTANT: This variable is provided here as a convenience to make it easier to transition to a newer version of the NDK. It will be removed in a future revision. We thus encourage all developers to modify the module definitions properly instead of relying on it here.
11、APP_SHORT_COMMANDS : The equivalent of LOCAL_SHORT_COMMANDS for your whole project.


Android Native CPU ABI Management:
1、'armeabi':This is the name of an ABI for ARM-based CPUs that support *at* *least* the ARMv5TE instruction set.
2、'armeabi-v7a':This is the name of another ARM-based CPU ABI that *extends* 'armeabi' to include a few CPU instruction set extensions.
3、'x86':This is the name of an ABI for CPUs supporting the instruction set commonly named 'x86' or 'IA-32'.
4、'mips':This is the name of an ABI for MIPS-based CPUs that support *at* *least* the MIPS32r1 instruction set.


Android.mk使用举例(http://stackoverflow.com/questions/12260149/libjpeg-turbo-for-android):

# Makefile for libjpeg-turboifneq ($(TARGET_SIMULATOR),true)##################################################
###                simd                        ###
##################################################
LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)ifeq ($(ARCH_ARM_HAVE_NEON),true) LOCAL_CFLAGS += -D__ARM_HAVE_NEON
endif# From autoconf-generated Makefile
EXTRA_DIST = simd/nasm_lt.sh simd/jcclrmmx.asm simd/jcclrss2.asm simd/jdclrmmx.asm simd/jdclrss2.asm \simd/jdmrgmmx.asm simd/jdmrgss2.asm simd/jcclrss2-64.asm simd/jdclrss2-64.asm \simd/jdmrgss2-64.asm simd/CMakeLists.txtlibsimd_SOURCES_DIST = simd/jsimd_arm_neon.S \simd/jsimd_arm.c LOCAL_SRC_FILES := $(libsimd_SOURCES_DIST)LOCAL_C_INCLUDES := $(LOCAL_PATH)/simd \$(LOCAL_PATH)/androidAM_CFLAGS := -march=armv7-a -mfpu=neon
AM_CCASFLAGS := -march=armv7-a -mfpu=neonLOCAL_MODULE_TAGS := debugLOCAL_MODULE := libsimdinclude $(BUILD_STATIC_LIBRARY)######################################################
###           libjpeg.so                       ##
######################################################include $(CLEAR_VARS)# From autoconf-generated Makefile
libjpeg_SOURCES_DIST =  jcapimin.c jcapistd.c jccoefct.c jccolor.c \jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c \jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c \jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c \jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c \jaricom.c jcarith.c jdarith.c \turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c \turbojpeg-mapfileLOCAL_SRC_FILES:= $(libjpeg_SOURCES_DIST)LOCAL_SHARED_LIBRARIES := libcutils
LOCAL_STATIC_LIBRARIES := libsimdLOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS := -DAVOID_TABLES  -O3 -fstrict-aliasing -fprefetch-loop-arrays  -DANDROID \-DANDROID_TILE_BASED_DECODE -DENABLE_ANDROID_NULL_CONVERTLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_STATIC_LIBRARY)LOCAL_MODULE_TAGS := debugLOCAL_MODULE := libjpeginclude $(BUILD_SHARED_LIBRARY)######################################################
###         cjpeg                                  ###
######################################################include $(CLEAR_VARS)# From autoconf-generated Makefile
cjpeg_SOURCES = cdjpeg.c cjpeg.c rdbmp.c rdgif.c \rdppm.c rdswitch.c rdtarga.cLOCAL_SRC_FILES:= $(cjpeg_SOURCES)LOCAL_SHARED_LIBRARIES := libjpegLOCAL_C_INCLUDES := $(LOCAL_PATH) \$(LOCAL_PATH)/androidLOCAL_CFLAGS := -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED \-DANDROID -DANDROID_TILE_BASED_DECODE -DENABLE_ANDROID_NULL_CONVERTLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLE)LOCAL_MODULE_TAGS := debugLOCAL_MODULE := cjpeginclude $(BUILD_EXECUTABLE)######################################################
###            djpeg                               ###
######################################################include $(CLEAR_VARS)# From autoconf-generated Makefile
djpeg_SOURCES = cdjpeg.c djpeg.c rdcolmap.c rdswitch.c \wrbmp.c wrgif.c wrppm.c wrtarga.cLOCAL_SRC_FILES:= $(djpeg_SOURCES)LOCAL_SHARED_LIBRARIES := libjpegLOCAL_C_INCLUDES := $(LOCAL_PATH) \$(LOCAL_PATH)/androidLOCAL_CFLAGS := -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED \-DANDROID -DANDROID_TILE_BASED_DECODE -DENABLE_ANDROID_NULL_CONVERTLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLE)LOCAL_MODULE_TAGS := debugLOCAL_MODULE := djpeginclude $(BUILD_EXECUTABLE)######################################################
###            jpegtran                            ###
######################################################include $(CLEAR_VARS)# From autoconf-generated Makefile
jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.cLOCAL_SRC_FILES:= $(jpegtran_SOURCES)LOCAL_SHARED_LIBRARIES := libjpegLOCAL_C_INCLUDES := $(LOCAL_PATH) \$(LOCAL_PATH)/androidLOCAL_CFLAGS := -DANDROID -DANDROID_TILE_BASED_DECODE -DENABLE_ANDROID_NULL_CONVERTLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLE)LOCAL_MODULE_TAGS := debugLOCAL_MODULE := jpegtraninclude $(BUILD_EXECUTABLE)######################################################
###              tjunittest                        ###
######################################################include $(CLEAR_VARS)# From autoconf-generated Makefile
tjunittest_SOURCES = tjunittest.c tjutil.cLOCAL_SRC_FILES:= $(tjunittest_SOURCES)LOCAL_SHARED_LIBRARIES := libjpegLOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS := -DANDROID -DANDROID_TILE_BASED_DECODE -DENABLE_ANDROID_NULL_CONVERTLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLE)LOCAL_MODULE_TAGS := debugLOCAL_MODULE := tjunittestinclude $(BUILD_EXECUTABLE)######################################################
###              tjbench                           ###
######################################################include $(CLEAR_VARS)# From autoconf-generated Makefile
tjbench_SOURCES = tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c \wrbmp.c wrppm.cLOCAL_SRC_FILES:= $(tjbench_SOURCES)LOCAL_SHARED_LIBRARIES := libjpegLOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS := -DBMP_SUPPORTED -DPPM_SUPPORTED \-DANDROID -DANDROID_TILE_BASED_DECODE -DENABLE_ANDROID_NULL_CONVERTLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLE)LOCAL_MODULE_TAGS := debugLOCAL_MODULE := tjbenchinclude $(BUILD_EXECUTABLE)######################################################
###             rdjpgcom                           ###
######################################################include $(CLEAR_VARS)# From autoconf-generated Makefile
rdjpgcom_SOURCES = rdjpgcom.cLOCAL_SRC_FILES:= $(rdjpgcom_SOURCES)LOCAL_SHARED_LIBRARIES := libjpegLOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS :=  -DANDROID -DANDROID_TILE_BASED_DECODE -DENABLE_ANDROID_NULL_CONVERTLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLE)LOCAL_MODULE_TAGS := debugLOCAL_MODULE := rdjpgcominclude $(BUILD_EXECUTABLE)######################################################
###           wrjpgcom                            ###
######################################################include $(CLEAR_VARS)# From autoconf-generated Makefile
wrjpgcom_SOURCES = wrjpgcom.cLOCAL_SRC_FILES:= $(wrjpgcom_SOURCES)LOCAL_SHARED_LIBRARIES := libjpegLOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS := -DANDROID -DANDROID_TILE_BASED_DECODE -DENABLE_ANDROID_NULL_CONVERTLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLE)LOCAL_MODULE_TAGS := debugLOCAL_MODULE := wrjpgcominclude $(BUILD_EXECUTABLE)endif  # TARGET_SIMULATOR != true

Application.mk使用举例:

# Build both ARMv5TE and ARMv7-A machine code.#APP_ABI := armeabi
#APP_ABI := armeabi-v7a
APP_ABI := armeabi armeabi-v7a# APP_OPTIM := release OR debug#By default, the headers and libraries for the minimal C++ runtime system
#library (/system/lib/libstdc++.so) are used when building C++ sources.
#
#You can however select a different implementation by setting the variable
#APP_STL to something else in your Application.mk, for example:
#
#system              -> Use the default minimal C++ runtime library.
#stlport_static      -> Use STLport built as a static library.
#stlport_shared      -> Use STLport built as a shared library.
#gnustl_static       -> Use GNU libstdc++ as a static library.APP_STL := stlport_static
#APP_STL := stlport_shared
#APP_STL := gnustl_static#STLPORT_FORCE_REBUILD := true

# Build both ARMv5TE and ARMv7-A machine code.
APP_PLATFORM :=android-14
APP_MODULES := jpegTest
APP_ABI := armeabi armeabi-v7a 
APP_STL := stlport_static
APP_CPPFLAGS += -fexceptions
#for using c++ features,you need to enable these in your Makefile
APP_CPP_FEATURES += exceptions rtti

参考文献:

1、http://blog.csdn.net/smfwuxiao/article/details/8530742
2、http://www.oschina.net/question/565065_93983


相关文章:

ASP.NET Web API实践系列06, 在ASP.NET MVC 4 基础上增加使用ASP.NET WEB API

本篇尝试在现有的ASP.NET MVC 4 项目上增加使用ASP.NET Web API。 新建项目&#xff0c;选择"ASP.NET MVC 4 Web应用程序"。 选择"基本"项目模版。 在Controllers文件夹下添加一个名称为"TestController"的空API控制器。 在引用文件夹中多了以下…

滴滴自动驾驶部门成立独立公司,CTO张博兼任新公司CEO

整理 | 夕颜出品 | AI科技大本营&#xff08;ID:rgznai100&#xff09;导读&#xff1a;8 月 5 日&#xff0c;滴滴出行官方微信公众号发文&#xff0c;宣布旗下自动驾驶部门升级为独立公司。目前&#xff0c;新成立公司的名称还未曝光&#xff0c;但据官方介绍将专注于自动驾驶…

在ASP.NET MVC下实现树形导航菜单

在需要处理很多分类以及导航的时候&#xff0c;树形导航菜单就比较适合。例如在汽车之家上&#xff1a; 页面主要分两部分&#xff0c;左边是导航菜单&#xff0c;右边显示对应的内容。现在&#xff0c;我们就在ASP.NET MVC 4 下临摹一个&#xff0c;如下&#xff1a; 实现的效…

mongodb学习笔记6--杂项与补充

2019独角兽企业重金招聘Python工程师标准>>> 1。适用场景&#xff1a;持久化缓存层&#xff0c;高效的时效性&#xff0c;用于对象和Json数据的存储&#xff0c;高伸缩性的场景&#xff0c;大尺寸&#xff0c;低价值的数据存储。 不适用&#xff1a;高度事务性的场景…

GraphSAGE:我寻思GCN也没我厉害!

作者 | 郭必扬来源 | SimpleAI&#xff08;ID:SimpleAI_1&#xff09;众所周知&#xff0c;2017年ICLR出产的GCN现在是多么地热门&#xff0c;仿佛自己就是图神经网络的名片。然而&#xff0c;在GCN的风头中&#xff0c;很多人忽略了GCN本身的巨大局限——Transductive Learnin…

CxImage的编译及简单使用举例

1、 从http://sourceforge.net/projects/cximage/下载最新的CxImage 702源码&#xff1b; 2、 解压缩后&#xff0c;以管理员身份打开CxImageFull_vc10.sln工程&#xff0c;在编译之前先将每个工程属性的Character Set由原先的Use Unicode Character Set改为Use Multi-ByteC…

如何使用好android的可访问性服务(Accessibility Services)

原文&#xff1a;http://android.eoe.cn/topic/android_sdk * 主题* Manifest声明和权限 可访问性服务声明 可访问性服务配置 AccessibilityService方法 获得事件细节 示例代码 主要的类*AccessibilityService AccessibilityServiceInfo AccessibilityEvent AccessibilityReco…

自动驾驶人的福音!Lyft公开Level 5部署平台Flexo细节

作者 | Mathias Gug等&#xff0c;Lyft Level 5 软件工程师译者 | Lucy编辑 | 夕颜出品 | AI科技大本营&#xff08;ID:rgznai100&#xff09;导读&#xff1a;经过一年半的 bootstrapping&#xff08;一种再抽样统计方法&#xff09;&#xff0c;Lyft 让 Level 5 实现区分非常…

Cygwin的安装及在Android jni中的简单使用举例

Cygwin是一个在windows平台上运行的类UNIX模拟环境&#xff0c;是cygnussolutions公司开发的自由软件。Cygwin是许多自由软件的集合&#xff0c;Cygwin的主要目的是通过重新编译&#xff0c;将POSIX系统上的软件移植到Windows上。Cygwin包括了一套库&#xff0c;该库在win32系统…

university, school, college, department, institute的区别

这些个词没有太大区别&#xff0c;有时候有些词是可以通用的&#xff0c;而有些用法则是随着地域时间的不同而变迁。一般说来&#xff0c;college译作“学院”&#xff0c;它是university &#xff08;综合性大学&#xff09;的一个组成部分&#xff0c;例如&#xff0c;一所综…

XML简介及举例

可扩展标记语言(eXtensibleMarkup Language&#xff0c;简称XML)&#xff0c;是一种标记语言。标记指计算机所能理解的信息符号&#xff0c;通过此种标记&#xff0c;计算机之间可以处理包含各种信息的文章等。如何定义这些标记&#xff0c;既可以选择国际通用的标记语言&#…

关于事务的传播特性和隔离级别的问题

REQUIRED&#xff1a;业务方法需要在一个事务中运行。如果方法运行时&#xff0c;已经处在一个事务中&#xff0c;那么加入到该事务&#xff0c;否则为自己创建一个新的事务。 NOT_SUPPORTED&#xff1a;声明方法不需要事务。如果方法没有关联到一个事务&#xff0c;容器不会为…

[Big Data - Kafka] kafka学习笔记:知识点整理

一、为什么需要消息系统 1.解耦&#xff1a; 允许你独立的扩展或修改两边的处理过程&#xff0c;只要确保它们遵守同样的接口约束。 2.冗余&#xff1a;消息队列把数据进行持久化直到它们已经被完全处理&#xff0c;通过这一方式规避了数据丢失风险。许多消息队列所采用的&q…

自然语言处理十问!独家福利

最近&#xff0c;NLP 圈简直不要太热闹&#xff01;预训练模型频频刷新榜单&#xff0c;让一众研究者、开发者“痛并快乐着”。自 2018 年 10 月&#xff0c;Google 提出 BERT 以来&#xff0c;NLP 领域预训练模型的发展仿佛坐上了火箭&#xff0c;完全控制不住。BERT 出世前&a…

BERT的成功是否依赖于虚假相关的统计线索?

作者 | 李理来源 | 个人博客导读&#xff1a;本文介绍论文Probing Neural Network Comprehension of Natural Language Arguments&#xff0c;讨论BERT在ACRT任务下的成绩是否依赖虚假的统计线索&#xff0c;同时分享一些个人对目前机器学习尤其是自然语言理解的看法。目录论文…

【电子基础】模拟电路问答

模拟电路基础知识问答整理 mystery 1、温度对半导体材料的导电性能有什么影响? 答&#xff1a;温度对半导体的导电性能有很大影响。当温度升高时&#xff0c;半导体材料内的自由电子和空穴数量迅速增加&#xff0c;半导体的导电性能将迅速提高。 2、什么是本征半导体和杂质半导…

XML解析简介及Xerces-C++简单使用举例

XML是由World WideWeb联盟(W3C)定义的元语言。它已经成为一种通用的数据交换格式&#xff0c;它的平台无关性&#xff0c;语言无关性&#xff0c;系统无关性&#xff0c;给数据集成与交互带来了极大的方便。XML在不同的语言里解析方式都是一样的&#xff0c;只不过实现的语法不…

[干货]Kaggle热门 | 用一个框架解决所有机器学习难题

新智元推荐 来源&#xff1a;LinkedIn 作者&#xff1a;Abhishek Thakur 译者&#xff1a;弗格森 【新智元导读】本文是数据科学家Abhishek Thakur发表的Kaggle热门文章。作者总结了自己参加100多场机器学习竞赛的经验&#xff0c;主要从模型框架方面阐述了机器学习过程中可能会…

gtest简介及简单使用

gtest是一个跨平台(Liunx、Mac OS X、Windows、Cygwin、Windows CE and Symbian)的C测试框架&#xff0c;有google公司发布。gtest测试框架是在不同平台上为编写C测试而生成的。从http://code.google.com/p/googletest/downloads/detail?namegtest-1.7.0.zip&can2&q下…

新浪微博推广网站的一些实践体会

本以为微博推广很难&#xff0c;每天都要刷粉刷内容的&#xff0c;也本以为做微博推广也很简单&#xff0c;一不卖产品、二不卖服务的&#xff0c;目的单纯灵活性强些&#xff0c;做了之后才发现都不是那么回事&#xff0c;微博虽然也过了“火了”&#xff0c;但新媒体还真是不…

AI和大数据如何落地智能城市?京东城市这6篇论文必读 | KDD 2019

来源 | 京东城市&#xff08;ID: icity-jd&#xff09;作为世界数据挖掘领域的最高级别的学术会议&#xff0c;ACM SIGKDD&#xff08;国际数据挖掘与知识发现大会&#xff0c;简称 KDD&#xff09;将于 2019 年 8 月 4 日—8 日在美国阿拉斯加州安克雷奇市举行。自 1995 年以来…

OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so

OSError: Could not find library geos_c or load any of its variants [libgeos_c.so.1, libgeos_c.so 解决&#xff1a; sudo vim /etc/ld.so.conf 添加&#xff1a;/opt/source/geos-3.5.0/build/lib sudo ldconfig

五分钟搭建BERT服务,实现1000+QPS​,这个Service-Streamer做到了

作者 | 刘欣简介&#xff1a;刘欣&#xff0c;Meteorix&#xff0c;毕业于华中科技大学&#xff0c;前网易游戏技术总监&#xff0c;现任香侬科技算法架构负责人。之前专注游戏引擎工具架构和自动化领域&#xff0c;2018年在GDC和GoogleIO开源Airtest自动化框架&#xff0c;广泛…

Nagios+pnp4nagios+rrdtool 安装配置为nagios添加自定义插件(三)

nagios博大精深&#xff0c;可以以shell、perl等语句为nagios写插件&#xff0c;来满足自己监控的需要。本文写mysql中tps、qps的插件&#xff0c;并把收集到的结果以图形形式展现出来&#xff0c;这样输出的结果就有一定的要求了。 编写插件tps qps check_qps 插件如下内容 #…

OpenSSL简介及在Windows、Linux、Mac系统上的编译步骤

OpenSSL介绍&#xff1a;OpenSSL是一个强大的安全套接字层密码库&#xff0c;囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议&#xff0c;并提供丰富的应用程序供测试或其它目的使用。 SSL是SecureSockets Layer(安全套接层协议)的缩写&#xff0c;可以在Interne…

Guava Cache本地缓存在 Spring Boot应用中的实践

概述 在如今高并发的互联网应用中&#xff0c;缓存的地位举足轻重&#xff0c;对提升程序性能帮助不小。而 3.x开始的 Spring也引入了对 Cache的支持&#xff0c;那对于如今发展得如火如荼的 Spring Boot来说自然也是支持缓存特性的。当然 Spring Boot默认使用的是 SimpleCache…

Windows 8.1 Preview(Windows Blue)预览版简体中文官方下载(ISO完整版镜像)

Windows 8.1是微软继Windows 8以来的又一全新力作&#xff0c;又名Windows Blue&#xff08;视窗蓝&#xff0c;专注蓝屏30年&#xff09;&#xff0c;个人觉得Win8还是比较流畅的但大众始终觉得还是有很多需要改进或者改善的&#xff0c;如今微软为了迎合大众需求对Win8进行升…

Linux下编辑器vi/vim的使用介绍

vi编辑器是所有Unix及Linux系统下标准的编辑器。对Unix及Linux系统的任何版本&#xff0c;vi编辑器是完全相同的。 基本上vi可以分为三种状态&#xff0c;分别是命令模式(commandmode)、插入模式(insert mode)和底行模式(last line mode)&#xff0c;各模式的功能为&#xff1…

Clojure程序设计

《Clojure程序设计》基本信息作者&#xff1a; (美)Stuart Halloway Aaron Bedra [作译者介绍]出版社&#xff1a;人民邮电出版社ISBN&#xff1a;9787115308474上架时间&#xff1a;2013-3-1出版日期&#xff1a;2013 年3月开本&#xff1a;16开页码&#xff1a;230版次&#…

重磅!AI Top 30+案例评选正式启动

2019 年&#xff0c;人工智能应用落地的重要性正在逐步得到验证&#xff0c;这是关乎企业生死攸关的一环。科技巨头、AI 独角兽还有起于草莽的创业公司在各领域进行着一场多方角斗。进行平台布局的科技巨头们&#xff0c;正在加快承载企业部署 AI 应用的步伐&#xff0c;曾经无…