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 18:55:17 -0500

On Thu, Nov 14, 2002 at 03:21:41PM -0800, gk wrote:
> At 11:37 AM 11/14/2002 -0500, Justin Chen-Wells wrote:
> >How can I get this to work automatically, so that you do not have to
> >do a "make include1" before making other targets?
> 
> I think you need to tell make that include2 depends on include1:
> 
>          include2: include1
>                  @echo "B := $(A)" > $@
> 
> 
> - Greg Keraunen
> 

I tried that, it doesn't work. My script now looks like this:

        -include include1 include2

        display:
                @echo A=$(A)
                @echo B=$(B)

        include1:
                @echo "A := hello" > $@

        include2: include1
                @echo "B := $(A)" > $@

        clean:  
                rm include1 include2

In real life I've hacked it to work like this:

        include2: include1
                @echo "B := ^(A)" | tr ^ $$> $@

which winds up writing a literal $(A) to the generated file. 
This also shows my ignorance about the right way to escape $ 
in this case. I had wanted to write

                @echo "B := $$(A)" > $@

but that doesn't work, so I tricked make with the ^/tr hack.

I'd like to fix that hack, or better, fix the generated file so
that I can just use ordinary $(A) in the command to generate the
second include.

Justin





reply via email to

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