help-make
[Top][All Lists]
Advanced

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

Checking that required variables have been set


From: ekurgpold
Subject: Checking that required variables have been set
Date: Wed, 25 Jun 2008 12:03:40 -0700 (PDT)

I'm including a file at the beginning of my Makefile that will just have
lines like:

SOMETHING=123
SOMETHING_ELSE=hello

In the Makefile, I then have this:

ifndef SOMETHING
missing += SOMETHING
endif

Then ${missing} has all the missing variables which can be echoed to the
user. But then I need to have this ifndef... section for every variable and
it's difficult to maintain and read. I've tried a number of things,
including the following:

required = SOMETHING SOMETHING_ELSE

define CHECKIT
ifeq ($$($(strip $(1))),)
        echo $(1)
endif
endef

missing = $(foreach var,$(required),$(call CHECKIT,$(var)))

I'm using GNU make 3.81, but I'll need something that's fairly portable. Any
ideas?  Thanks in advance...
-- 
View this message in context: 
http://www.nabble.com/Checking-that-required-variables-have-been-set-tp18119651p18119651.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.





reply via email to

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