关闭

Android NDK Makefile structure

标签: makefilestructureandroidpathbuildvariables
1222人阅读 评论(0) 收藏 举报
分类:
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)


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:36943次
    • 积分:681
    • 等级:
    • 排名:千里之外
    • 原创:29篇
    • 转载:24篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档