Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android.mk vs Application.mk

I'm a little fuzzy about the use of Android.mk & Application.mk

I've tried reading APPLICATION-MK.HTML & ANDROID-MK.HTML in the documentation that comes with NDK, but still confused about the purpose of two makefiles.

I'll be really grateful to anyone who could help me understand this.

like image 313
OceanBlue Avatar asked Apr 29 '11 18:04

OceanBlue


People also ask

What is a Android.mk file?

Overview. The Android.mk file resides in a subdirectory of your project's jni/ directory, and describes your sources and shared libraries to the build system. It is really a tiny GNU makefile fragment that the build system parses once or more.

What is Ndk_project_path?

NDK_PROJECT_PATH - the location of your project NDK_APPLICATION_MK - the path of the Application.mk file APP_BUILD_SCRIPT - the path to the Android.mk file. These are needed to override the default values of the build script, which expects things to be in the jni folder.

What is the use of NDK in Android Studio?

The Native Development Kit (NDK) is a set of tools that allows you to use C and C++ code with Android, and provides platform libraries you can use to manage native activities and access physical device components, such as sensors and touch input.

What is NDK build?

The NDK allows Android application developers to include native code in their Android application packages, compiled as JNI shared libraries.


2 Answers

Each module requires one and only one Android.mk. If all you ever have is one module in your native application, the Application.mk is redundant (however there are a few things that can only be controlled by the Application.mk if you veer from default behavior). However, if you have many modules, ergo many Android.mk files in your project, than the Application.mk can be useful for providing application-wide settings that apply to ALL modules.

like image 137
rkemp Avatar answered Sep 27 '22 19:09

rkemp


Quote from docs/OVERVIEW.html

While an Android.mk file describes your modules to the build system, the Application.mk file describes your application itself. See the docs/APPLICATION-MK.html document to understand what this file allows you to do. This includes, among others:

  • The exact list of modules required by your application.

  • The CPU architecture(s) to generate machine code for.

  • Optional information, like whether you want a release or debug build, specific C or C++ compiler flags and others that should apply to all modules being built.

This file is optional: by default the NDK will provide one that simply builds all the modules listed from your Android.mk (and all the makefiles it includes) and target the default CPU ABI (armeabi).

hope it helps

like image 21
Jan Avatar answered Sep 27 '22 19:09

Jan