且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查Makefile中是否存在文件,以便将其删除?

更新时间:2023-11-25 22:04:52

第二个最重要的答案是ifeq,但是,它没有提到这些必须与目标名称处于同一级别,例如,仅在当前不存在的情况下下载文件,才可以使用以下代码:

The second top answer mentions ifeq, however, it fails to mention that these must be on the same level as the name of the target, e.g., to download a file only if it doesn't currently exist, the following code could be used:

download:
ifeq (,$(wildcard ./glob.c))
    curl … -o glob.c
endif