[Top][All Lists]

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

Re: Indirection Operators in the Command section of a makefile doesnt wo

From: Tim Murphy
Subject: Re: Indirection Operators in the Command section of a makefile doesnt work.
Date: Thu, 16 Jan 2014 14:41:54 +0000

As I understand it that's a "here document", not merely indirection.
First check that you have a tab character rather than 9 spaces before
'cat'.  Then you should get another error like this:

/bin/sh: warning: here-document at line 0 delimited by end-of-file
(wanted `EOF')

Commands in make are single lines but here-documents are multiline.
You usage creates a line like this:

cat - <<EOF ; Testing line 1 Testing line 2 EOF

those '\' characters in your makefile remove the newlines and bash
sees what I typed above.   Try that at your bash commandline - it
won't work either.

So you're trying to use a multiline shell feature in a place where
there will never be multiple lines because in a recipe, every line is
a separate bash command.

You can use .ONESHELL but that affects your entire makefile and you
might not be happy about that.

I don't know what your goal is (at the moment it seems strange to me
to use a here document in a makefile) but you might be able to replace
what you have with something like this:

LINES=""; read X; while [ $$? -eq 0 ]; do if [ "$$X" == "EOF" ]; then
break; fi; LINES="$$LINES\n$$X"; read X; done

This gives you a bash variable, LINES, which you might echo to the
terminal or whatever you want to do.  Your action has to go on the end
e.g. "; echo -e $$LINES"



reply via email to

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