make-w32
[Top][All Lists]
Advanced

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

RE: $(shell) strips CRLF


From: Paul D. Smith
Subject: RE: $(shell) strips CRLF
Date: Fri, 26 Apr 2002 09:22:02 -0400

%% "Bryan Miller" <address@hidden> writes:

  bm> Well it was a quick-n-dirty way to get a config_spec into a C data
  bm> structure.

  bm> CONFIG_SPEC := $(shell cleartool catcs)

  bm> for some developers that wanted to be able to dump diagnostic info
  bm> from a serial port during remote field testing.  It's hard to read
  bm> a cspec as one line continuous line :-(

But my question is, what are you going to _do_ with this variable?  I
mean, just having that data internal to make is not helping anyone.
Obviously you want to use the variable in some command or target or
dependency or something.

The problem is you _can't_ use it if it contains newlines; consider
something simple like:

  all:
        echo "$(CONFIG_SPEC)"

Well, if CONFIG_SPEC contains newlines then make will break it into
multiple lines; suppose your config spec was:

  element * CHECKEDOUT
  element * /main/LATEST

Then after the above command was expanded make would have two lines:

  echo "element * CHECKEDOUT
  element * /MAIN/LATEST"

These are treated as two different command lines, so make would invoke
two shells: the first with the first line and the second with the second
line.

Obviously this cannot work.


So, I repeat my question: what do you want to _do_ with the variable?
Often people get locked into an idea and ask questions about how to use
some specific thing without giving any indication of the bigger picture:
what they are actually trying to accomplish.  Without that bigger
picture all we can say is "no, you can't do that".  _With_ an
understanding of what you are really looking for, at a higher level, we
can often show you a better way to do it.

Hope we can help!

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist



reply via email to

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