Makefile作为带有Shebang的可执行脚本吗? [英] Makefile as an executable script with shebang?
本文介绍了Makefile作为带有Shebang的可执行脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以创建由make解释的可执行脚本?
Is it possible to create an executable script that would be interpreted by make?
我尝试过:
#!/usr/bin/env make --makefile=/dev/stdin
main:
@echo Hello!
但它不起作用-挂起,直到按 Ctrl-c .
but it does not work - hangs until press Ctrl-c.
推荐答案
#!/usr/bin/make -f
main:
@echo Hello World!
通常,这是您在标准make文件中所需的全部内容.文件名作为最后一个参数隐式传递. /dev/stdin
通常是tty.如果有理由,您可以做整个env
事情,但是通常没有必要.
Is normally all you need in a standard make file. The filename is implicitly passed as the last argument. /dev/stdin
here is (usually) the tty. You can do the whole env
thing if there's a reason to, but often there's no need.
ajw@rapunzel:~/code/videocc/tools > vi Makefile
ajw@rapunzel:~/code/videocc/tools > chmod a+x Makefile
ajw@rapunzel:~/code/videocc/tools > ./Makefile
Hello World!
这篇关于Makefile作为带有Shebang的可执行脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文