make-w32
[Top][All Lists]
Advanced

[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 16:59:00 -0700

Point taken.  I trust your word* that newlines cannot live in make variables so
will try a non make approach.

And now for something completely different...what was the canonical method of
aborting make before $(error) and $(warning) were added circa 3.78?

Bryan

[*] Well I'll probably test it sometime this weekend anyway (Trust but verify -
Deep Throat).



> -----Original Message-----
> From: Paul D. Smith [mailto:address@hidden Behalf
> Of Paul D.
> Smith
> Sent: Friday, April 26, 2002 11:20 AM
> To: address@hidden
> Cc: address@hidden
> Subject: RE: $(shell) strips CRLF
>
>
> %% "Bryan Miller" <address@hidden> writes:
>
>   bm> I am successfully using CONFIG_SPEC so I don't know how you can
>   bm> say that I cannot _USE_ it for anything.  I AM using it and it
>   bm> works wonderfully (sheesh I hate yelling).  The only caveat is
>   bm> that when this embedded binary runs and is asked for debugging
>   bm> information the config spec comes out in one
> non-delimited (hence
>   bm> unreadable) line.
>
> This is not what I said at all.
>
> I said you cannot use a make variable with embedded newlines for
> anything.
>
> Since, as you say, you can't figure out how to create one there is no
> way that you can be using it now and having it work wonderfully.
>
>   bm> In a nutshell CONFIG_SPEC is added to a list of DEFINES for the
>   bm> compilation of one file that contains something like:
>
>   bm> const char *c_spec = CONFIG_SPEC;
>
> This is not a make variable, this is a C variable (or #define).
>
> How is this file created?
>
> It's created by some make rule.
>
> How does the make rule work?
>
> It works by writing the contents of a make variable to the file.
>
> What I'm saying is that this rule that writes the contents of the make
> variable to the file cannot work if the variable contained newlines.
>
>   bm> Obviously I would strip the newlines out of
> $(CONFIG_SPEC) once I
>   bm> have captured it and replaced them with some other
> character for a
>   bm> delimiter so that the config spec could be sprintf'd out.  The
>   bm> issue is that since the newlines are already gone I
> cannot replace
>   bm> them with anything.  char(20) is not a terribly useful delimiter
>   bm> at this point.
>
> Aha!!
>
> First, how do you think you will replace a newline with some other
> character in a make variable using make operations? ;) [*]
>
> So, you don't _really_ want a make variable that contains newlines at
> all.  What you want is a make variable that contains the config spec
> with the newlines replaced with some other delimiter character so you
> can write it out.
>
> Well, that's not hard, just do it in the $(shell ...) instead, so that
> the results of the shell command is the proper output with the
> appropriate characters already replaced.
>
>
> -----
> [*] Actually I think this might be possible, but it's very tricky.
>
> --
> --------------------------------------------------------------
> -----------------
>  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]