help-make
[Top][All Lists]
Advanced

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

Re: Inserting a '\' into a pattern rule command


From: Peter Johnson
Subject: Re: Inserting a '\' into a pattern rule command
Date: Fri, 2 Nov 2007 18:06:24 -0700


On Nov 2, 2007, at 5:57 PM, Mike Shal wrote:

On 11/2/07, Martin Willers <address@hidden> wrote:
Now, from time to time I'd like to see the exact compiler command- line, for example for inspecting certain CFLAGS entries which may not be given that
obvious like in the example above.
For this, I'd need to remove the '\' character in the middle line of the pattern rule, so that the $(CC) line is not hidden behind the '@' anymore.

Another option is to remove the '@', instead (this is almost exactly
how it is specified in the Makefile for the Linux kernel) -

ifeq ($(SHOW_CMD),1)
   Q =
else
   Q = @
endif

all:
        $(Q)echo hey \
        blah blah blah...

Then the $(Q) evaluates either to '@' (meaning the commands are
hidden), or nothing (meaning the commands are displayed). In your
example this would also cause the echo itself to be displayed. If
that's really an issue for you, you can probably work around it by
wrapping your echo commands in a function (like using $(call), for
example) that can return the text its given or nothing depending on
the value of SHOW_CMD. I typically use the $(Q) construct above and
don't worry about the extra echo...maybe someone else has a better
idea :)

-Mike

You could just do it like this...

ifeq ($(SHOW_CMD),1)
  Q =
else
  Q = @
endif

all:
        @echo hey
        $(Q)blah blah blah

-Pete





reply via email to

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