ndk编译时的通用Android.mk文件

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

LOCAL_MODULE := live555

MY_SRC_PATH    := $(LOCAL_PATH)/
MY_All_Files   := $(shell find $(MY_SRC_PATH)/.)
MY_All_Files   := $(MY_All_Files:$(MY_SRC_PATH)/./%=$(MY_SRC_PATH)%)
MY_C_CPP_LIST  := $(filter %.cpp %.c,$(MY_All_Files)) 
MY_C_CPP_LIST  := $(MY_C_CPP_LIST:$(LOCAL_PATH)/%=%)
LOCAL_SRC_FILES := $(MY_C_CPP_LIST)

LOCAL_C_INCLUDES := \
    live/BasicUsageEnvironment/include \
    live/groupsock/include \
    live/liveMedia/include \
    live/UsageEnvironment/include \
    live/WindowsAudioInputDevice/include

LOCAL_CPPFLAGS += -fPIC -fexceptions -DXLOCALE_NOT_USED=1 -DNULL=0 -DNO_SSTREAM=1 -UIP_ADD_SOURCE_MEMBERSHIP \
                  -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -DANDROID -mthumb -mfloat-abi=softfp
LOCAL_LDLIBS := -lm -llog
LOCAL_ARM_MODE := arm
LOCAL_LDFLAGS += -fPIC
LOCAL_CFLAGS += -fPIC LOCAL_PRELINK_MODULE :
= false #include $(BUILD_STATIC_LIBRARY) include $(BUILD_SHARED_LIBRARY)

 

ndk-build命令行参数

1、ndk-build NDK_LOG=1

用于配置LOG级别,打印ndk编译时的详细输出信息

2、ndk-build NDK_PROJECT_PATH=.

指定NDK编译的代码路径为当前目录,如果不配置,则必须把工程代码放到Android工程的jni目录下

3、ndk-build APP_BUILD_SCRIPT=./Android.mk

指定NDK编译使用的Android.mk文件

4、ndk-build NDK_APPLICATION_MK=./Application.mk

指定NDK编译使用的application.mk文件

5、ndk-build clean

清除所有编译出来的临时文件和目标文件

6、ndk-build -B

强制重新编译已经编译完成的代码

7、ndk-build NDK_DEBUG=1

执行 debug build

8、ndk-build NDK_DEBUG=0

执行 release build

9、ndk-build NDK_OUT=./mydir

指定编译生成的文件的存放位置

10、ndk-build -C /opt/myTest/

到指定目录编译native代码

posted @ 2015-04-24 09:12  微信公众号--共鸣圈  阅读(405)  评论(0编辑  收藏  举报