help-make
[Top][All Lists]
Advanced

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

environment variable validation


From: Adam Heinz
Subject: environment variable validation
Date: Mon, 2 May 2005 14:33:55 -0700

At the beginning of each makefile, I validate my environment variables.  The
two invalid_* functions return an error message on failure, or nothing on
success.

# Validate arguments
INVALID_MODE := $(invalid_mode)
INVALID_PLAT := $(invalid_plat)

Then I add a 'valid' goal that uses these calculated values to determine
whether the environment needs to be aborted due to an invalid environment.

# Goals
all: valid
        ... the build ...

valid:
ifdef INVALID_MODE
        echo $(INVALID_MODE)
        exit 2
endif
ifdef INVALID_PLAT
        echo $(INVALID_PLAT)
        exit 2
endif

This works, but is mildly cumbersome.  Is there a way to abort make before I
make it to my first goal/target?

Adam




reply via email to

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