bug-make
[Top][All Lists]
Advanced

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

Re: GNU make to consider files checksum


From: Tim Murphy
Subject: Re: GNU make to consider files checksum
Date: Sun, 13 Apr 2008 09:35:10 +0100

Hi,

I am also not a maintainer :-).

One small concern that I have with checksums is that it might take a really long time to check large files or a lot of files.

This would indicate that one needs to be able to switch checksumming on/off for different prerequisites.

I think that there should be a way to indicate the "type" of dependency that is implied:

e.g. make already has "ORDER ONLY" dependencies  which check based on existence rather than mtime.

/tmp/out/fred.o: fred.c | /tmp/out

.... means that the directory /tmp/out must exist before one can write fred.o but if the dir is newer than fred.o then there is no need to regenerate fred.o

so for checksums one might do something like:

/tmp/out/fred.o: |cksum fred.c | /tmp/out

There are other dependency methods that matter  and one should leave room to add them later too e.g.:
1. Whitespace changes in the file only
2. Comments changed but nothing else
3. Source control system says file has not changed  so even though it was checked out and has a new mtime, don't rebuild it.

That's just my 2 pence :-)

Regards,

Tim


On 12/04/2008, Giuseppe Scrivano <address@hidden> wrote:
2008/4/12, Eli Zaretskii <address@hidden>:

> Thanks.  (I'm not the head maintainer, so please wait for Paul and
>  others to respond.)
>
>  > +int
>  > +compute_checksum(struct file *new)
>  > +{
>  > +  int checksum = 0;
>  > +  FILE *f;
>  > +  char buffer [4096];
>  > +
>  > +  f = fopen (new->name, "r");
>
>  This needs to use "rb", not "r".


Thank you for the reply, yes it should be "rb".



>  Also, what about directories? they cannot be fopen'ed and fread, at
>  least not on all supported systems.


IHMO directories should not be considered, while reading the mtime can
be done quickly, considering a checksum for all the files contained in
the directory is very expensive (in my proof-of-concept patch I didn't
put any control code).

Regards,

Giuseppe



_______________________________________________
Bug-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-make



--
You could help some brave and decent people to have access to uncensored news by making a donation at:

http://www.thezimbabwean.co.uk/
reply via email to

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