在我的 Makefile 中,我有一些检查网络连接的代码。这段代码需要相当长的时间来运行,我只想在另一个目标无法构建时运行它。
当前的 Makefile
all: files network
# compile files
files:
# get files from network resources
network:
# check for network connectivity
# echo and return an error if it's not available
执行顺序:
if not network:
# exit with error
if not files:
# exit with error
if not all:
# exit with error
所需的 Makefile
在上面的例子中,我希望network
目标是“制造”的,只有当files
目标未能“制造”时。
执行顺序:
if not files:
if not network:
# exit with error
if not all:
# exit with error