help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function to display a command without expanding variables


From: John Graham-Cumming
Subject: Re: Function to display a command without expanding variables
Date: Sat, 06 Oct 2007 14:52:28 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Morrell wrote:
> My goal is to have a "nicer" verbose output.

One way to do this is as follows (I'm assuming GNU Make 3.81 here
because I use $(info)):

    do = $Q$(info $(value $_))$(info $_)$_

And here's an example.  Start with this:

    FOO = foo

    foo:
        $Qtouch $(FOO)

and transform it into:

    do = $Q$(info $(value 1))$(eval _ := $1)$_

    FOO = foo

    foo:
        $(call do,touch $$(FOO))

Note the double $ on the $(FOO).  I've kept your $Q (which will control
whether the expanded command if echoed or not).

If you've not come across my monthly GNU Make column you might like to
have a read as there are lots of useful tips:
http://www.cmcrossroads.com/articles/ask-mr.-make.html

John.



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHB4UMLphrp73n/hARApEKAKCeloNMPTJzoA/iSqtHGCOO+2m6pgCfZ6+c
dP3g2+Ph6AlBh+aNShUR0cM=
=zeGJ
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]