How to create third-party libraries with Android NDK

How can I compile third-party libraries using the Android NDK? I am compiling a shell that implements JNI functions as a shared lib, which depends on another third-party library (HTK). I do not know how to configure the makefile. The following does not work:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

include HTKLib/Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE    := gaitfuncs
LOCAL_SRC_FILES := gaitfuncs.c
%LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog

include $(BUILD_SHARED_LIBRARY)

The second make file should then create a static lib, to which my shared lib links belong. How can I properly include this makefile? Is it correct? And as a bonus: are there wildcards for the LOCAL_SRC_FILES variable so that all files ending in .c, for example.

Thank!

+1
source share
2 answers

I found a solution:

JNIPATH := $(call my-dir)
LOCAL_PATH := $(JNIPATH)

include $(call all-subdir-makefiles)

LOCAL_PATH := $(JNIPATH)
include $(CLEAR_VARS)

LOCAL_MODULE    := gaitfuncs
LOCAL_SRC_FILES := gaitfuncs.c
LOCAL_STATIC_LIBRARIES := htk

include $(BUILD_SHARED_LIBRARY)

The CLEAR_VARS function call before the subdir-makefiles function call was not exactly elegant;)

+10

documentation.html Android NDK

"my-dir"

Makefile, Android.mk. LOCAL_PATH Android.mk, :

 LOCAL_PATH := $(call my-dir)

"all-subdir-makefiles"

Android.mk, "my-dir".

0

All Articles