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

僤鯓⒐⒋嵵緔 提交于 2019-11-30 09:13:43

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 working

LOCAL_MODULE := libecho_test
LOCAL_MODULE_TAGS := optional
include $(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.

Vishrut

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_test
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)

all:
    echo hello
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!