Search code examples
bashshellandroid-ndkandroid.mk

Command Substitution with Android.mk


I have come across the command in an Android.mk file that I am working with:

include $(DEPENDENCIES_NANOBUFFERS_DIR)/android/jni/include.mk

I understand that $(command) is "command substitution". It runs a command, captures it's output, and inserts that into the command line that contains $( )

However I've searched the entire Android.mk file to find what the command DEPENDENCIES_NANOBUFFERS_DIR stands for and I haven't found any meaning for it.

I know that NANOBUFFERS is a file in my dependencies directory, since I manually searched through all the files contained in my root directory. The is a file named dependencies and within this file is my NANOBUFFERS file. However if DEPENDENCIES_NANOBUFFERS_DIR is not specified explicitly how is the compiler able to find the correct pathway to include.mk? Is this done automatically?

DEPENDENCIES_NANOBUFFERS_DIR occurs in only one other place and that is at the bottom of the Android.mk file.

$(call import-add-path,$(DEPENDENCIES_NANOBUFFERS_DIR)/..)

Can someone please explain how the compiler interprets DEPENDENCIES_NANOBUFFERS_DIR even when this command isn't specfied anywhere in the Android.mk file? Thank you in advance.


Solution

  • This following code links to another Android.mk file which is in a different file which is in a different module

    include $(DIFFERENT_DIR)/buildtool/android_common.mk
    

    Within this android_common.mk the variable DEPENDENCIES_NANOBUFFERS_DIR is assigned it's pathway