Hi,

I'm new to Makefiles and I've given myself a crash course in GNU Make. I 
have a few quick questions, which I haven't been able to answer by reading 
the manual or by asking Google... apologies if this is basic stuff:

1. Is there an 'elseif' statement? (To go with ifeq/else/endif.)

It's incredibly tedious nesting additional ifeq/else/endifs inside the else 
statement. I've seen a few sites on the web mentioning 'elif', but it 
doesn't seem to work so I'm guessing it's a different version of Make.

2. Is there a way to abort Make prematurely? (The equivalent of #error in 
C.)
Here's an example of the kind of thing I want to do:

###############################################
.PHONY: all
.PHONY: check_compiler

# all: check that the elected compiler is valid, then build.
all: check_compiler $(TARGET_EXE_FILE)
 @echo Done.

check_compiler:
ifneq ($(COMPILERSUPPORTED),yes)
 @echo Compiler '$(COMPILERNAME)' not supported.
 # I want to abort here instead of proceeding with the build!
else
 @echo Building with $(COMPILERNAME)...
endif
###############################################

The only thing I can think of is to deliberately call a system command that 
I know will return an error... but that seems a bit of a fudge.

Thanks in advance!
Andy


_______________________________________________
help-gnu-utils mailing list
help-gnu-utils@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Reply via email to