am 9aff3c7d: am f68d6af8: ndk: Add a test to check that prebuilt libraries work as expected.

Merge commit '9aff3c7d58e7ee737033a4da23d5c590e36ed78e'

* commit '9aff3c7d58e7ee737033a4da23d5c590e36ed78e':
  ndk: Add a test to check that prebuilt libraries work as expected.
This commit is contained in:
David 'Digit' Turner
2010-07-09 10:08:09 -07:00
committed by Android Git Automerger
5 changed files with 49 additions and 0 deletions

View File

@@ -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

View File

@@ -0,0 +1,6 @@
#include "foo.h"
int main(void)
{
return foo();
}

View File

@@ -0,0 +1,6 @@
#include "foo.h"
int foo(void)
{
return 42;
}

View File

@@ -0,0 +1,6 @@
#ifndef FOO_FOO_H
#define FOO_FOO_H
extern int foo(void);
#endif /* FOO_FOO_H */

Binary file not shown.