首页 > 解决方案 > 在这个 git repo 中运行 ./Makefile 会导致错误

问题描述

将这个 Github 存储库克隆到我的 Arch Linux 机器上。我跑了./Makefile,但得到了这些错误。

./Makefile: line 9: MKFILE: command not found
./Makefile: line 10: DEPSFILE: command not found
./Makefile: line 11: GCC: command not found
./Makefile: line 12: CHEADER: command not found
./Makefile: line 13: CSOURCE: command not found
./Makefile: line 14: OBJECTS: command not found
./Makefile: line 15: EXECBIN: command not found
./Makefile: line 16: SOURCES: command not found
./Makefile: line 19: all: command not found
./Makefile: line 22: -o: command not found
./Makefile: line 24: fg: no job control
./Makefile: line 25: syntax error near unexpected token `newline'
./Makefile: line 25: `  ${GCC} -c $<'

我如何实际运行这个程序?

标签: cmakefile

解决方案


Makefile不是脚本文件。它被设计为与make, not shor一起运行bash。你应该这样做:

make -f ./Makefile

但是,通常您只需执行以下操作:

make

一些 Makefile 作者#/usr/bin/make -f在文件顶部放置了一个 shebang,以便可以直接执行文件,但通常情况并非如此。


推荐阅读