On 4/5/2010 3:25 PM, Mike Mestnik wrote:
On 4/5/2010 2:39 PM, Mike Mestnik wrote:
Hello.
I've been fighting with getting here documents to work as part of a make
file, for example:

#!/usr/bin/make -f

LF:=%
PRELFSH:=/bin/sh -c "$$(printf '
POSTLFSH=' | tr '$(LF)' '\n')"

Here!! I got it working just great.

The issue I have with this is simple....

Escape data for make.  Obviously this is acceptable ;)
Then escape the data for shell/printf/ect. Here is the big conundrum, it's way to difficult to think about how this get's unwrapped and to debug the results.

Is there a simpler way that I'm overlooking? Obviously I'm overlooking having a make file and then several data files with out using here documents.... That's not the solution I'm looking for, I'd have to use what I have instead.

[nag...@testvm1 test]$ cat Makefile
#!/usr/bin/make -f

PRELFSH:=/bin/sh -c "$$(printf '
POSTLFSH=' | sed -e 's/\\$$//')"

.PHONY: all

all: helloworld
@./helloworld

helloworld:
@$(PRELFSH)gcc -E -o - - <<'\''EOF'\'' | gcc -x c -o helloworld - \
#include <stdio.h>\
int main( int argc, const char* argv[] ) {\
printf("Hello World!!!\\n");\
return(0);\
};\
EOF$(POSTLFSH)

[nag...@testvm1 test]$ make -B
Hello World!!!
[nag...@testvm1 test]$



--
Mike Mestnik
Technical Team
___
Nagios Enterprises, LLC
Email:  [email protected]
Web:    www.nagios.com


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to