[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ifeq problem
From: |
Paul Smith |
Subject: |
Re: ifeq problem |
Date: |
Sun, 18 Dec 2011 15:27:35 -0500 |
On Sun, 2011-12-18 at 10:43 -0800, Tom Rosmond wrote:
> I am trying to run this little makefile on my Scientific Linux
> workstation:
> all:
> ifeq ($(HOST),cedar)
> @echo $(HOST)
> endif
>
> and I get this error message when running 'make':
>
> [2006]cedar /home/rosmond: make
> ifeq (cedar,cedar)
> /bin/sh: -c: line 0: syntax error near unexpected token `cedar,cedar'
> /bin/sh: -c: line 0: `ifeq (cedar,cedar)'
> make: *** [all] Error 2
>
> It seems to be trying to execute the file as a shell script. I have the
> necessary 'tab' prefixes in the lines of the 'all' rule.
That's exactly what's happening. All lines prefixed by a TAB characters
are passed to the shell. Make doesn't interpret those lines at all
except for expanding variable references; everything else is assumed to
be shell syntax and is given to the shell to run.
This is one of the most fundamental concepts in make: makefiles are a
combination of makefile syntax and shell syntax, and understanding which
syntax goes where and when it is evaluated by make, or by the shell, is
critical for being able to create correct makefiles.
Cheers!
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
- ifeq problem, Tom Rosmond, 2011/12/18
- Re: ifeq problem,
Paul Smith <=