Is this possible at all and how?
Update: I need this because I create a file both from dynamic and static data.
Use case:
It depends on how determined you are. It is best to assume it won't work. Write a shell script to be launched instead of a here document in the makefile.
heredoc:
cat - <
This produces:
cat - <
Each line is executed separately - oops.
heredoc:
cat - <
This generated:
cat: This: No such file or directory
cat: is: No such file or directory
cat: the: No such file or directory
cat: heredoc.!: No such file or directory
make: *** [heredoc] Error 1
There may be methods using a specific version of make (GNU make, for example, can execute all commands for an action in a single subshell, I believe), but then you have to specify your portability requirements. For regular (say POSIX-compliant) make, assume here docs do not work.