Hi john, I need to detect target platform as one can build the driver for linux 2.6 on linux 2.4 kernel OS.
Checking empty variable is working fine and I will put it outside the rule. % cat t1.mak ifeq ($(strip $(ARCH)),) $(error Error: Please set ARCH before running Make) endif % make -f t1.mak t1.mak:2: *** Error: Please set ARCH before running Make. Stop. Is there any way to suppress the makefile name in the error output. I would like to just output as error. "Error: Please set ARCH before running Make." I think for all other target platform version checkings, I will need to use shell functions. Thanks .. -- Raviraj Murdeshwar. 408.553.4318 > -----Original Message----- > From: John Graham-Cumming [mailto:[EMAIL PROTECTED] > Sent: Friday, September 09, 2005 4:48 AM > To: [email protected] > Cc: [EMAIL PROTECTED] > Subject: Re: need help with the Makefile > > [EMAIL PROTECTED] 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 > [EMAIL PROTECTED] > > Home: http://www.jgc.org/ > POPFile: http://getpopfile.org/ > > Sign up for my Spam and Anti-spam Newsletter > at http://www.jgc.org/ _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
