Makefile.def 2.5 KB
Newer Older
1 2 3
# get the name of current operation system: Linux or Darwin
SYSTEM=$(shell "uname -s")

Y
Yan Chunwei 已提交
4
CXX_DEFINES = -DARM_WITH_OMP -DHPPL_STUB_FUNC -DLITE_WITH_ARM -DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK \
5
              -DLITE_WITH_LINUX -DPADDLE_DISABLE_PROFILER -DPADDLE_NO_PYTHON -DPADDLE_WITH_TESTING
6
LDFLAGS = -latomic -pthread -ldl -llog -lz
Y
Yan Chunwei 已提交
7

8 9 10 11 12 13 14
SYSROOT_COMPLILE = --sysroot=$(NDK_ROOT)/sysroot

SYSTEM_INCLUDES = -I$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
                  -I$(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include \
                  -I$(NDK_ROOT)/sources/android/support/include \
                  -I$(NDK_ROOT)/sysroot/usr/include \

Y
Yan Chunwei 已提交
15 16

ifeq ($(ARM_ABI), arm8)
17 18 19 20 21
    ifeq ($(SYSTEM), Linux)
        CC = $(NDK_ROOT)/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++
    else
        CC = $(NDK_ROOT)/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-g++
    endif
22
    CXX_FLAGS = -funwind-tables -no-canonical-prefixes -D__ANDROID_API__=23 -fexceptions -frtti -std=c++11 -fopenmp -O3 -DNDEBUG -fPIE
23 24 25 26 27
    CXXFLAGS_LINK = $(CXX_FLAGS) -pie -Wl,--gc-sections
    SYSROOT_LINK = --sysroot=$(NDK_ROOT)/platforms/android-24/arch-arm64
    SYSTEM_LIBS = $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a \
                  $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++abi.a
    INCLUDES = $(SYSTEM_INCLUDES) -I$(NDK_ROOT)/sysroot/usr/include/aarch64-linux-android
Y
Yan Chunwei 已提交
28
else
29 30 31 32 33
    ifeq ($(SYSTEM), Linux)
        CC = $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
    else
        CC = $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++
    endif
Y
Yan Chunwei 已提交
34
    CXX_FLAGS = -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=softfp -funwind-tables -no-canonical-prefixes \
35
               -D__ANDROID_API__=23 -fexceptions -frtti  -std=c++11 -fopenmp -O3 -DNDEBUG -fPIE
Y
Yan Chunwei 已提交
36
    CXXFLAGS_LINK = $(CXX_FLAGS) -pie -Wl,--fix-cortex-a8 -Wl,--gc-sections -Wl,-z,nocopyreloc
37 38 39 40 41 42
    SYSROOT_LINK = --sysroot=$(NDK_ROOT)/platforms/android-23/arch-arm
    SYSTEM_LIBS = $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a \
                  $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++abi.a \
                  $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a \
                  $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a
    INCLUDES = $(SYSTEM_INCLUDES) -I$(NDK_ROOT)/sysroot/usr/include/arm-linux-androideabi
Y
Yan Chunwei 已提交
43
endif