Hi,

I'm looking for a way to put the name of the target given from the
command line into a variable.

Currently I'm using target specific variables, like this:

----
doc: TARGET = doc
clean: TARGET = clean

.PHONY: doc clean targetname
doc: targetname
        @echo doing some work   

clean: targetname
        @echo cleaning up

targetname:
        @echo Working on target: $(TARGET)
----

This is fine for two targets, but what if I have 20 or 50 targets?

Putting 50 lines like this
----
$targetname: TARGET = $targetname
----
feels really stupid.

Is there a more erlegant solution, e.g. a variable that stores the
current target name?

Regards
Michael Weise

_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to