help-make
[Top][All Lists]
Advanced

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

Re: Crazy make rules with here documents, example.


From: Mike Mestnik
Subject: Re: Crazy make rules with here documents, example.
Date: Mon, 05 Apr 2010 15:29:32 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4

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.

address@hidden 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)

address@hidden test]$ make -B
Hello World!!!
address@hidden test]$



--
Mike Mestnik
Technical Team
___
Nagios Enterprises, LLC
Email:  address@hidden
Web:    www.nagios.com




reply via email to

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