On Thu, 10 Oct 2013 07:41:18 -0400
Paul Smith <[email protected]> wrote:

> On Thu, 2013-10-10 at 12:15 +0200, Michael Weise wrote:
> > Is there a more erlegant solution, e.g. a variable that stores the
> > current target name?
> 
> Please look up "Automatic Variables" in the GNU make manual.

I've looked up "Automatic Variables" and other parts of the manual,
used google, etc.

> You want the $@ variable.

No, I dont.


Please have a look at my Makefile ...:
----
doc: TARGET = doc
clean: TARGET = clean

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

clean: targetname
        @echo cleaning up

targetname:
        @echo What I want is: $(TARGET), not $@
----

... and the output:

----
$ make doc
What I want is: doc, not targetname
doing some work

$ make clean
What I want is: clean, not targetname
cleaning up
----

I want the name of the "main" target from the command line, not the
one of some prerequisite.

Regards
Michael

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

Reply via email to