|
List Info
Thread: suggestion to reduce unnecessary rebuilding
|
|
| suggestion to reduce unnecessary
rebuilding |

|
2008-04-24 14:01:38 |
I want to make a suggestion that can speed up make by
reducing
unnecessary rebuilding:
Before making a target, if that target already exists, move
it to a
temporary backup file.
After the target is re-made, diff the newly made target
against the backup.
If it didn't change, reset the date of the newly made target
to the
date of the backup.
In either case, delete the backup.
Then, if a source file is changed in an insignificant way
(e.g. by
adding comments),
that source file is still recompiled, but at least the
downstream
files that depend on it are not.
Instead of diff, for specific types of files specific
programs can be
used that can
ignore insignificant differences (e.g. zdiff for compressed
files).
ilya
_______________________________________________
Help-make mailing list
Help-make gnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
|
|
| Re: suggestion to reduce unnecessary
rebuilding |

|
2008-04-24 14:11:55 |
On Thu, 2008-04-24 at 15:01 -0400, Ilya Shlyakhter wrote:
> I want to make a suggestion that can speed up make by
reducing
> unnecessary rebuilding:
>
> Before making a target, if that target already exists,
move it to a
> temporary backup file.
> After the target is re-made, diff the newly made target
against the backup.
> If it didn't change, reset the date of the newly made
target to the
> date of the backup.
> In either case, delete the backup.
You can implement this yourself, in any makefile you like.
You don't
need make to do it for you.
> Then, if a source file is changed in an insignificant
way (e.g. by
> adding comments),
> that source file is still recompiled, but at least the
downstream
> files that depend on it are not.
The problem is, the next time you do the build it will AGAIN
rebuild
that target, AGAIN decide it hasn't changed, and AGAIN reset
the stamp
back to the old time. And, the NEXT time you run make it
will do it
again. Etc.
The result of this is if you make an innocuous change (say,
adding a
comment) to a common header file that is included by all the
source
files, make will end up rebuilding every .o every time you
type make.
_______________________________________________
Help-make mailing list
Help-make gnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
|
|
| Re: suggestion to reduce unnecessary
rebuilding |

|
2008-04-24 19:36:36 |
Paul Smith wrote:
> On Thu, 2008-04-24 at 15:01 -0400, Ilya Shlyakhter
wrote:
>
>> I want to make a suggestion that can speed up make
by reducing
>> unnecessary rebuilding:
>>
>> Before making a target, if that target already
exists, move it to a
>> temporary backup file.
>> After the target is re-made, diff the newly made
target against the backup.
>> If it didn't change, reset the date of the newly
made target to the
>> date of the backup.
>> In either case, delete the backup.
>>
>
> You can implement this yourself, in any makefile you
like. You don't
> need make to do it for you.
>
>
>> Then, if a source file is changed in an
insignificant way (e.g. by
>> adding comments),
>> that source file is still recompiled, but at least
the downstream
>> files that depend on it are not.
>>
>
> The problem is, the next time you do the build it will
AGAIN rebuild
> that target, AGAIN decide it hasn't changed, and AGAIN
reset the stamp
> back to the old time. And, the NEXT time you run make
it will do it
> again. Etc.
>
>
I can't agree more with Paul. Taht's the nature of make.
What's more, in
some situation, people touch a C file just to make some
executable/DLLs
relinked(maybe link to a just updated 3rd party library),
this time it
is more convenient to touch a C file than deleting all those
executable/DLLs.
_______________________________________________
Help-make mailing list
Help-make gnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
|
|
|
| RE: suggestion to reduce unnecessary
rebuilding |
  United Kingdom |
2008-04-25 09:01:21 |
Paul Smith wrote:
> On Thu, 2008-04-24 at 15:01 -0400, Ilya Shlyakhter
wrote:
>> I want to make a suggestion that can speed up make
by reducing
>> unnecessary rebuilding:
>>
>> Before making a target, if that target already
exists, move it to a
>> temporary backup file. After the target is re-made,
diff the newly made
>> target against the backup. If it didn't change,
reset the date of the
>> newly made target to the date of the backup. In
either case, delete the
>> backup.
>
> You can implement this yourself, in any makefile you
like. You don't
> need make to do it for you.
See the usage of "move-if-change" in
gcc/binutils makefiles, for example.
> The problem is, the next time you do the build it will
AGAIN rebuild
> that target, AGAIN decide it hasn't changed, and AGAIN
reset the stamp
> back to the old time. And, the NEXT time you run make
it will do it
> again. Etc.
>
> The result of this is if you make an innocuous change
(say, adding a
> comment) to a common header file that is included by
all the source
> files, make will end up rebuilding every .o every time
you type make.
I think that's why in practice "move-if-change"
is generally used in
conjunction with a dependency on a stamp file that /does/
get its timestamp
updated, isn't it? (Actually, I never understood what the
stampfiles were
used for before, and your explanation above has just made me
think that this
might be the reason. But I could still be completely
misleading myself about
it.)
cheers,
DaveK
--
Can't think of a witty .sigline today....
_______________________________________________
Help-make mailing list
Help-make gnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
|
|
| Re: suggestion to reduce unnecessary
rebuilding |

|
2008-04-25 09:59:23 |
>>> Before making a target, if that target already
exists, move it to a
>>> temporary backup file. After the target is
re-made, diff the newly made
>>> target against the backup. If it didn't change,
reset the date of the
>>> newly made target to the date of the backup. In
either case, delete the
>>> backup.
Last year there was a SoC project to add
non-timestamp-based
dependencies. Did that ever go in? That sounds like what
you want.
>> The result of this is if you make an innocuous
change (say, adding a
>> comment) to a common header file that is included
by all the source
>> files, make will end up rebuilding every .o every
time you type make.
Dave> I think that's why in practice
"move-if-change" is generally
Dave> used in conjunction with a dependency on a stamp
file that
Dave> /does/ get its timestamp updated, isn't it?
(Actually, I never
Dave> understood what the stampfiles were used for
before, and your
Dave> explanation above has just made me think that this
might be the
Dave> reason. But I could still be completely misleading
myself about
Dave> it.)
Yeah, this is why.
Tom
_______________________________________________
Help-make mailing list
Help-make gnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
|
|
[1-5]
|
|