[Top][All Lists]

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

Re: non-recursive build question

From: Paul D. Smith
Subject: Re: non-recursive build question
Date: Thu, 29 Apr 2004 12:47:16 -0400

%% Boris Kolpackov <address@hidden> writes:

  bk> I thought we already can do something very close to this:

  bk> .SUFFIXES:
  bk> MAKEFLAGS += -r

  bk> foo.o: foo.c

  bk> %.o: %.c.md5
  bk>   $(CC) -o $@ -c $(<:.md5=)

  bk> %.c.md5: %.c
  bk>   @md5sum $< | cmp -s $@ -; if test $$? -ne 0; then md5sum $< > $@; fi

  bk> .PRECIOUS: %.c.md5

  bk> And it looks very similar to how automatic dependency generation works.
  bk> The advantage of this approach is that you can implement whatever out-
  bk> dateness logic one could imagine.

  bk> any comments?

How do you handle header files?

    foo.o: foo.c foo.h bar.h baz.h

There is no target for creating header files, so there's nowhere to hook
the checksum process into.

You would have to make it visible to the user, by having them write a
different name in the prerequisite list:

    foo.o: foo.c foo.h.md5 bar.h.md5 baz.h.md5

I guess if you're auto-generating the dependencies anyway that kind of
manipulation is quite easy to do and not really user-visible.  Although
it's not as foolproof as one would like (forgetting and using an explicit
filename instead of the md5 filename would lead to subtle problems where
files aren't rebuilding when they should), it's definitely something
that's doable today which is always nice!

Good stuff Boris.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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