Using Make's 'wildcard' function in Android.mk

I’m having a problem using Make’s wildcard function in my Android.mk build file.

My other makefiles use a line like this one to specify “All .c files in this folder”:

  • getParentFragment returning null
  • how to set onClick method with linearLayout?
  • Should I use Service or IntentService for my android app?
  • You have not accepted the license agreements of the following SDK components
  • Using a SQLite database in Libgdx
  • android sqlite query with multiple where
  • CFILES := $(wildcard *.c)

    In my Android.mk file I tried this:

    LOCAL_SRC_FILES := $(wildcard *.c)

    However, this has the same affect as not including any files at all.

    If I include the files manually the build works as I’d expect.

    I’m wondering if maybe the current working directory isn’t my project path at the time this statement is evaluated? If so, can I use a combination of $(call my-dir) and the wildcard function to get the list I want?

    Related posts:

    Android: How to make the flip animation for android activity, as like iphone flip horizontal from le...
    How to listen to GC events in Android
    Best way to call activity Method with Phonegap 3.0 from js
    Work around Canvas.clipPath() that is not supported in android any more
    Android Play Store Error -505
    Realm, RxJava, asObservable() and doOnUnsubscribe()
  • Firebase Permission denied Error
  • Detect available memory inside of a WebView
  • Need AIDL tutorials
  • Android get current date and show it in TextView
  • Why two parameters to ComponentName constructor?
  • Android YouTube api v3 - orientation
  • 2 Solutions collect form web for “Using Make's 'wildcard' function in Android.mk”

    Here’s what I’ve used in the past for doing this:

    LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE    := mylibrary
    LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.c)
    include $(BUILD_STATIC_LIBRARY)
    

    ‘my-dir’ is a macro provided by the build system and returns the path of the directory containing the Android.mk file.

    If your definition of “this directory” is “the directory containing this makefile”, then

    $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))*.c)
    

    ought to work.

    (caveat: I don’t know from Android)

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.