且构网

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

您如何强制makefile重建目标?

更新时间:2021-12-08 23:36:45

您可以将一个或多个目标声明为

You could declare one or more of your targets to be phony.

虚假目标实际上不是文件名.宁可只是当您显式执行配方时要执行的名称要求.使用伪造目标有两个原因:避免使用与同名文件冲突,并提高性能.

A phony target is one that is not really the name of a file; rather it is just a name for a recipe to be executed when you make an explicit request. There are two reasons to use a phony target: to avoid a conflict with a file of the same name, and to improve performance.

...

假冒目标不应成为真实目标文件的前提;如果是的,每次配方更新时都会运行其配方文件.只要一个虚假的目标永远不是真实存在的前提目标,仅当伪造目标配方才会执行目标是指定的目标

A phony target should not be a prerequisite of a real target file; if it is, its recipe will be run every time make goes to update that file. As long as a phony target is never a prerequisite of a real target, the phony target recipe will be executed only when the phony target is a specified goal