help-make
[Top][All Lists]
Advanced

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

Crazy make rules with here documents, example.


From: Mike Mestnik
Subject: Crazy make rules with here documents, example.
Date: Mon, 05 Apr 2010 14:39:47 -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

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')"

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

all: helloworld
        @helloworld


####
Hmm, well this is not working. I have several other examples that are working. This works.

gcc -E -o - - <<'EOF' | gcc -x c -o helloworld -
> #include <stdio.h>
> int main (int argc, char* argv) {
>     printf("Hello World!!n");
> }
> EOF

As does this:
#!/usr/bin/make -f

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

/etc/hosts: pkgrcs
        @echo "For NagiosXI" | ci -l /etc/hosts
        @$(PRELFSH)cat > /etc/hosts <<EOF$(LF)\
# $$I\
d$$$(LF)\
127.0.0.1 localhost $(hostname) nagiosxi$(serial)$(LF)\
::1 ip6-localhost ip6-loopback ip6-$(hostname) ip6-nagiosxi$(serial)$(LF)\
fe00::0 ip6-localnet$(LF)\
ff00::0 ip6-mcastprefix$(LF)\
ff02::1 ip6-allnodes$(LF)\
ff02::2 ip6-allrouters$(LF)\
ff02::3 ip6-allhosts$(LF)\
$(LF)\
EOF$(LF)$(POSTLFSH)
        @ci -l -m"From $(MEID) $(serial)" /etc/hosts
        @hostname $(hostname)


--
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]