I have both a target test
in my Makefile and a directory called test
in my project. In GNU Make I can declare it to be phony like this:
.PHONY: all compile test clean docs static
Is it possible to do the same in NMake? According to http://www.bell-labs.com/project/nmake/tutorial/s6.html, I need to do
test: .VIRTUAL
but it doesn't work:
F:\SomePath>nmake test /f msvc.mk
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : fatal error U1073: don't know how to make '.VIRTUAL'
Stop.
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