I'm trying to get my Android.mk file to optimize the binaries:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := fred
LOCAL_SRC_FILES := fred.c
LOCAL_LDLIBS := -llog
LOCAL_CFLAGS = -O3
NDKDEBUG = 0
include $(BUILD_SHARED_LIBRARY)
I then save this, and run
$NDK/ndk-build -B V=1
I then run md5sum on the resulting library, and there is no difference between it and one built with
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := fred
LOCAL_SRC_FILES := fred.c
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
So, what am I doing wrong?
Output of the compiler seems to be:
/home/AStupidNoob/Documents/Android/android-ndk-r7b/toolchains/arm-linux-androideabi-
4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -MMD -MP -MF /home/AStupidNoob
/workspace/Fred/obj/local/armeabi/objs/fred/fred.o.d -fpic -ffunction-sections -funwind-
tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__
-D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/home/AStupidNoob
/workspace/Fred/jni -DANDROID -O3 -Wa,--noexecstack -O2 -DNDEBUG -g -I/home/AStupidNoob
/Documents/Android/android-ndk-r7b/platforms/android-4/arch-arm/usr/include -c
/home/AStupidNoob/workspace/Fred/jni/fred.c -o /home/AStupidNoob/workspace/Fred/obj
/local/armeabi/objs/fred/fred.o
I'm not sure if this is OK, but it seems that the problem is perhaps the 3 optimization flags, -Os -O2 -O3, but how do I fix this?
Thanks!