tags:

views:

329

answers:

1

How can I compile third party libraries with the android NDK? I am compiling a wrapper which implements the JNI functions as a shared lib, which depends on another 3rd party lib (HTK). I don't know how to setup 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 makefile should then build a static lib which my shared lib links to. How can I include this subdir makefile properly? Is this the correct way of doing it? And as a bonus: Are there wildcards for the LOCAL_SRC_FILES variable to take all files ending in .c for example.

Thanks!

A: 

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)

Calling the CLEAR_VARS function before calling the subdir-makefiles function wasn't exactly elegant ;)