help-make
[Top][All Lists]
Advanced

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

Re: need help with the Makefile


From: John Graham-Cumming
Subject: Re: need help with the Makefile
Date: Fri, 09 Sep 2005 13:47:31 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

address@hidden wrote:
a. should I ask user to pass some env variable such as KVER=2.4 or KVER=2.6 at 
the make command line and then check the $(KVER) and setup the flags 
accordingly.

Well that's one way to do it, if you can't do autodetection of the version that you are trying to build.

Also is it possible to check for empty variable and exist with some error msg 
like following

check_ver:
        ifeq ($(strip $(KVER)),)
          @echo "Error: Please set KVER"
        Endif

That's not going to work because you've got a tab before ifeq and endif which means GNU Make is going to pass them to the shell and those are internal GNU Make preprocessor commands.

My recommendation is not to do the checking of KVER in a rule (because that rule might never get run). Instead just check KVER in the Makefile at the start and using $(error) to output the message.

ifeq ($(strip $(KVER)),)
$(error Please set KVER before running Make)
endif

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
POPFile: http://getpopfile.org/

Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/




reply via email to

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