Overriding APP_CFLAGS

1,330 views
Skip to first unread message

Divkis

unread,
Apr 9, 2010, 5:20:06 AM4/9/10
to android-ndk
Hi,
I am unable to find a way to override the APP_CFLAGS without
modifying the NDK build rule files.

When I try to set APP_CFLAGS := -marm -mcpu=cortex-a9, I see that this
extra flag gets appended to the other CFLAGS.

I want to override as the default flags conflict with the flags that I
am passing and also make it difficult to see which flag is really
getting enabled if there are two of them of the same kind. For
example, with the flag above I see the following warning:

warning: switch -mcpu=cortex-a9 conflicts with -march= switch

because -march=armv5te is prepended to the APP_CLFAGS.

Please suggest how I can override the APP_CLFAGS.

Thanks,
Divkis

David Turner

unread,
Apr 9, 2010, 12:59:27 PM4/9/10
to andro...@googlegroups.com
Just use a -march=<something> in your APP_CFLAGS to override the default.

But frankly, your code will not work on many devices out there, you should not be doing this !


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


Divkis

unread,
Apr 9, 2010, 2:10:53 PM4/9/10
to android-ndk
Hi,

> Just use a -march=<something> in your APP_CFLAGS to override the default.

Well that doesn't solve my problem. From what it appears arm-gcc
shipped with NDK expects either of cpu or architecture to be defined
but not both. I would want to define other flags as well like -mfloat-
abi, optimization level etc.

Having multiple -march / -mcpu options in the build command looks ugly
and confusing even though probably the ones defined later would
override. For example having -march=armv5te -march=armv7
simultaneously in build command would probably build for the v7
architecture but can be confusing.

> But frankly, your code will not work on many devices out there, you should
> not be doing this !

I am targeting only a specific device, and do not intend my code to
run on all possible Android platforms.

Thanks a lot for your immediate response,
Regards,
Divkis

David Turner

unread,
Apr 9, 2010, 4:01:42 PM4/9/10
to andro...@googlegroups.com
In this case, you will have to override TARGET_ARCH_CFLAGS. look for the current definition in build/platforms/toolchains/arm-eabi-4.4.0/setup.mk

Good luck.

Divkis

Divkis

unread,
Apr 10, 2010, 1:27:33 AM4/10/10
to android-ndk
Hi,

On Apr 10, 1:01 am, David Turner <di...@android.com> wrote:
> In this case, you will have to override TARGET_ARCH_CFLAGS. look for the
> current definition in build/platforms/toolchains/arm-eabi-4.4.0/setup.mk
>

That does work but when I pass the flags from command line like this:

make -j2 APP=myapp V=1 APP_OPTIM=debug TARGET_ARCH_CFLAGS="-
mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=vfpv3-d16"

Isn't there a way to override by specifying it in either
Application.mk or Android.mk?

Thanks again,
Regards,
Divkis

David Turner

unread,
Apr 10, 2010, 9:19:23 AM4/10/10
to andro...@googlegroups.com
No, just a wrapper script and be done with it, really.

Regards,
Divkis

Reply all
Reply to author
Forward
0 new messages