从GNU Make文档中,5.3.1 Choosing the Shell------------------------The program used as the shell is taken from the variable `SHELL'. Ifthis variable is not set in your makefile, the program `/bin/sh' isused as the shell.因此,将其放在SHELL := /bin/bashmakefile的顶部,您应该一切顺利。顺便说一句:您也可以针对一个目标执行此操作,至少对于GNU Make而言。每个目标可以有自己的变量分配,如下所示:all: a ba: @echo "a is $$0"b: SHELL:=/bin/bash # HERE: this is setting the shell for b onlyb: @echo "b is $$0"打印:a is /bin/shb is /bin/bash有关更多详细信息,请参见文档中的“特定于目标的变量值”。该行可以在Makefile中的任何地方进行,而不必紧接在目标文件之前。