简体   繁体   中英

How do I write conditionals ifeq ($(filter-out tt_%,$(TARGET_PRODUCT)),) in android.bp

How do handle below code in Android.bp ? I need to enable conditional flag based on Target_product that is selected. I have shared my Android.mk , similar logic need to be handled in Android.bp.

In Android.mk I have below code

ifeq ($(filter-out ctt_%,$(TARGET_PRODUCT)),)

LOCAL_CFLAGS += -DCTT_BUILD

else ifeq ($(filter-out ihu_%,$(TARGET_PRODUCT)),)

LOCAL_CFLAGS += -DPHU_BUILD

LOCAL_SRC_FILES +=vendor_cmds.c
LOCAL_C_INCLUDES += vendor_cmds.h
endif

Thanks in advance.

Your answers are really appreciated.

The short answer is quite disappointing: you cannot write conditionals in Android.bp.

The long answer, which is also disappointing: you need a bootstrap_go_package, which can handle conditionals using a module written in go. Refer to the answer to this question for a very simple example: What is art.go? And why is it considered a way to write conditionals in bp files?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM