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

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

Makefile 'abort' command? / 'elseif' to go with ifeq/else/endif? (Make n


From: LiquidEyes
Subject: Makefile 'abort' command? / 'elseif' to go with ifeq/else/endif? (Make newbie)
Date: Sun, 21 Jan 2007 22:05:45 -0000

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




reply via email to

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