help-make
[Top][All Lists]
Advanced

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

RE: Here Documents in commands


From: Peter Ring
Subject: RE: Here Documents in commands
Date: Fri, 29 Nov 2002 10:31:43 +0100

Also read up on 'Command Execution'. If you want to avoid that each command
is executed by a new shell, try this

%.foo : %.bar:
   baz $*.spam ; spam $*.eggs > $@

or

%.foo : %.bar:
   baz $*.spam && spam $*.eggs > $@

I sometime need the makefile to create intermediate scripts; here's a simple
way
to do that:

%.foo : %.bar:
   ( echo "baz $*.spam" ; echo "spam $*.eggs" > $@

kind regards
Peter Ring

-----Original Message-----
From: address@hidden [mailto:address@hidden Behalf
Of Peter Ring
Sent: 29. november 2002 10:14
To: Jens Schweikhardt; address@hidden
Subject: RE: Here Documents in commands


Read up on 'Defining Variables Verbatim', the define directive. Using
define, you can assign a multi-line value to a variable. This multi-line
variable can of course contain references to variables that will get
expanded when you reference the multi-line variable. Bingo, you've got a
multi-line template.

Kind regards
Peter Ring



-----Original Message-----
From: address@hidden [mailto:address@hidden Behalf
Of Jens Schweikhardt
Sent: 28. november 2002 20:36
To: address@hidden
Subject: Here Documents in commands


hello, world\n

I've been thinking long and deep and even made a few attempts at using
shell "here documents" in the commands for a rule. My conclusion is that
it is impossible, at least with a POSIX shell. Make's command execution
with sh is inherently line oriented, while here documents are multi-line
by definition. Continuing lines in the Makefile with backslash newline
can't work because the shell only sees the resulting single line.

In the remote event that I have overlooked something, does anyone
know a way how to get something like

        cat << EOF
        foo
        bar
        EOF

in a rule?

PS: Yes, I can get the same effect with a fews echos. Consider it a
    proof-of-concept question.

Regards,

        Jens
--
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)


_______________________________________________
Help-make mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-make



_______________________________________________
Help-make mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-make





reply via email to

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