0

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.

  • That is not command substitution in a makefile, it is a macro-name, probably a variable. Macros names of more than one character require braces { } when substituted, single character names do not (although it is still a good idea). Parentheses ( ) may also be used, but in some versions of make they have special a meaning when handling libraries. It could all be an environment variable available as a macro inside a makefile. – cdarke Jul 23 '18 at 15:26
  • makefile and bash are different lanugages with different syntax, in makefile $(foo) is a variable reference like ${foo} – Nahuel Fouilleul Jul 23 '18 at 15:36
  • There might be an earlier `include` which defines `DEPENDENCIES_NANOBUFFERS_DIR` – cdarke Jul 23 '18 at 15:57
  • I just found that DEPENDENCIES_NANOBUFFERS_DIR is defined in a completely different file which is in a different module. So that clears up this confusion. – Deam0nProcess Jul 24 '18 at 19:07

1 Answers1

0

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