在同一个Android.mk中编译多个共享库

时间:2012-07-05 07:11:14

标签: android makefile android-ndk

我正在尝试在同一个mk文件中编译2个共享库。第二个取决于第一个。 我无法成功链接两者,第二个lib无法看到第一个.h。

我可以把它们放在LOCAL_C_INCLUDES中,但是我想在它运行之后拆分Android.mk,我不能像这样做硬引用。我发现LOCAL_EXPORT_C_INCUDES似乎完全符合我的要求......除了它不起作用。

这是我的代码

----------------------------------------------- ------------------------------

第一个图书馆

include $(CLEAR_VARS)
LOCAL_MODULE := libFirst
LOCAL_PATH_ORIG := $(LOCAL_PATH)
LOCAL_PATH := /the/path/to/my/first/sources
LOCAL_SRC_FILES = $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/**/*.c))
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CFLAGS := -g -O2
include $(BUILT_SHARED_LIBRARY)
LOCAL_PATH := $(LOCAL_PATH_ORIG)

----------------------------------------------- ------------------------------

第二个库

include $(CLEAR_VARS)
LOCAL_MODULE := libSecond
LOCAL_PATH_ORIG := $(LOCAL_PATH)
LOCAL_PATH := /the/path/to/my/second/sources
LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/**/*.cpp))                                                                                                                       
LOCAL_C_INCLUDES :=     $(wildcard $(LOCAL_PATH)/**)                                                                                                                    
LOCAL_LDLIBS := -lGLESv2 -llibFirst
LOCAL_SHARED_LIBRARIES := libFirst                                                                                                    
include $(BUILD_SHARED_LIBRARY)
LOCAL_PATH := $(LOCAL_PATH_ORIG)

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

问题在于这一行:

include $(BUILT_SHARED_LIBRARY)

A打错了,是

include $(BUILD_SHARED_LIBRARY)

...