help-make
[Top][All Lists]
Advanced

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

Re: Change behaviour of a multiple target rule


From: Noel David Torres Taño
Subject: Re: Change behaviour of a multiple target rule
Date: Wed, 8 Sep 2010 12:55:20 +0100
User-agent: KMail/1.13.5 (Linux/2.6.32-5-amd64; KDE/4.4.5; x86_64; ; )

On Miércoles 08 Septiembre 2010 12:06:33 Gerald Lutter escribió:
> Hello List,
> 
> I'm using make (3.81) from cygwin and I encountered the following "problem"
> with a rule that looks like this:
> 
> $(targetlist): $(sourcelist)
>       do something that generates $(targetlist) from $(sourcelist)
> 
> Now in my case the receipe is executed several times (number of entries
> inside the target list). I think this depends on the evaluation of multiple
> target rules described inside the gnu make manual. But the receipe builds
> all three files together and therefore the command does not have to be
> executed more than one time.
> 
> My question is now, is there a possibility to change this behaviour or do I
> have to reduce the number of targets to prevent this?

You can use a control file like this:

$(targetlist) : controlfile

controlfile : $(sourcelist)
        do something that generates $(targetlist) from $(sourcelist)
        touch controlfile

That way, the 'something' is invoked only once, and all files in $(targetlist) 
are marked as up-to-date later, as controlfile is

Hope this helps

Noel
er Envite

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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