[Top][All Lists]

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

Re: problems with 'include'

From: Patrick Wildenborg
Subject: Re: problems with 'include'
Date: Wed, 20 Nov 2002 21:58:12 +0100

  jc> Hi, I am having trouble using include. I am trying to get it to
  jc> generate two include files, but I want to use variables defined in
  jc> one include file as part of the build process for the other.
  jc> It doesn't always work:
  jc>   -include include1 include2
  jc>   display:
  jc>           @echo A=$(A)
  jc>           @echo B=$(B)
  jc>   include1:
  jc>           @echo "A := hello" > $@ 
  jc>   include2:
  jc>           @echo "B := $(A)" > $@

>From experience with v3.80 of GnuMake, I came to the conclusion that
the files listed behind an include directive are processed in opposite order
(last one first). Although I haven't seen this fact documented anywhere.

This could cause your problem, since order of evaluation is important 
when using ':=' variable assignments.

Thus you could change your first line into:
        -include include2 include1

That should do the trick..
Talking about the include directive, Is the following "creative" use of
common practice?

-include $(if $(MAKDIR), $(MAKDIR)/makerules.mak, $(error MAKDIR is not

where MAKDIR is an environment variable that shouls be supplied by the shell


Patrick Wildenborg,
The Netherlands

reply via email to

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