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

Re: makefile mysteries



On Sat, 8 Sep 2001, mulix wrote:

> hi guys,
>
> even though today was declared to be a 'non syscalltrack day', a
> Makefile bug bit apparitio and seemed "simple enough to fix".
> these words are, in case you dont know, high on the list of famous last
> words.
>
> we want to check if an environemnt variable is set, and if not, die.
> simple, eh? not. if i do the obvious
>
> ifeq ($(string $(KERNEL_DIR)),)
> 	@echo bla bla
> 	@exit 1
> endif
>
> at the top of the Makefile, make complains loudly about "*** commands
> commence before first target.Stop.". there must be some simple
> solution to this (adding a phony target?), but i couldnt find it. for
> now, i implemented an extra level of indirection, but it's pretty ugly.
> help?

Makefiles only execute commands within makefile commands (that are part of
rules).

In the make info file I see a reference to the function '$(error TEXT...)'

>
> my solution (snipped off irrelevant stuff)
>
> # Makefile for syscalltrack_modules.
> # (loosely based on the examples in rubini's device drivers book)
>
> ifeq($(strip $(KERNEL_DIR)), )
> 	NO_KERNEL = 1

maybe you should set here the default to some sane default (perhaps
'/usr/src/linux')

-- 
Tzafrir Cohen
mailto:tzafrir@technion.ac.il
http://www.technion.ac.il/~tzafrir



=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il