Anybody please explain what is the difference between LOCAL_EXPORT_C_INCLUDES
and LOCAL_C_INCLUDES
in android mk file
.
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
.
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 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 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)
Please have a look at an example provided in android-ndk sample directory : android-ndk-r9d/samples/module-exports