[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: $(shell) strips CRLF
From: |
Bryan Miller |
Subject: |
RE: $(shell) strips CRLF |
Date: |
Fri, 26 Apr 2002 08:58:49 -0700 |
I'm sorry. I am not asking how to solve an engineering problem. I am quite
capable of that on my own :-) I just wanted to know if I was missing an
alternate method of doing what I was attempting to do from Make; get something
from the OS w/o mucking with the formatting.
Cheers,
Bryan
P.S. Paul, to resolve your curiousity - the developers were using variables
from
make to instantiate C data structures in a header file during compilation (build
label, userid, ClearCase region, etc). The config spec was a quick addition on
my part that failed only because of the newline issue. My goal was not to
re-engineer their entire solution. Simply to enhance it. Believe me, if I had
designed this thing from scratch it would not have been my approach. :-(
HTH...
> -----Original Message-----
> From: Paul D. Smith [mailto:address@hidden Behalf
> Of Paul D.
> Smith
> Sent: Friday, April 26, 2002 6:22 AM
> To: address@hidden
> Cc: address@hidden
> Subject: RE: $(shell) strips CRLF
>
>
> %% "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
- $(shell) strips CRLF, Bryan Miller, 2002/04/25
- Re: $(shell) strips CRLF, Eli Zaretskii, 2002/04/26
- RE: $(shell) strips CRLF, Bryan Miller, 2002/04/26
- RE: $(shell) strips CRLF, Paul D. Smith, 2002/04/26
- RE: $(shell) strips CRLF, Bryan Miller, 2002/04/26
- RE: $(shell) strips CRLF, Paul D. Smith, 2002/04/26
- RE: $(shell) strips CRLF, Bryan Miller, 2002/04/26
- RE: $(shell) strips CRLF, Paul D. Smith, 2002/04/26
- RE: Exiting make upon error..., Bryan Miller, 2002/04/27
- Re: $(shell) strips CRLF, Eli Zaretskii, 2002/04/28