Michael Morrell
2010-06-12 02:14:39 UTC
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
--------------------------
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