Shell script call from Android.mk, standard output and missing separator error Shell script call from Android.mk, standard output and missing separator error shell shell

Shell script call from Android.mk, standard output and missing separator error


The Android NDK build system is actually GNU Make. All of the code in the Android.mk file has to be valid make.

When you run $(shell) and don't store the value in a variable, then it is as if you copied the standard output of the script into your Android.mk file. i.e. it is as if your file contained the following:

LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)echo is workingLOCAL_MODULE := libecho_testLOCAL_MODULE_TAGS := optionalinclude $(BUILD_SHARED_LIBRARY)

.. which is not valid make syntax. Redirecting to >&2 in your script works because the output goes to the error output and is then shown on the console.

As Vishrut mentions, use $(info) or $(warning) to print messages. Or if you really want to run a script during the build, store its output in a variable:

ECHO_RESULT := $(shell ($(LOCAL_PATH)/echo_test.sh))

Here you won't see the echo output of the script, it goes into the variable.


Try $(info $(shell ($(LOCAL_PATH)/echo_test.sh))), it works.


Since richq's Answer doesn't work for me I use this:

LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := libecho_testLOCAL_MODULE_TAGS := optionalinclude $(BUILD_SHARED_LIBRARY)all:    echo hello