Order-only targets as in GNU Make - for Microsoft NMAKE?

GNU Make allows to specify order-only targets:

Occasionally [...] you have a situation where you want to impose a specific ordering on the rules to be invoked without forcing the target to be updated if one of those rules is executed. In that case, you want to define order-only prerequisites. Order-only prerequisites can be specified by placing a pipe symbol (|) in the prerequisites list: any prerequisites to the left of the pipe symbol are normal; any prerequisites to the right are order-only:

targets : normal-prerequisites | order-only-prerequisites

Order-only prerequisites are not contained in $^; you may refer to them using $|.

I find this useful for specifying system libraries as additional dependencies for linking.

CXX      = cl
CXXFLAGS = /nologo /W4 /EHsc /MD
RC       = rc
RCFLAGS  = /nologo

# Link executables; $^ = all prerequisites; $| = order-only prerequisites
%.exe: %.obj %.res
    $(CXX) $(CXXFLAGS) /Fe$@ $^ $|

# Compile source files
%.obj: %.cpp
    $(CXX) $(CXXFLAGS) /c /Fo$@ $^

# Compile resource files
%.res: %.rc
    $(RC) $(RCFLAGS) /r /fo$@ $^

# System libraries needed for linking. Specify them as order-only prerequisites
# so their (no-op) rule being executed (due to their absence from the build
# directory) won't make the target appear out of date.
ErrorShow.exe:   | user32.lib
Singleton.exe:   | user32.lib advapi32.lib
ProcessInfo.exe: | user32.lib advapi32.lib gdi32.lib

# Set libraries as no-op targets to satisfy rule existence requirement.

Is there any way to have Microsoft NMAKE do the equivalent?


Unfortunately no, Microsoft NMAKE does not have anything like GNU make's order-only prerequisites, and given that they've long-since moved on to other build tools like MSBuild it's not likely that Microsoft will ever add such a feature.

However, ElectricAccelerator, a high-performance GNU make and NMAKE replacement from Electric Cloud, does support order-only prerequisites in NMAKE mode. You might give that a try.

(Disclaimer: I'm the architect and lead developer of ElectricAccelerator)

Need Your Help

<<module name>> not a task or void function in verilog

syntax-error verilog fork-join

I am trying to create a module for carry select adder in verilog. Everything works fine except the following portion where it is causing compilation error.

why sparkcontext stopped?

scala hadoop apache-spark

I configured spark on hadoop. spark is 1.5.2 and hadoop is 2.7.2, and I checked from jps, port 8080(hadoop) and port 8088(spark) that spark and hadoop were working well. I accessed "spark-shell --m...