Search code examples
androidwildcardandroid.mk

How to filter with wildcard in Android.mk


I am trying to tweak one Android.mk module for a specific usage so it could be built only for a specific TARGET_PRODUCT. So, I inserter something like this:

ifneq ( ,$(filter product_name,$(TARGET_PRODUCT)))

...

endif # TARGET_PRODUCT

Problem is, it works for a product_name, but I want it to work also for a product_name1, product_name2, product_surname etc. So how could I insert wildcards instead second word? Something like product_*.


Solution

  • You can use "%" as a wildcard:

    ifneq ($(filter product_%,$(TARGET_PRODUCT)),)
    ...
    endif # TARGET_PRODUCT
    

    See http://www.gnu.org/software/make/manual/html_node/Text-Functions.html