Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS nmake equivalent of $(MAKECMDGOALS)

I'm using a (somewhat outdated) Microsoft version of nmake, which is usually packaged with visual studio 6.0. (If there's a relevant answer for newer nmake - do let me know, I might consider upgrading).

I wish to alter existing makefile, so that it would not include the dependency list if it is ran with the nmake dpndfull goal, which should build the dependency list.

With GNU make I would test if dpndfull is in MAKECMDGOALS, and if it does I wouldn't include the (maybe nonexisting) dependency list.

Any ideas how to find current make goal with nmake?

like image 351
Elazar Leibovich Avatar asked Nov 14 '22 16:11

Elazar Leibovich


1 Answers

This question has lay around for five years now and no one has touched it. So it thought an answer would be appropriate.

The answer is simple. No. There is no obvious equivalent of MAKECMDGOALS in Microsoft NMAKE. There is no way, during the execution of the makefile to discover what was supplied on the command line invoking it. There is the macro $(MAKEFLAGS) but that only shows flags and not the targets.

The only method to achieve what is asked is to make a target rule for dpndfull and then at that place use the methods for constructing dependencies. A discussion of how to build these for NMAKE can be found in the question makedepend equivalent for use with nmake?.

like image 114
Brian Tompsett - 汤莱恩 Avatar answered Nov 27 '22 15:11

Brian Tompsett - 汤莱恩