help-make
[Top][All Lists]
Advanced

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

Re: "Easy/stupid" question: How to insert nextline chars ??


From: Michael Sterrett -Mr. Bones.-
Subject: Re: "Easy/stupid" question: How to insert nextline chars ??
Date: Mon, 9 Apr 2001 13:20:30 -0400 (EDT)

On Mon, 9 Apr 2001, Paul D. Smith wrote:

> %% Peter Biechele <address@hidden> writes:
> 
>   pb> I want to get a file or variable, which contains a string in each
>   pb> line. I am using the following command:
> 
>   pb> TEST_PATHS := $(foreach dir,  \ 
>   pb> $(PROJECT_SRC_DIRS),-S$(TEST_PROJECT_TEXT)$(dir) )
> 
>   pb> TEST_PROJECT_TEXT is just a string and PROJECT_SRC_DIRS contains a
>   pb> list of directories.
> 
>   pb> The result is a list of all the strings in just ONE line without
>   pb> any linebreaks ! But I want to have a linebreak after each line
>   pb> (=string). What is the most easy way to egt this behaviour ??
> 
> Sorry, but I can't understand from your description what you're looking
> for.  An explicit example would be nice; what do you want the value of
> TEST_PATHS to be?
> 
> I don't believe there's any way to get a newline into a variable which
> is then kept as one line for shell invocation.  Offhand I can't see why
> you would want to do such a thing, anyway.
> 
> If you could explain what it is you're trying to do (I mean, why you
> want the newline there) maybe I could give you some ideas.

I'm not sure if this is what Peter is asking about, but I have a situation
where I'd like to be able to insert line feeds myself:

Consider this Makefile:
--------------------------------------CUT---------------------------------------
HFILES = \
        foo.h \
        bar.h \
        baz.h

PRODUCTION_LOCATION=/auto/include

diff:
        @$(foreach file, $(HFILES),diff $(PRODUCTION_LOCATION)/$(file) $(file);)
--------------------------------------CUT---------------------------------------

make -n diff looks like this:

diff /auto/include/foo.h foo.h; diff /auto/include/bar.h bar.h; diff 
/auto/include/baz.h baz.h;

it would be easier to read (especially for a large number of .h files if
it would look like this:

diff /auto/include/foo.h foo.h;
diff /auto/include/bar.h bar.h;
diff /auto/include/baz.h baz.h;

But I haven't been able to come up with a way to insert a line-feed into
the output.

Michael Sterrett
  -Mr. Bones.-
address@hidden




reply via email to

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