无法从 Makefile 执行 shell 命令

Impossible to execute shell command from Makefile

我的 makefile 有这个问题。当我执行这个命令时:

kill $(ps aux | grep '[p]ython service/logdata.py' | awk '{print }')

从终端运行正常。但是根据 makefile 中的这条规则:

stop:
    kill $(ps aux | grep '[p]ython service/logdata.py' | awk '{print }')

我收到这个错误:

kill 

Usage:
 kill [options] <pid> [...]

Options:
 <pid> [...]            send signal to every <pid> listed
 -<signal>, -s, --signal <signal>
                        specify the <signal> to be sent
 -l, --list=[<signal>]  list all signal names, or convert one to a name
 -L, --table            list all signal names in a nice table

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see kill(1).
makefile:19: recipe for target 'stop' failed
make: *** [stop] Error 1

我已经检查过 grep 输出不为空。

提前致谢。

$ 在 makefile 中有特殊含义,您需要将其加倍才能将其逐字传递给 shell.

stop:
    kill $$(ps aux | grep '[p]ython service/logdata.py' | awk '{print $}')