Conditional statements in Android.mk

7,915 views
Skip to first unread message

Jin Chiu

unread,
Jul 6, 2010, 6:26:42 PM7/6/10
to android-ndk
Do Android Makefiles support any form of conditional statements (i.e.
if-else syntax). For example, I would like to specify a separate set
of build flags and files based on the current ABI, or based on an
environment variable.

Sambhav

unread,
Jul 6, 2010, 11:24:41 PM7/6/10
to andro...@googlegroups.com
It does support conditional statements. 

ex.
ifeq ($(WITH_MALLOC_LEAK_CHECK),true)
  LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK
endif

ifeq ($(TARGET_SIMULATOR),true)
ifeq ($(TARGET_OS),linux)
ifeq ($(TARGET_ARCH),x86)
LOCAL_LDLIBS += -lpthread -ldl -lrt -lssl
endif
endif
endif

if you have android source code you can browse through some existing Android.mk files to get more examples. 


--
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.


Olivier Guilyardi

unread,
Jul 7, 2010, 6:54:37 AM7/7/10
to andro...@googlegroups.com
The NDK docs state that Android.mk "is really a tiny GNU Makefile fragment...".

Here are the docs about make conditionals:
http://www.gnu.org/software/make/manual/html_node/Conditionals.html

Olivier

> <mailto:andro...@googlegroups.com>.


> To unsubscribe from this group, send email to
> android-ndk...@googlegroups.com

> <mailto:android-ndk%2Bunsu...@googlegroups.com>.

Reply all
Reply to author
Forward
0 new messages