Difference between LOCAL_EXPORT_C_INCLUDES and LOCAL_C_INCLUDES

Someone please explain what is the difference between LOCAL_EXPORT_C_INCLUDES and LOCAL_C_INCLUDES in android mk file .

+6
android android-ndk
source share
1 answer

If a module adds paths to LOCAL_EXPORT_C_INCLUDES , these paths will be added to the LOCAL_C_INCLUDES definition of another module that uses this code with LOCAL_STATIC_LIBRARIES or LOCAL_SHARED_LIBRARIES .

Consider that we have 2 modules, for example. foo and bar, and the next is a 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 foo.h, the foo module must add the include path to LOCAL_EXPORT_C_INCLUDES . If the bar is not used by any module, it can add the 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 see the example provided in the android-ndk sample directory: android-ndk-r9d/samples/module-exports

+10
source share

All Articles