ANDROID NDK makefile 链接静态库的方法

[NDK] Android.mk

Android NDK的 makefile在r4及r5b的寫法有點不一樣
--------------------------For r4 ------------------------
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

#for Android log
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog

LOCAL_SRC_FILES:= src/Test.c

#Load static library (*.a) for ndk version 4
LOCAL_LDFLAGS := $(LOCAL_PATH)/lib/lib1.a
LOCAL_LDFLAGS += $(LOCAL_PATH)/lib/lib2.a

#Set library name as Test
LOCAL_MODULE := Test

#Export shared library
include $(BUILD_SHARED_LIBRARY)


--------------------------For r5b ------------------------


LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := LIB1
LOCAL_SRC_FILES := lib/lib1.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := LIB2
LOCAL_SRC_FILES := lib/lib2.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
LOCAL_MODULE := Test
LOCAL_SRC_FILES:= src/Test.c
LOCAL_STATIC_LIBRARIES := LIB1 LIB2
include $(BUILD_SHARED_LIBRARY)

你可能感兴趣的:(android,Module,Path,include,library,makefile)