Paul D. Smith <[EMAIL PROTECTED]> writes:
  
> How do you handle header files?
> 
>     foo.o: foo.c foo.h bar.h baz.h

Good point ;-)

> 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

That's true. One idea came into my mind: imagine we have double expansion 
in implicit rules ;-) plus we have a special variable (let's call
it $^) defined during this expansion which holds the list of prerequisites
that come from non-pattern rules. In example above it will contain 
"foo.c foo.h bar.h baz.h". Then we could write something like this:


%.o: %.c.md5 $$(addsuffix\ .md5,$$^)
        $(CC) -o $@ -c $(<:.md5=) && echo $+

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

Interestingly, after some more think I don't quite understand how my
original example works (and it does work, I tested: when I touch foo.c,
foo.o is not rebuilt). When I run it with -p I see the following expansion
of the implicit rule:

foo.o: foo.c.md5 foo.c

This means that if foo.c is touched then foo.o is out of date. It doesn't
work that way for some reason, however.

thanks,
-boris

Attachment: pgp00000.pgp
Description: PGP signature

_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to