help-make
[Top][All Lists]
Advanced

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

Extraneous text after `else' directive


From: Michael Morrell
Subject: Extraneous text after `else' directive
Date: Fri, 11 Jun 2010 19:14:39 -0700 (PDT)

Given the following Makefile:

--------------------------
ifdef FOO
    XYZ = 1
else ifeq ("$(BAR)", "abc")
    XYZ = 2
else
    XYZ = 3
endif

all:
        @echo $(XYZ)
--------------------------

It works as expected:

% FOO=a make
1
% BAR=abc make
2
% make
3

If, however, I "break" it by deleting the space after "ifeq":

--------------------------
ifdef FOO
    XYZ = 1
else ifeq("$(BAR)", "abc")
    XYZ = 2
else
    XYZ = 3
endif

all:
        @echo $(XYZ)
--------------------------

I get:

% FOO=a make
Makefile:3: Extraneous text after `else' directive
1
% BAR=abc make
Makefile:3: Extraneous text after `else' directive
2
% make
Makefile:3: Extraneous text after `else' directive
2

Two questions.

1) Is it just me, or is the manual not that clear that a space after
"ifeq" is required?

2) Is there a way to have this case cause make to fail (return an exit
status of 1)?  The note about "Extraneous text" is easy to miss in a
large Makefile output file.

Thanks,

  Michael





reply via email to

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