[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU make to consider files checksum
From: |
Giuseppe Scrivano |
Subject: |
Re: GNU make to consider files checksum |
Date: |
Mon, 28 Sep 2009 20:05:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
Hi Philip,
it looks like a good idea. Do you think it worths to be discussed with
automake hackers?
Cheers,
Giuseppe
Philip Guenther <address@hidden> writes:
> On Fri, Apr 11, 2008 at 2:45 PM, Giuseppe Scrivano<address@hidden> wrote:
>> I could find on this ML archives only a thread about this subject: to
>> consider the file checksum instead of the timestamp.
>> Other systems like scons already support this feature and it would be
>> great to have it for GNU Make too.
>
> This is a long dead thread (it's been sitting in my mailbox for a
> year, ouch), but I'll throw in my two cents that a makefile can
> implement this for itself with pattern rules. Consider:
>
> ----
> %.o: %.c
> %.o.new: %.c
> $(COMPILE.c) -o $@ $<
> %.o: %.o.new
> @{ [ -f address@hidden ] && md5sum -c --status address@hidden; } ||
> \
> { md5sum $< >address@hidden; cp $< $@; }
>
> .SECONDARY:
> -----
>
> Poof, if you touch a .c file without making changes that affect the
> compiler output, the executable will not be relinked. Indeed, the
> presence of the .SECONDARY target means the only thing that will be
> rerun each time is the md5sum.
>
> Yes, this is non-trivial to use, but it's also completely flexible,
> letting you use whatever checksum comparison you want (need to strip
> comments or RCS/CVS tags from the file before checksumming it? Sure!)
> and can be used Right Now.
>
> Anyway, we now return you to your originally scheduled mailing list.
>
>
> Philip Guenther