makefile.android_arm 1.44 KB
Newer Older
1 2 3
#
# makefile for ANDROID (generic ARM)
#
4 5 6
# export NDK=<ndk_home>
# tested with android-ndk-r8c-linux-x86
#
7

8 9
ANDROID_NDK_HOME=$(NDK)
ANDROID_NDK_BIN=$(ANDROID_NDK_HOME)/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin
10 11 12 13

# -fpic -Os
# -fstack-protector 
ANDROID_FLAGS=\
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  -MMD -MP -MF \
  -fpic -ffunction-sections -funwind-tables -fstack-protector \
  -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
  -march=armv5te -mtune=xscale -msoft-float -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \
  -I$(ANDROID_NDK_HOME)/sources/cxx-stl/system/include \
  -I$(ANDROID_NDK_HOME)/platforms/android-3/arch-arm/usr/include \
  -DANDROID -DANDROID_NDK -DNDEBUG \

ANDROID_LINK= \
  -Wl,--gc-sections -Wl,-z,nocopyreloc \
  --sysroot=$(NDK)/platforms/android-3/arch-arm \
  -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now \
  -L$(NDK)/platforms/android-3/arch-arm/usr/lib -lstdc++ \
  $(NDK)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libsupc++.a \
  -lc -lm 
29 30 31 32 33 34 35 36 37 38

OPTFLAGS=-O3 -s

ALLFLAGS=${OPTFLAGS} -pipe \
	-DNDEBUG -D_REENTRANT -DENV_UNIX \
	$(ANDROID_FLAGS) \
	$(LOCAL_FLAGS)

CXX=$(ANDROID_NDK_BIN)/arm-linux-androideabi-g++ -fexceptions -frtti
CC=$(ANDROID_NDK_BIN)/arm-linux-androideabi-gcc
39 40
CC_EXE= -fPIE
LINK_EXE=-fPIE -pie  # -fPIE -pie : only for executable
41 42 43 44 45 46 47 48 49
CC_SHARED= -fpic
LINK_SHARED=-fpic -shared

LOCAL_LIBS=$(ANDROID_LINK)
LOCAL_LIBS_DLL=$(LOCAL_LIBS) # -ldl

OBJ_CRC32=$(OBJ_CRC32_C)
OBJ_AES=