在python代码上使用makefile制作可执行文件

时间:2012-05-03 20:58:33

标签: python makefile executable

我试图运行以下makefile:

all:
    chmod +x codeWriter.py
    chmod +x parser.py
    chmod +x vmTranslator.py
    chmod +x VMtranslator


tar:
    tar cvf project7.tar README Makefile *.py VMtranslator

clean:
    rm -f *.tar *.pyc os* sys*

但由于某些未知原因我得到了这些错误:

line 1: all:: command not found
chmod: codeWriter.py: No such file or directory
chmod: parser.py: No such file or directory
chmod: vmTranslator.py: No such file or directory
chmod: VMtranslator: No such file or directory

line 7: tar:: command not found
tar: README: Cannot stat: No such file or directory
tar: Makefile: Cannot stat: No such file or directory
tar: *.py: Cannot stat: No such file or directory
tar: VMtranslator: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.

任何想法为什么?

谢谢!

2 个答案:

答案 0 :(得分:1)

听起来你试图运行Makefile就好像它是一个shell脚本(可能是sh Makefile)。 Makefile既不应该直接运行,也不应该具有执行权限(在大多数情况下)。

要在Makefile中执行配方,请运行make

答案 1 :(得分:0)

尝试定义此处概述的工作总监:

Common GNU makefile directory path

使用该PWD引用调用chmod的脚本文件。