help-gnu-utils
[Top][All Lists]
Advanced

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

Call function


From: Tim Frink
Subject: Call function
Date: Mon, 1 Jun 2009 18:13:50 +0000 (UTC)
User-agent: pan 0.119 (Karma Hunters)

Sorry, if the question about Makefiles is off-topic here but I didn't find
Makefile-specific NG.

I try to use a call function in a Makefile.

This code was up to now part of a Makefile rule:

ruleA:
       $(MAKE) ruleB

ruleB:
        if [ -f file1 ] && [ -f file2 ]; then      \
          awk '/^#/ { next } {print}' file2;       \
        else                                       \
          exit 1;                                  \
        fi;                                                     
        
This works fine.

Now I replaced this code by a call function

ruleA:
        $(call ruleB,file1)

ruleB = \
        if [ -f $(1) ] && [ -f file2 ]; then      \
          awk '/^#/ { next } {print}' file2;       \
        else                                       \
          exit 1;                                  \
        fi;                                                     
 

(so, basically just the function invocation and the function parameter
were changed.)

When "make" now runs the target "ruleA" I get the error message:

/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file

The problem seems to be the "awk" invocation. When I remove it, than
"make" works.

Any ideas what problem I have here?

Tim


reply via email to

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