ndk: Add a test to check that prebuilt libraries work as expected.
Change-Id: I7c0683ac1ee50bb62cc0f7ac22e839f749ec1cdf
diff --git a/ndk/tests/prebuilt-library/jni/Android.mk b/ndk/tests/prebuilt-library/jni/Android.mk
new file mode 100644
index 0000000..88a7dd3
--- /dev/null
+++ b/ndk/tests/prebuilt-library/jni/Android.mk
@@ -0,0 +1,31 @@
+LOCAL_PATH := $(call my-dir)
+
+# Define BUILD_FOO=1 to rebuild libfoo.so from scratch, then
+# copy obj/local/armeabi/libfoo.so to jni/libfoo.so
+#
+ifneq ($(BUILD_FOO),)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_SRC_FILES := foo/foo.c
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/foo
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo
+include $(BUILD_SHARED_LIBRARY)
+
+else # not build libfoo.so, trying to use PREBUILT_SHARED_LIBRARY instead.
+
+# Note: the module is named foo-prebuilt, but the library is libfool.so !
+#
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo-prebuilt
+LOCAL_SRC_FILES := $(LOCAL_PATH)/libfoo.so
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo-user
+LOCAL_SRC_FILES := foo-user.c
+LOCAL_PREBUILTS := foo-prebuilt
+include $(BUILD_SHARED_LIBRARY)
+
+endif