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: Michael Morrell
Subject: Re: Function to display a command without expanding variables
Date: Fri, 5 Oct 2007 13:14:45 -0700 (PDT)

John,

My goal is to have a "nicer" verbose output.

Currently, if I have a Makefile with:

CC = gcc
CFLAGS = -DWHATEVER

foo.o: foo.c
   $(Q)$(CC) $(CFLAGS) -c $<

Then, when I call make with "Q=@", I will get just the output from the
compile, and when I call make with "Q=", I will get the output

  gcc -DWHATEVER -c foo.c

printed before the compiler output.

I want a way to have the verbose mode show me this instead:

CC = gcc
CFLAGS = -DWHATEVER
$(CC) $(CFLAGS) -c $<

before the compiler output (I'm not sure how I want to see $< handled).

That way, if I were to compare two such outputs from make with hundreds
of such compiles and where all I changed was the value of CFLAGS, I would
see just one line of difference.

Does that explain things better?

   Michael

--- John Graham-Cumming <address@hidden> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Michael Morrell wrote:
> > I'm trying to write a function that will let me display a command
> without
> > expanding the variables.
> > 
> > This way, I can write:
> > 
> > x = 1
> > y = 2
> > 
> > all:
> >      $(call show-cmd, echo $(x) $(y))
> > 
> > and have the output be:
> > 
> > echo $(x) $(y)
> > 1 2
> > 
> > That is, I want to see the command I am executing but I want it in a
> > "symbolic" form.
> 
> 
> You can't do that directly with a $(call) because $(call) expands it's
> arguments before they are passed to the function.   You could do
> something like
> 
> a = echo $(x) $(y)
> 
> and then use $(value a) to get the unexpanded string.   What are you
> actually trying to achieve?
> 
> John.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFHBpYRLphrp73n/hARArAjAKDW/DnuobFCdJQVn+ULECLxW5HuOgCgyVsC
> 9zFtnT7eoPGhgwWvpBpZeH4=
> =23Kz
> -----END PGP SIGNATURE-----
> 
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
> 



       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  




reply via email to

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