在Android编译框架中,把许多固定的、反复用到的目录路径定义为 宏变量,常用 宏 如下:

out/target/product/xxx的宏即为:PRODUCT_OUT

out/target/product/xxx/system的宏即为:TARGET_OUT

out/target/product/xxx/root的宏即为:TARGET_ROOT_OUT,

device/test05/BoardConfig.mk 红色部分即为:TARGET_PRODUCT
宏,一般 TARGET_PRODUCT、 PRODUCT_DEVICE、TARGET_DEVICE,指的是同一个值。

  大多数的宏变量 定义位置:build/core/envsetup.mk

+++++++++++++++++++++++++++++++++++++++++++++++++++

# Variables we check:

#     HOST_BUILD_TYPE = { release debug }

#     TARGET_BUILD_TYPE = { release debug }

# and we output a bunch of variables, see the case statement at

# the bottom for the full list

#     OUT_DIR is also set to "out" if it's not already set.

#         this allows you to set it to somewhere else if you like



# Set up version information.

include $(BUILD_SYSTEM)/version_defaults.mk



# ---------------------------------------------------------------

# If you update the build system such that the environment setup

# or buildspec.mk need to be updated, increment this number, and

# people who haven't re-run those will have to do so before they

# can build.  Make sure to also update the corresponding value in

# buildspec.mk.default and envsetup.sh.

CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 10



# ---------------------------------------------------------------

# The product defaults to generic on hardware

# NOTE: This will be overridden in product_config.mk if make

# was invoked with a PRODUCT-xxx-yyy goal.

ifeq ($(TARGET_PRODUCT),)

TARGET_PRODUCT := full

endif





# the variant -- the set of files that are included for a build

ifeq ($(strip $(TARGET_BUILD_VARIANT)),)

TARGET_BUILD_VARIANT := eng

endif



# ---------------------------------------------------------------

# Set up configuration for host machine.  We don't do cross-

# compiles except for arm, so the HOST is whatever we are

# running on



UNAME := $(shell uname -sm)



# HOST_OS

ifneq (,$(findstring Linux,$(UNAME)))

    HOST_OS := linux

endif

ifneq (,$(findstring Darwin,$(UNAME)))

    HOST_OS := darwin

endif

ifneq (,$(findstring Macintosh,$(UNAME)))

    HOST_OS := darwin

endif

ifneq (,$(findstring CYGWIN,$(UNAME)))

    HOST_OS := windows

endif



# BUILD_OS is the real host doing the build.

BUILD_OS := $(HOST_OS)



# Under Linux, if USE_MINGW is set, we change HOST_OS to Windows to build the

# Windows SDK. Only a subset of tools and SDK will manage to build properly.

ifeq ($(HOST_OS),linux)

ifneq ($(USE_MINGW),)

    HOST_OS := windows

endif

endif



ifeq ($(HOST_OS),)

$(error Unable to determine HOST_OS from uname -sm: $(UNAME)!)

endif





# HOST_ARCH

ifneq (,$(findstring 86,$(UNAME)))

    HOST_ARCH := x86

endif



ifneq (,$(findstring Power,$(UNAME)))

    HOST_ARCH := ppc

endif



BUILD_ARCH := $(HOST_ARCH)



ifeq ($(HOST_ARCH),)

$(error Unable to determine HOST_ARCH from uname -sm: $(UNAME)!)

endif



# the host build defaults to release, and it must be release or debug

ifeq ($(HOST_BUILD_TYPE),)

HOST_BUILD_TYPE := release

endif



ifneq ($(HOST_BUILD_TYPE),release)

ifneq ($(HOST_BUILD_TYPE),debug)

$(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE)')

endif

endif



# This is the standard way to name a directory containing prebuilt host

# objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc

ifeq ($(HOST_OS),windows)

  HOST_PREBUILT_TAG := windows

else

  HOST_PREBUILT_TAG := $(HOST_OS)-$(HOST_ARCH)

endif



# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT.

# Define them here so they can be used in product config files.

TARGET_COPY_OUT_SYSTEM := system

TARGET_COPY_OUT_DATA := data

TARGET_COPY_OUT_VENDOR := system/vendor

TARGET_COPY_OUT_ROOT := root

TARGET_COPY_OUT_RECOVERY := recovery




# Read the product specs so we an get TARGET_DEVICE and other

# variables that we need in order to locate the output files.

include $(BUILD_SYSTEM)/product_config.mk



build_variant := $(filter-out eng user userdebug tests,$(TARGET_BUILD_VARIANT))

ifneq ($(build_variant)-$(words $(TARGET_BUILD_VARIANT)),-1)

$(warning bad TARGET_BUILD_VARIANT: $(TARGET_BUILD_VARIANT))

$(error must be empty or one of: eng user userdebug tests)

endif



# ---------------------------------------------------------------

# Set up configuration for target machine.

# The following must be set:

#         TARGET_OS = { linux }

#         TARGET_ARCH = { arm | x86 }





ifeq ($(TARGET_ARCH),)

TARGET_ARCH := arm

endif

TARGET_OS := linux



# the target build type defaults to release

ifneq ($(TARGET_BUILD_TYPE),debug)

TARGET_BUILD_TYPE := release

endif




# ---------------------------------------------------------------

# figure out the output directories



ifeq (,$(strip $(OUT_DIR)))

ifeq (,$(strip $(OUT_DIR_COMMON_BASE)))

OUT_DIR := $(TOPDIR)out  #指定 OUT_DIR 为 out/

else

OUT_DIR := $(OUT_DIR_COMMON_BASE)/$(notdir $(PWD))

endif

endif



DEBUG_OUT_DIR := $(OUT_DIR)/debug



# Move the host or target under the debug/ directory

# if necessary.

TARGET_OUT_ROOT_release := $(OUT_DIR)/target

TARGET_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/target

TARGET_OUT_ROOT := $(TARGET_OUT_ROOT_$(TARGET_BUILD_TYPE)) #TARGET_BUILD_TYPE这个变量 一般 lunch的时候 指定



HOST_OUT_ROOT_release := $(OUT_DIR)/host

HOST_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/host

HOST_OUT_ROOT := $(HOST_OUT_ROOT_$(HOST_BUILD_TYPE))



HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_ARCH)

HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_ARCH)

HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE))



BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(BUILD_ARCH)



TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product




TARGET_COMMON_OUT_ROOT := $(TARGET_OUT_ROOT)/common

HOST_COMMON_OUT_ROOT := $(HOST_OUT_ROOT)/common



PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE)  #TARGET_DEVICE 在 product_config.mk 里定义,最终 由 PRODUCT_DEVICE决定,而这个 变量是在 具体 lunch 的时候 指定;



OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs



BUILD_OUT_EXECUTABLES:= $(BUILD_OUT)/bin



HOST_OUT_EXECUTABLES:= $(HOST_OUT)/bin

HOST_OUT_SHARED_LIBRARIES:= $(HOST_OUT)/lib

HOST_OUT_JAVA_LIBRARIES:= $(HOST_OUT)/framework

HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon



HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj

HOST_OUT_HEADERS:= $(HOST_OUT_INTERMEDIATES)/include

HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib

HOST_OUT_STATIC_LIBRARIES := $(HOST_OUT_INTERMEDIATE_LIBRARIES)

HOST_OUT_NOTICE_FILES:=$(HOST_OUT_INTERMEDIATES)/NOTICE_FILES

HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj



TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj


TARGET_OUT_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/include

TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib

TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj



TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)

TARGET_OUT_EXECUTABLES:= $(TARGET_OUT)/bin

TARGET_OUT_OPTIONAL_EXECUTABLES:= $(TARGET_OUT)/xbin

TARGET_OUT_SHARED_LIBRARIES:= $(TARGET_OUT)/lib

TARGET_OUT_JAVA_LIBRARIES:= $(TARGET_OUT)/framework


TARGET_OUT_APPS:= $(TARGET_OUT)/app

TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout

TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars

TARGET_OUT_ETC := $(TARGET_OUT)/etc

TARGET_OUT_STATIC_LIBRARIES:= $(TARGET_OUT_INTERMEDIATES)/lib

TARGET_OUT_NOTICE_FILES:=$(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES

TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages



TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)

TARGET_OUT_DATA_EXECUTABLES:= $(TARGET_OUT_EXECUTABLES)

TARGET_OUT_DATA_SHARED_LIBRARIES:= $(TARGET_OUT_SHARED_LIBRARIES)

TARGET_OUT_DATA_JAVA_LIBRARIES:= $(TARGET_OUT_JAVA_LIBRARIES)


TARGET_OUT_DATA_APPS:= $(TARGET_OUT_DATA)/app

TARGET_OUT_DATA_KEYLAYOUT := $(TARGET_OUT_KEYLAYOUT)

TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS)

TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC)

TARGET_OUT_DATA_STATIC_LIBRARIES:= $(TARGET_OUT_STATIC_LIBRARIES)

TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest



TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache



TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)

TARGET_OUT_VENDOR_EXECUTABLES:= $(TARGET_OUT_VENDOR)/bin

TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES:= $(TARGET_OUT_VENDOR)/xbin

TARGET_OUT_VENDOR_SHARED_LIBRARIES:= $(TARGET_OUT_VENDOR)/lib

TARGET_OUT_VENDOR_JAVA_LIBRARIES:= $(TARGET_OUT_VENDOR)/framework

TARGET_OUT_VENDOR_APPS:= $(TARGET_OUT_VENDOR)/app

TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc



TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols

TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin

TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/lib

TARGET_ROOT_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)

TARGET_ROOT_OUT_SBIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/sbin

TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin



TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT)


TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin

TARGET_ROOT_OUT_SBIN := $(TARGET_ROOT_OUT)/sbin

TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc

TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr



TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RECOVERY)


TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root



TARGET_SYSLOADER_OUT := $(PRODUCT_OUT)/sysloader

TARGET_SYSLOADER_ROOT_OUT := $(TARGET_SYSLOADER_OUT)/root

TARGET_SYSLOADER_SYSTEM_OUT := $(TARGET_SYSLOADER_OUT)/root/system



TARGET_INSTALLER_OUT := $(PRODUCT_OUT)/installer

TARGET_INSTALLER_DATA_OUT := $(TARGET_INSTALLER_OUT)/data

TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root

TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system



TARGET_FACTORY_RAMDISK_OUT := $(PRODUCT_OUT)/factory_ramdisk



COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARIES



ifeq (,$(strip $(DIST_DIR)))

  DIST_DIR := $(OUT_DIR)/dist

endif



ifeq ($(PRINT_BUILD_CONFIG),)

PRINT_BUILD_CONFIG := true

endif

++++++++++++++++++++++++++++++++++++++

android的 makefile里 的常用 宏定义的更多相关文章

  1. Makefile,如何传递宏定义DEBUG【转】

    转自:http://blog.csdn.net/linuxheik/article/details/8051598 版权声明:本文为博主原创文章,未经博主允许不得转载. Makefile,如何传递宏定 ...

  2. iOS - 常用宏定义和PCH文件知识点整理

    (一)PCH文件操作步骤演示: 第一步:图文所示: 第二步:图文所示: (二)常用宏定义整理: (1)常用Log日志宏(输出日志详细可定位某个类.某个函数.某一行) //=============== ...

  3. iOS常用宏定义大全

    宏定义与常量的区别 宏:只是在预处理器里进行文本替换,不做任何类型检查,宏能定义代码,const不能,多个宏编译时间相对较长,影响开发效率,调试过慢,const只会编译一次,缩短编译时间. 所以在使用 ...

  4. iOS之常用宏定义

    下面我为大家提供一些常用的宏定义! 将这些宏定义 加入到.pch使用 再也不用 用一次写一次这么长的程序了 //-------------------获取设备大小------------------- ...

  5. iOS 日常工作之常用宏定义大全

    转自:http://www.jianshu.com/p/213b3b96cafe 前言: 在工作中, 很多小伙伴都会在PCH文件定义一些常用的宏,但是又怕写这些简单的宏浪费时间,又有时候忘记怎么定义了 ...

  6. Makefile中的特殊宏定义以及实用选项

    Makefile中的一些特殊宏定义的名字跟shell中的位置变量挺相似的. $?    当前目标所依赖的文件列表中比当前目标文件还要新的文件 $@   当前目标我名字 $<   当前依赖文件的名 ...

  7. iOS常用宏 定义

    总结了iOS开发过程中的一些常用宏,以后会陆陆续续添加进来. 字符串是否为空 1   #define kStringIsEmpty(str) ([str isKindOfClass:[NSNull c ...

  8. 20个C语言中常用宏定义总结

    01: 防止一个头文件被重复包含 #ifndef COMDEF_H#define COMDEF_H//头文件内容#endif 02: 重新定义一些类型防止由于各种平台和编译器的不同,而产生的类型字节数 ...

  9. iOS日常工作之常用宏定义大全

    前言: 在工作中, 很多小伙伴都会在PCH文件定义一些常用的宏,但是又怕写这些简单的宏浪费时间,又有时候忘记怎么定义了怎么办?本人在工作中也是如此.所以在这里给大家分享一些常用的宏定义,喜欢的小伙伴可 ...

随机推荐

  1. Nodejs开发框架Express3.0开发手记–从零开始

    转载请注明出处: http://blog.fens.me/nodejs-express3/ 程序代码已经上传到github有需要的同学,自行下载. https://github.com/bsspiri ...

  2. (03)odoo模型/记录集/公用操作

    -----------------更新时间11:17 2016-09-18 星期日11:00 2016-03-13 星期日09:10 2016-03-03 星期四11:46 2016-02-25 星期 ...

  3. python中cPickle的用法

    import cPickle as p f = file('data.txt' , 'w') data = (1 , 'A' , "hello") p.dump(data , f) ...

  4. Remove Duplicates from Sorted Array [LeetCode]

    Given a sorted array, remove the duplicates in place such that each element appear only once and ret ...

  5. 接口(C# 参考)

    接口只包含方法.属性.事件或索引器的签名. 实现接口的类或结构必须实现接口定义中指定的接口成员. 在下面的示例,类 ImplementationClass必须实现一个不具有参数并返回 void 的名为 ...

  6. 串口调试,提示the given port name does not start with COM/com异常解决办法,,发现是打印机在搞怪

    串口测试时,用到串口,把打印机的拔下来,换上测试的,程序一打开就提示错误:the given port name does not start with COM/com or does not res ...

  7. UML类图关系大全

    UML类图关系大全 1.关联 双向关联: C1-C2:指双方都知道对方的存在,都可以调用对方的公共属性和方法.在GOF的设计模式书上是这样描述的:虽然在分析阶段这种关系是适用的,但我们觉得它对于描述设 ...

  8. http请求详解

    GET GET方法意思是获取被请求URI(Request-URI)指定的信息(以实体的格式).如果请求URI涉及到一个数据生成过程,那么这个过程生成的数据应该被作为实体在响应中返回而不是过程的源文本, ...

  9. vim 代码

    vim函数跳转                     时间:2014-05-07 14:02:12                         阅读:40                     ...

  10. [转]无IDE时编译和运行Java

    本文由 ImportNew - Grey 翻译自 dzone.欢迎加入Java小组.转载请参见文章末尾的要求. 最近 Java subreddit 出现了一篇”在没有IDE的情况下编译Java包” 的 ...