Android NDK Makefile structure

原创 2012年03月26日 16:41:03
GNUmakefile : ?? Called by prebuilt/linux-x86/bin/make. Not used by ARM toolchain?
add-application.mk
add-platform.mk
add-toolchain.mk
build-all.mk : Entry for build-xxx.mk (xxx: binary, executable, local, module, shared-library, static-library)
build-binary.mk : Script for building binary.
build-executable.mk : Script for building executable
build-local.mk : Entry of build system. Called by ndk-build shell script.
build-module.mk : Script for building module. Used by build-xxxx-library.mk & prebuild-xxxx-library.mk
build-shared-library.mk : Variables for building shared libraries.
build-static-library.mk : Variables for building static libraries.
check-cygwin-make.mk : For Cywin environment
clear-vars.mk : Set a list of variables (LOCAL_XXXX) to empty, clear its.
default-application.mk : Predefines APP_BUILD_SCRIPT && APP_PROJECT_PATH.
default-build-commands.mk : Predefines a list of commands (cmd-build-shared-library, TARGET_CC, TARGET_AR, TARGET_LD ...).
definitions.mk : Defines a list of functions.
import-locals.mk : Predefines LOCAL_XXXX variables.
init.mk
main.mk : ?? Called by prebuilt/linux-x86/bin/make. Not used by ARM toolchain?
ndk-common.sh
prebuilt-library.mk : Called by Application.mk
prebuilt-shared-library.mk : Called by prebuilt-library.mk, when building shared libraries
prebuilt-static-library.mk : Called by prebuilt-library.mk, when building shared libraries
setup-abi.mk : Defines TARGET_XXX (XXX: ARCH, OBJ, PLATFORM, GDB_SETUP) variables.
setup-app.mk : Defines NDK_APP_XXX variables.
setup-imports.mk : Setup variables in setup-xxx.mk files.

setup-toolchain.mk : Defines TOOLCHAIN_XXX variables.


- LOCAL_XXX


- HOST_XXX
  . HOST_ARCH = {X86 | ARM | PPC}
  . HOST_OS = {windows | linux | darwin}
  
- TARGET_XXX


- NDK_XXX
  > NDK_XXX
    . NDK_PROJECT_PATH   := .
    . NDK_APPLICATION_MK := 1> $(NDK_PROJECT_PATH)/jni/Application.mk
   2> $(NDK_ROOT)/build/core/default-application.mk


  > NDK_APP_XXX
    . NDK_APP_OUT := $(NDK_PROJECT_PATH)/obj
    . NDK_APP_NAME := $(_app) ;{local}
    . NDK_APP_ABI := $(APP_ABI)
    . NDK_APP_DST_DIR := $(NDK_APP_PROJECT_PATH)/libs/$(TARGET_ARCH_ABI)
    . NDK_APP_GDBSERVER := $(NDK_APP_DST_DIR)/gdbserver
    . NDK_APP_GDBSETUP := $(NDK_APP_DST_DIR)/gdb.setup


- APP_XXX
  . APP_MANIFEST := $(APP_PROJECT_PATH)/AndroidManifest.xml)
  . APP_PLATFORM := android-5 (Defined in Application.mk)
  . APP_ABI := armeabi armeabi-v7a (Defined in Application.mk)
  . APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/jni/Android.mk
  . APP_MODULES :=
  . APP_PROJECT_PATH := $(NDK_PROJECT_PATH)
  . APP_STL := system


- TOOLCHAIN_XXX


- BUILD_XXX




- $NDK/ndk-build
  Entry file of building system. Find an executable "GNUMAKE" command (/usr/bin/make in Ubuntu linux) and jump to build-local.mk.
  
  > GNUMAKE=`which make 2> /dev/null`
  > $GNUMAKE -f $PROGDIR/build/core/build-local.mk "$@"


- $NDK/build/core/build-local.mk


NDK_ROOT = ?


include $(NDK_ROOT)/build/core/init.mk
  host-dir-parent  = $(patsubst %/,%,$(dir $1))
  find-project-dir = $(strip $(call find-project-dir-inner,$(abspath $1),$2))
  find-project-dir-inner = ?
  find-project-dir-inner-2 = ?
  NDK_PROJECT_PATH := 1> .
2> $(call find-project-dir,.,jni/Android.mk)
3> $(call find-project-dir,.,AndroidManifest.xml)
4> predefined $NDK_PROJECT_PATH


  NDK_APPLICATION_MK := 1> $(strip $(wildcard $(NDK_PROJECT_PATH)/jni/Application.mk))
                        2> $(NDK_ROOT)/build/core/default-application.mk


  NDK_APP_OUT := $(NDK_PROJECT_PATH)/obj


   _app            := local
   _application_mk := $(NDK_APPLICATION_MK)
   NDK_APPS        := $(_app)


include $(BUILD_SYSTEM)/add-application.mk
  DUMP_VAR     := $(patsubst DUMP_%,%,$(filter DUMP_%,$(MAKECMDGOALS)))
  MAKECMDGOALS := $(filter-out DUMP_$(DUMP_VAR),$(MAKECMDGOALS))


$(DUMP_VAR)=="" --> 1
1> include $(BUILD_SYSTEM)/setup-imports.mk
2> include $(BUILD_SYSTEM)/build-all.mk




- $NDK/build/core/init.mk
BUILD_SYSTEM := $(NDK_ROOT)/build/core
include $(BUILD_SYSTEM)/definitions.mk


ADD_TOOLCHAIN := $(BUILD_SYSTEM)/add-toolchain.mk
TOOLCHAIN_CONFIGS := $(wildcard $(NDK_ROOT)/toolchains/*/config.mk)
$(foreach _config_mk,$(TOOLCHAIN_CONFIGS),\
  $(eval include $(BUILD_SYSTEM)/add-toolchain.mk)\
)
NDK_ALL_TOOLCHAINS   := $(sort $(NDK_ALL_TOOLCHAINS))
NDK_ALL_ABIS         := $(sort $(NDK_ALL_ABIS))
NDK_ALL_ARCHS        := $(sort $(NDK_ALL_ARCHS))
NDK_TOOLCHAIN := $(strip $(NDK_TOOLCHAIN))


NDK_PLATFORMS_ROOT := $(strip $(NDK_PLATFORMS_ROOT))
$(foreach _platform,$(NDK_ALL_PLATFORMS),\
  $(eval include $(BUILD_SYSTEM)/add-platform.mk)\
)


NDK_ALL_PLATFORM_LEVELS := $(filter android-%,$(NDK_ALL_PLATFORMS))
NDK_ALL_PLATFORM_LEVELS := $(patsubst android-%,%,$(NDK_ALL_PLATFORM_LEVELS))
$(call ndk_log,Found stable platform levels: $(NDK_ALL_PLATFORM_LEVELS))


- $NDK/build/core/add-application.mk
APP_MODULES := $(call strip-lib-prefix,$(APP_MODULES))
APP_PROJECT_PATH := 1> $(strip $(APP_PROJECT_PATH))
   2> $(NDK_PROJECT_PATH)
APP_BUILD_SCRIPT := $(strip $(APP_BUILD_SCRIPT))




- $NDK/build/core/default-application.mk
  APP_PROJECT_PATH := $(NDK_PROJECT_PATH)
  APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/jni/Android.mk






- User application makefile
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-8


OCAL_PATH := $(call my-dir)


include $(CLEAR_VARS)


LOCAL_MODULE    := plasma
LOCAL_SRC_FILES := plasma.c
LOCAL_LDLIBS    := -lm -llog -ljnigraphics


include $(BUILD_SHARED_LIBRARY)


今天终于将第一个 Android NDK 程序编译、运行成功

今天终于将第一个 NDK 程序编译、运行成功。起先看资料和书籍时,都要求安装 CygWin。我也安装了,并将 Sample: hello-jni 编译成功。编译的 LOG 如下: LeoZheng@L...

如何使用自己的makefile编译android ndk项目

android ndk提供了一套自己的makefile管理方式,要将源码项目移植到android平台,需要按照android的makefile规则编写makefile,还要按android的规则部署源...
  • luansxx
  • luansxx
  • 2012年08月01日 17:20
  • 3243

手动写Makefile编译Android NDK的so

之所以摒弃NDK,是因为NDK编译出来的so太大,而且导出表总有一些没用的fu

protobuf android ndk makefile

直接把BUILD的内容拿来重新组织一下而已Application.mkAPP_ABI := armeabi-v7a #(32_bit(armeabi armeabi-v7a x86 ...

Android NDK Makefile

参考   Android NDK中的docs/ANDROID-MK.html 1. 概要 此文档主要是用来描述Android.mk文件的语法,以及使用Android.mk文件来构建C/C++源文...

[Android Makefile] Android NDK Document

Android.mk file syntax specification Introduction: ------------- This document describes the synta...

google android ndk demo

  • 2017年11月30日 10:02
  • 71.4MB
  • 下载

Android NDK *** could not be resolved

  • 2014年12月04日 18:02
  • 2.42MB
  • 下载

Android NDK开发之从环境搭建到Demo级十步流

说到NDK,相信大家都不陌生,它是Google为便于Android开发提供的一种原生开发集:Native Development Kit,而且也是一个包含API、构建工具、交叉编译、调试器、文档示例等...
  • guiman
  • guiman
  • 2017年04月26日 16:16
  • 13863

ANDROID NDK

  • 2014年12月08日 14:14
  • 507KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Android NDK Makefile structure
举报原因:
原因补充:

(最多只允许输入30个字)