您可以将变量传递给Makefile,如下所示:run: @echo ./prog $$FOO用法:$ make run FOO="the dog kicked the cat"./prog the dog kicked the cat要么:$ FOO="the dog kicked the cat" make run./prog the dog kicked the cat或者使用Beta提供的解决方案:run: @echo ./prog $(filter-out $@,$(MAKECMDGOALS))%: @:%:-与任何任务名称匹配的规则; @:-空配方=不执行任何操作用法:$ make run the dog kicked the cat./prog the dog kicked the cat