help-make
[Top][All Lists]
Advanced

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

Re: (no subject)


From: Maciej Walezak
Subject: Re: (no subject)
Date: Wed, 10 Apr 2002 11:15:45 +0200

Thanks a lot. But the real problem is still not solved. The rule like this
foo.h: bar.h
tells make that foo.h depends on bar.h while it is not true.  foo.h is never 
updated from bar.h and command-to-build-packet is invoked again and again 
without any effect.
But I must to write it this way because command-to-build creates more files, 
including object files that do depend on bar.h.  I want to avoid senseless 
attempts of compilation.
I surmise the benefit of your solution is that make does not check for 
existence of all files as it knows it has created all of them on occasion of 
creating first of them -am I right?

--
Maciej Walezak

On Fri, 29 Mar 2002 10:07:19 -0500
"Paul D. Smith" <address@hidden> wrote:

> %% Maciej Walezak <address@hidden> writes:
> 
>   mw> all: foo.h foo.o sth.h sth.o junk.h ...
> 
>   mw> foo.h foo.o: bar.h junk.h sth.h bar.o junk.o sth.o
>   mw>         command-to-build-packet foo
> 
> This rule is not what you want.  Multiple targets is identical to
> writing the same rule multiple times, it does _NOT_ mean that running
> that command once will create all the targets.  In other words, the
> above command is identical to this:
> 
>   foo.h: bar.h junk.h sth.h bar.o junk.o sth.o
>       command-to-build-packet foo
>   foo.o: bar.h junk.h sth.h bar.o junk.o sth.o
>       command-to-build-packet foo
> 
> That's not what you want: you want to tell make that it only needs to
> run the rule once to build both targets.  You do that with a
> multi-target pattern rule, like this:
> 
>   %.h %.o: %
>         command-to-build-packet $*
> 
> (I don't know what the dependency should be: your rules don't seem to
> show what the command builds the packet _from_), then this:
> 
>   foo.h foo.o: bar.h junk.h sth.h bar.o junk.o sth.o
> 
> (with no command script).
> 
> -- 
> -------------------------------------------------------------------------------
>  Paul D. Smith <address@hidden>          Find some GNU make tips at:
>  http://www.gnu.org                      http://www.paulandlesley.org/gmake/
>  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make


--
Maciej Walezak
-GDN-



reply via email to

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