help-make
[Top][All Lists]
Advanced

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

Re: problems with 'include'


From: Justin Chen-Wells
Subject: Re: problems with 'include'
Date: Thu, 14 Nov 2002 15:09:22 -0500

To clarify this, I am using Make 3.79.1 and there is one thing
I missed below: to get it to print out "B=hello" you must do this:
 
           make include1
           rm include2
           make

Then it will pick up the generated variable in include1 and use it
to build include2. I'd like this to happen every time, without 
having to prepare things this way.

I've worked around it for now, but I'm curious to know the answer.

Justin


On Thu, Nov 14, 2002 at 11:37:03AM -0500, Justin Chen-Wells wrote:
> 
> Hi, I am having trouble using include. I am trying to get it to 
> generate two include files, but I want to use variables defined in 
> one include file as part of the build process for the other. 
> 
> It doesn't always work:
> 
>       -include include1 include2
> 
>       display:
>               @echo A=$(A)
>               @echo B=$(B)
> 
>       include1:
>               @echo "A := hello" > $@ 
> 
>       include2:
>               @echo "B := $(A)" > $@
> 
>       clean:
>               rm include1 include2
> 
> 
> So in the above I am using the value $(A) that is defined in the 
> first generated make file in the commands that generate the second.
> 
> If you run the above it will print out "B=" (empty value) indicating
> that $(A) was undefined when it executed the commands for include2.
> This would imply that you cannot use elements in an included makefile
> in the rules that generate another makefile.
> 
> However if you first run "make include1" and then you run "make"
> it will display "B=hello" because apparently in that case it DOES
> pick up and use the values. 
> 
> How can I get this to work automatically, so that you do not have to
> do a "make include1" before making other targets?
> 
> Justin
> 
> 
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make




reply via email to

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