echo 在 Makefile 中不起作用

use*_*132 1 linux makefile

我已经在 Makefile 中添加了如下代码:

ifeq "$var" "1"
    var_1 := 1\
    echo "g++ version OK"\
    $(info $(var_1))
else
    echo "needs to be updated"
endif
Run Code Online (Sandbox Code Playgroud)

我在这部分代码中到处都使用选项卡。它似乎不起作用,当我运行 make 时根本没有任何回声,Makefile 已经包含目标文件和标志等。它与代码的位置有关吗?我无法识别。请帮忙。

Max*_*kin 5

echo是一个 shell 命令,它只能在配方或$(shell ...)函数中工作。

在其他任何地方使用$(info ...)函数。