[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about Generating Prerequisites Automatically
From: |
Lin George |
Subject: |
Re: question about Generating Prerequisites Automatically |
Date: |
Mon, 8 May 2006 00:09:26 -0700 (PDT) |
Thanks Paul,
Why in the sample you made, when bar.o is deleted,
then it will not be remade when we make prog again? I
think the target prog needs bar.o and bar.o does not
exist -- so it should be remade. Any rules mentioned
in GNU make manual prevents it from being remade?
regards,
George
--- "Paul D. Smith" <address@hidden> wrote:
> %% Lin George <address@hidden> writes:
>
> lg> Another comment is that, I think the way how
> make deals with
> lg> intermediate files is smarter than the way
> dealing with ordinary
> lg> files -- by saving time of remaking
> unnecessary files. So, why
> lg> make does not change the way dealing with
> ordinary file to the
> lg> (smarter) way dealing with the intermediate
> file?
>
> Very simple: it often is not at all what you want.
>
> Consider what happens:
>
> prog: foo.o bar.o
>
> .INTERMEDIATE: foo.o bar.o
>
> Now, we run make:
>
> cc -o foo.o -c foo.c
> cc -o bar.o -c bar.c
> cc -o prog foo.o bar.o
>
> Since there's no "prog" everything is out of date.
> So far so good.
> Now, we delete bar.o... uh oh!
>
> cc -o prog foo.o bar.o
> cc: no such file or directory: bar.o
>
>
> Intermediate files ONLY work with targets that can
> be _incrementally
> built_, or which are built from only one source.
> Things like libraries,
> where the "ar" program can add new objects to an
> archive without
> recreating it from scratch, are good examples of
> this. Or, copying
> files from a staging area into a production area,
> where each file is
> managed individually.
>
>
> If the target needs all the prerequisites to exist
> at once, like a
> linker, then intermediate files don't work.
>
> --
>
-------------------------------------------------------------------------------
> Paul D. Smith <address@hidden> Find some
> GNU make tips at:
> http://www.gnu.org
> http://make.paulandlesley.org
> "Please remain calm...I may be mad, but I am a
> professional." --Mad Scientist
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/03
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/03
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/03
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/03
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/04
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/04
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/07
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/07
- Re: question about Generating Prerequisites Automatically,
Lin George <=
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/08
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/09
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/10
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/11
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/11
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/11
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/11
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/11
- Re: question about Generating Prerequisites Automatically, Paul D. Smith, 2006/05/11
- Re: question about Generating Prerequisites Automatically, Lin George, 2006/05/13