P.S. 如同上一篇,在使用前必須要先Build Android來產生相關的Library
CPP = arm-eabi-g++ CC = arm-eabi-gcc PRODUCT = cardhu Android_PATH = /opt/compal/android/15r1 NAME = matrix_mal CFLAG = -I$(Android_PATH)/system/core/include \ -I$(Android_PATH)/hardware/libhardware/include \ -I$(Android_PATH)/hardware/ril/include \ -I$(Android_PATH)/dalvik/libnativehelper/include\ -I$(Android_PATH)/frameworks/base/include \ -I$(Android_PATH)/external/skia/include \ -I$(Android_PATH)/out/target/product/$(PRODUCT)/obj/include\ -I$(Android_PATH)/bionic/libc/arch-arm/include\ -I$(Android_PATH)/bionic/libc/include \ -I$(Android_PATH)/bionic/libstdc++/include\ -I$(Android_PATH)/bionic/libc/kernel/common\ -I$(Android_PATH)/bionic/libc/kernel/arch-arm\ -I$(Android_PATH)/bionic/libm/include \ -I$(Android_PATH)/bionic/libm/include/arch/arm \ -I$(Android_PATH)/bionic/libthread_db/include\ -I$(Android_PATH)/bionic/libm/arm\ -I$(Android_PATH)/bionic/libm\ -I$(Android_PATH)/out/target/product/$(PRODUCT)/obj/SHARED_LIBRARIES/libm_intermediates\ -include $(Android_PATH)/system/core/include/arch/linux-arm/AndroidConfig.h LDFLAGS = -mthumb-interwork -fpic -fno-exceptions -ffunction-sections \ -funwind-tables -fstack-protector\ -fmessage-length=0 -Bdynamic -Wl,-T,$(Android_PATH)/build/core/armelf.x\ -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc \ -Wl,--no-undefined -Wl,-rpath-link=$(Android_PATH)/out/target/product/$(PRODUCT)/obj/lib \ -L$(Android_PATH)/out/target/product/$(PRODUCT)/obj/lib \ -nostdlib $(Android_PATH)/out/target/product/$(PRODUCT)/obj/lib/crtend_android.o \ $(Android_PATH)/out/target/product/$(PRODUCT)/obj/lib/crtbegin_dynamic.o \ $(Android_PATH)/prebuilt/darwin-x86/toolchain/arm-eabi-4.4.3/lib/gcc/arm-eabi/4.4.3/libgcc.a\ -lc -lm IGNORE = -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__\ -DANDROID -DSK_RELEASE -DNDEBUG -UDEBUG -march=armv5te -mtune=xscale\ -msoft-float -mfloat-abi=hard all: $(CPP) $(LDFLAGS) $(CFLAG) -o $(NAME) matrix_mal.cpp
要套用到自己的project只需修改
- Line 3: Android編譯的Product,例如如果是模擬器就把PRODUCT改成generic
- Line 4: 修改Android Source Code的位置 Android_PATH
- Line 5: Binary的名字 NAME
- Line 40: Source Code的名字,替換matrix_mal.cpp
- Line 40如果是要編譯C code的話,將 CPP改成CC
$ make CFLAG+="額外的參數"或是如果想要指定binary的名稱,可以:
$ make NAME="名稱"
沒有留言:
張貼留言