【发布时间】:2016-09-08 14:04:39
【问题描述】:
我想编译 Python;我从 Github 克隆了存储库:
git clone --depth=1 --branch=2.7 https://github.com/python/cpython.git
配置有效但构建失败,因为找不到 Python:
$ cd cpython
$ ./configure
...
$ make
/bin/mkdir -p Include
./Parser/asdl_c.py -h Include ./Parser/Python.asdl
/usr/bin/env: python: No such file or directory
Makefile:718: recipe for target 'Include/Python-ast.h' failed
make: *** [Include/Python-ast.h] Error 127
这是因为Include/Python-ast.h 比Parser/asdl_c.py 更新,正如make --debug 所说:
...
Prerequisite 'Parser/Python.asdl' is newer than target 'Include/Python-ast.h'.
Prerequisite 'Parser/asdl.py' is newer than target 'Include/Python-ast.h'.
Prerequisite 'Parser/asdl_c.py' is newer than target 'Include/Python-ast.h'.
Must remake target 'Include/Python-ast.h'.
确实,标头在 Python 脚本之后被克隆了一点:
$ ls --full-time Include/Python-ast.h Parser/asdl_c.py
-rw-r--r-- 1 piwi piwi 21113 2016-09-08 15:22:32.984000000 +0200 Include/Python-ast.h
-rwxr-xr-x 1 piwi piwi 41414 2016-09-08 15:22:33.248000000 +0200 Parser/asdl_c.py
在这种特定情况下,触摸标题可以解决问题:
$ touch Include/Python-ast.h
$ make
... compiles ...
是否有适当的方法来防止这种行为?
谢谢,
【问题讨论】:
-
通常有一个 .PHONY 目标
all作为 makefile 中的第一个目标,例如all : target1 target2。make或make all将始终重新制作 target1 和 target2。 -
另一个尝试是
make -B或make --always-make。 -
@ElpieKay 谢谢。
标签: python git makefile compilation