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:25:06 -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 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.

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]