Reputation: 152
I have a problem including another Android.mk and build the dependent shared library.
Makefile:
LOCAL_PATH := $(call my-dir)
MY_CORE_PATH := $(abspath $(LOCAL_PATH)/../..)
include $(CLEAR_VARS)
LOCAL_MODULE := Phone
LOCAL_SRC_FILES := phone.cpp
LOCAL_SHARED_LIBRARIES := libCore
include $(BUILD_SHARED_LIBRARY)
include $(MY_CORE_PATH)/Android.mk
When I compile this I get an error,
make: *** No rule to make target 'libCore.so' needed by 'libPhone.so'. Stop.
The libCore.so however builds without any issues but this makefile is not able to refer that correctly. Please provide any suggestions on how to resolve this.
NDK and Android version: android-ndk-r6, API level 9 building for Android ICS.
I am currently able to resolve by making the following changes.
# Modified Android.mk
LOCAL_PATH := $(call my-dir)
MY_CORE_PATH := $(abspath $(LOCAL_PATH)/../..)
# libCore
include $(CLEAR_VARS)
LOCAL_MODULE := Core
include $(MY_CORE_PATH)/Android.mk
include $(CLEAR_VARS)
LOCAL_MODULE := Phone
LOCAL_SRC_FILES := phone.cpp
LOCAL_SRC_FILES += libCore
include $(BUILD_SHARED_LIBRARY)
Upvotes: 2
Views: 4439
Reputation: 152
I found the reason for my compile error. It is because the LOCAL_MODULE name is not correctly provided in the other makefile. Below are the changes done,
[1] In the Android.mk that was building libCore.so, module name was mentioned as,
LOCAL_MODULE := Core
instead of
LOCAL_MODULE := libCore
[2] The last two statements are interchanged; Makefile is first included and then the library is built.
My understanding was that 'lib' is optional in the module name. I didn't doubt this because it was building fine within NDK, problem seen when it is built as part of Android source tree.
Upvotes: 1