On Fri, Apr 11, 2008 at 2:45 PM, Giuseppe Scrivano<gscriv...@gnu.org> 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 $...@.md5 ] && md5sum -c --status $...@.md5; } ||     \
        { md5sum $< >$...@.md5; 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


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

Reply via email to