当前位置:操作系统 > 安卓/Android >>

Android NDK standlone编译脚本

NDK_ROOT=D:/gnu-toochain/android-ndk-r8c
TOOLCHAIN_ROOT=$(NDK_ROOT)/toolchains/arm-linux-androideabi-4.6/prebuilt/windows
TOOLCHAIN_PREFIX=$(TOOLCHAIN_ROOT)/bin/arm-linux-androideabi
TOOLCHAIN_INCLUDE=$(TOOLCHAIN_ROOT)/lib/gcc/arm-linux-androideabi/4.6/include-fixed
PLATFORM_ROOT=$(NDK_ROOT)/platforms/android-14/arch-arm
PLATFORM_INCLUDE=$(PLATFORM_ROOT)/usr/inlcude
PLATFORM_LIB=$(PLATFORM_ROOT)/usr/lib

MODULE_NAME=helloworld
RM=del

FLAGS=-I$(PLATFORM_INCLUDE) \
      -L$(PLATFORM_LIB) \
      -nostdlib \
      -lgcc \
      -Bdynamic \
      -lc 
      
#      -I$(TOOLCHAIN_INCLUDE) \      

OBJS=$(MODULE_NAME).o \
     $(PLATFORM_LIB)/crtbegin_dynamic.o \
     $(PLATFORM_LIB)/crtend_android.o
     
all:
	$(TOOLCHAIN_PREFIX)-gcc --sysroot=$(PLATFORM_ROOT) $(FLAGS) -c $(MODULE_NAME).c -o $(MODULE_NAME).o 
	$(TOOLCHAIN_PREFIX)-gcc --sysroot=$(PLATFORM_ROOT) $(FLAGS) $(OBJS) -o $(MODULE_NAME)

clean:
	rm *.o
    
install:
	adb push $(MODULE_NAME) /data/local/tmp
	adb shell chmod 755 /data/local/tmp/$(MODULE_NAME)

 

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,