LOCAL_EXPORT_C_INCLUDES和LOCAL_C_INCLUDES的区别 [英] Difference between LOCAL_EXPORT_C_INCLUDES and LOCAL_C_INCLUDES
问题描述
有人请解释什么是android的 MK文件
。 LOCAL_EXPORT_C_INCLUDES
和 LOCAL_C_INCLUDES
之间的区别
Anybody please explain what is the difference between LOCAL_EXPORT_C_INCLUDES
and LOCAL_C_INCLUDES
in android mk file
.
推荐答案
如果一个模块的路径添加到 LOCAL_EXPORT_C_INCLUDES
,这些路径将被添加到 LOCAL_C_INCLUDES
其它模块的定义,它使用与此一 LOCAL_STATIC_LIBRARIES
或 LOCAL_SHARED_LIBRARIES
。
If a module adds the paths to LOCAL_EXPORT_C_INCLUDES
, these paths will be added to LOCAL_C_INCLUDES
definition of another module which uses this one with LOCAL_STATIC_LIBRARIES
or LOCAL_SHARED_LIBRARIES
.
考虑我们有2个模块,例如foo和酒吧,以下是树形结构。
Consider we have 2 modules, e.g. foo and bar and following is tree structure.
.
|-- Android.mk
|-- bar
| |-- bar.c
| |-- bar.h
|-- foo
|-- foo.c
`-- foo.h
栏使用美孚作为静态库。由于bar.c将需要包括foo.h中,富模块添加包含路径 LOCAL_EXPORT_C_INCLUDES
。如果巴不使用任何模块,那么它可以增加包括路径 LOCAL_C_INCLUDES
。
bar uses foo as a static library. Since bar.c will need to include the foo.h, foo module has to add include path to LOCAL_EXPORT_C_INCLUDES
. If bar is not used by any module, then it can add include path to LOCAL_C_INCLUDES
.
Android.mk会是这样的:
Android.mk will look like this:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_SRC_FILES := foo/foo.c
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := bar
LOCAL_SRC_FILES := bar/bar.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/bar
LOCAL_STATIC_LIBRARIES := foo
include $(BUILD_SHARED_LIBRARY)
请看看在Android的NDK样本目录中提供了一个例子: Android的NDK-r9d /样本/模块出口
Please have a look at an example provided in android-ndk sample directory : android-ndk-r9d/samples/module-exports
这篇关于LOCAL_EXPORT_C_INCLUDES和LOCAL_C_INCLUDES的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!