#StackBounty: #android #c #android-ndk #jni #android.mk Adding a compiler flag to only one file in Android.mk

Bounty: 100

I have an Android.mk file that has a number of files for which LOCAL_CFLAGS get applied to them. I would like to apply a different flag to only one of the files out of the many. How can this be accomplished?

I searched the internet from the Android perspective, but didn’t find a whole lot. Considering the following example I would like to apply flag TEST3 to file test3.c only. I looked at Per-file CPPFLAGS in Android.mk, but I couldn’t find anything as far as how to use PRIVATE_CPPFLAGS to one file. Any ideas?

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := test
LOCAL_SRC_FILES := test1.c test2.c test3.c
LOCAL_CFLAGS := -DTEST1_2_AND_3

include $(BUILD_SHARED_LIBRARY)


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.