0

我试图运行以下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.

知道为什么吗?

谢谢!

4

2 回答 2

1

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

要执行 Makefile 中的配方,请运行make.

于 2012-05-03T21:02:37.587 回答
0

尝试定义一个工作主管,如下所述:

通用 GNU makefile 目录路径

使用该 PWD 引用脚本文件以调用chmod.

于 2012-05-03T21:03:41.063 回答