"Go" application.mk file Syntax specification

Source: Internet
Author: User

Original URL: http://blog.sina.com.cn/s/blog_4c451e0e0100s6q4.html

application.mk file Syntax specificationapplication.mk files Syntax specification  introduction: Introduction:------------- this Document Describes the syntax of application.mk build Fileswritten to describe the native modules required by your Androidapplicati On. To understand what follows, it's assumed that haveread the docs/overview.html file that explains their role andusage. This document describes the syntax of the APPLICATION.MK makefile and describes the native modules according to your Android application requirements. To understand the following, suppose you have read docs/overview.html files and understand their usefulness and usage.  readers of this document should has read docs/overview.html anddocs/android-mk.html readers of this documentation will have been reading docs/overview.html and Docs/android-mk.html overview: Overview:--------- the Purpose of APPLICATION.MK is to describe which native ' Modules ' (i.e static/shared libraries) is needed by yourapplication. The purpose of the Application.mk file is to describe the native module (i.e., a static or shared library) that is required by your application.  an application.mk file is usually placed under $PROJECT/jni/application.mk,where $PROJECT points to your application ' s project directory. A application.mk file is usually placed in a $PRoject/jni/application.mk this path below, $PROJECT means the project directory of your application.  another alternative is to places it under a sub-directory of the Top-level$ndk/apps directory, e.g.: Another place that can be placed is in $NDK/ Subdirectories of the apps directory, such as:     $NDK/apps/<myapp>/application.mk where <myapp> is a short Name used to describe your ' application ' to the NDK build system (this name doesn ' t go into your generatedshared libraries or your final packages) .<myapp> is a short name used to describe your application for the NDK generation system (this name will not go into your shared library or your final package).  the Application.mk is really a tiny GNU Makefile fragment that mustdefine a few variables:Application.mk actually is a tiny G NU Makefile fragment, must define several variables:  app_project_path    this variable should give the *absolute* PATH to Your    application ' s project root directory. This was used to copy/install    stripped versions of the generated JNI GKFX libraries to A &nbs P;  specific location known to the Apk-generating Tools.     This variable will provide the absolute path to your application engineering root directory.      This is used to copy or install a disconnected version of the JNI shared library to a specific location known to the APK generation tool.      note that it's optional for $PROJECT/jni/application.mk, but    * mandatory* for $NDK/apps/<myapp>/application.mk     Note that for $PROJECT/jni/application.mk It is optional,     but is mandatory for $NDK/apps/<myapp>/application.mk.  app_modules    this variable is optional. If not defined, the NDK would build By    default _all_ the modules declared by your android.mk, and an Y    sub-makefile It may include.     this variable is optional.      if not defined, the NDK will generate all modules declared by your android.mk file by default _all_,     and can contain any child Makefile file.      if app_modules is defined, it must be a space-separated list of MODULE&NBSP;&NBSP;&NBSP;&NB Sp;names as they appear in the Local_module definitions ofAndroid.mk    files. Note that the NDK would compute module dependencies automatically.     If app_modules is defined,  & nbsp;   it must be a space-delimited list of module names, just as they appear in the local_module definition of the Android.mk file.      note:this variable ' s behaviour changed in NDK R4. Before that:     Note: The behavior of this variable has changed in the NDK R4. Previously:        -the variable was mandatory in your application.mk       -This variable is mandatory in your application.mk file.       -all required modules had to be listed explicitly.     & nbsp;-all required modules are explicitly listed.  app_optim    this optional variable can be defined to either ' release ' or   & nbsp; ' Debug '. This was used to alter the optimization level when    building your application ' s modules.      This optional variable can define a release or debug version.      this is used in generatingThe module of your application changes the level of optimization.      a ' release ' mode is the default, and would generate highly     Optimized binaries. The ' debug ' mode would generate un-optimized    binaries which is much easier to DEBUG.&NBSP;&NBSP;&N The bsp;  release mode is the default and will produce a highly optimized binary code.      debug mode will produce binary code that is not optimized, making debugging easier.      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 would b E ' Debug ' instead of ' release '. This can    be overridden by setting App_optim to ' release ' .     Note If your application is debug      (i.e.: If your manifest set the Android:debuggable property to True in its <application> tab), The      Scheduler mode will be the default mode for replacing the release version.      This can be ignored by setting App_optim to release.      note that itWas possible to debug both ' Release ' and ' Debug '     binaries, but the ' release ' builds tend to provide Less information    during debugging Sessions:some variables is optimized out and     can ' t is inspected, code re-ordering can make stepping through    the code difficult, STA CK traces May is reliable, etc ...      Note that both the release mode and the debug version mode are adjustable, but the release mode provides less information during the debug job:     some variables are optimized and cannot be inspected. Code reordering makes it difficult to debug, stack traces are unreliable, and so on.  app_cflags    a set of C compiler flags passed when compiling any C or C + + source Code &nbs P;  of any of the modules. This can is used to change the build of a given    module depending on the application that needs it, Instead of modifying    the android.mk file itself.     A set of C compiler flags in compiling any module of any C or C + + source code is passed.      This can be an application that changes the generation of a particular module, depending on the situation.       important warning:      Important warning:     +++++++++ ++++++++++++++++++++++++++++++++++++++++++    +    + all paths in these Flags should is relative to the top-level ndk    + directory. For example, if you have the following setup:    + the full path in these flags will be relative to the top-level NDK directory. For example, if you have the following structure:      +    +    sources/foo/android.mk     +    sources/bar/Android.mk    +     +  to Specify in foo/android.mk so you want to add the path to the    + ' bar ' sources dur ing compilation, you should use:    + specify in the Foo/android.mk file that you want to add the bar source file path at compile time, you will use the:     +    +   app_cflags + =-isources/bar    +     + Or Alternatively:     + or:     +    +   APP_ CFLAGS + =-i$ (Local_path)/. /bar    +    + Using '-I.. /bar ' would *not* work since it'll be equivalent to    + '-i$ndk_root/. /bar ' instead.    + uses-i. /bar will be ineffective, as it will be equivalent to-i$ndk_root/. /bar.     +    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++     note:in Android-ndk-1.5_r1, this is only applied to C sources, not C + + ones. & Nbsp;        this have been corrected to match the full Android build system.& nbsp;    Note: In Android-ndk-1.5_r1, this applies only to C source files, not to C + + compilation flags one.      This has been corrected to completely match the Android build system.  app_cxxflags    an alias for App_cppflags, to is considered obsolete as it may disappear & Nbsp;  in AFuture release of the ndk.     a app_cppflags alias, which may disappear in the upcoming NDK release, taking into account outdated reasons.  app_cppflags    a set of C + + compiler flags passed when building C + + sources *only*. &nbsp ;   a set of C + + compiler flags is passed only when a C + + source file is generated.      note:in ANDROID-NDK-1.5_R1, this applied to both C and C + + sources.   & Nbsp;      this have been corrected to match the full Android build system.  & Nbsp;       you can now use app_cflags for flags, shall apply to C and  & nbsp;       c++ sources.     Note: In Android-ndk-1.5_r1, this applies To Source files for both C and C + +.      This has been corrected to completely match the Android build system.      You can now use the app_cflags variable, which will apply to C and C + + source files.  app_build_script    by default, the NDK BUILD system would look for a file named android.mk    &Nbsp;under $ (app_project_path)/jni, i.e. for the file:     by default, the NDK build system will look for a file named Android.mk in $ ( App_project_path)/jni directory,     that is, so 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 would always    be interpreted as relative to the NDK ' s top-level directory. & nbsp;   If you want to override this behavior, you can define app_build_script to indicate a build script for substitution.      a non-absolute path will always be interpreted as relative to the NDK top-level directory.  app_abi    by default, the NDK build system would generate machine code for THE&NBSP;&NBSP;&NBSP ;  ' Armeabi ' ABI. This corresponds to a armv5te based CPU with software    floating point operations. can use App_abi to select a different    abi.     By default, the NDK generation system will produce a machine code for Armeabi ABI.      this conforms to a armv5te-based CPU-corresponding software floating-point operation.      you can use App_abi to choose a different ABI.      for example, to-support hardware FPU instructions on ARMV7 based devices,     use:     For example, for a support hardware FPU directive on a ARMV7-based device, use the:          app_abi: = Armeabi-v7a     or to support both ARMv5TE and ARMV7 based devices , use:     or for devices that are supported based on ARMV5TE and ARMv7, use:          app_abi: = Armeabi armeabi-v7a     for The list of all supported ABIs and details about the IR usage and    limitations, please read docs/cpu-arch-abis.html     for all supported ABI list and detailed description about their usage and limitations, read the "docs/cpu-arch-abis.html 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   & nbsp;system.     by default, the NDK build system provides header files 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:     However, the NDK provides any C + + implementation of your choice that you can use or link into your application.      define APP_STL to select one of them. Example:         app_stl: = stlport_static    --> static STLport Library       app_stl: = stlport_shared    --> gkfx STLport Library       app_stl: = System             --> default C + + runtime library     for more information on the subject, please read docs/cplusplus-support.html     for more information on this topic, Please read docs/cplusplus-support.html a trivial application.mk file would be: a normal application.mk files will be: ---------- ----Cut here-------------------------app_project_path: = <path to project>--------------cut here-------------- -----------

Go to application.mk file Syntax specification

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.