Search code examples
makefileandroid.mk

Add functions to be called in Android.mk file


We can do call all-subdir-java-files in a Android.mk file to link all java files recursively. How can we link all c and c++ files using similar way like call all-subdir-cc-files? Can I define a function all-subdir-cc-files on my own and call it in Android.mk files?


Solution

  • Yes, you can add your functions to Android.mk. It's a makefile, nothing more. You should only remember that Android.mk may be included more than once, of you build for different ABIs.

    A example of a function that returns a list of files under given directory can be found here.

    As for the all-subdir-java-files, note that it belongs to AOSP build engine, not to NDK.