NMake .PHONY analogue

被刻印的时光 ゝ 提交于 2019-12-02 02:47:42

I think this is what you are looking for:

http://msdn.microsoft.com/en-us/library/7sb2acw1%28v=VS.71%29.aspx

Pseudotargets

A pseudotarget is a label used in place of a filename in a dependency line. It is interpreted as a file that does not exist, and so is out-of-date. NMAKE assumes a pseudotarget's timestamp is the most recent of all its dependents. If it has no dependents, the current time is assumed. If a pseudotarget is used as a target, its commands are always executed. A pseudotarget used as a dependent must also appear as a target in another dependency. However, that dependency does not need to have a commands block.

Pseudotarget names follow the filename syntax rules for targets. However, if the name does not have an extension (that is, does not contain a period), it can exceed the 8-character limit for filenames and can be up to 256 characters long.

If i understand it correctly you don't have a .PHONY in nmake (Microsoft's, there are many nmake flavors out there). And the link you posted states that on top:

Tutorial: A Little Help With Alcatel-Lucent nmake

Maybe you could call one test and the other one tests?

For those who are seeking for a way around this absent .PHONY in nmake:

You may introduce a target which would definitely be a pseudotarget (i.e. choose a name not matching any of the existing files/directories) and make it a dependent of what you mean to be a .PHONY. E.g.:

test: .phony
        dir /b

.phony:

And here's the output:

D:\Temp\nmake-phony>nmake

Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

        dir /b
Makefile
test
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!