In a Makefile, is it possible to have a target be out of date iff another target is out of date?
===

I want to write a rule that looks something like this:

    foo.out: (out of date if foo.in is newer than foo.out.stamp)
        # update foo.out if and only if the new foo.out has different contents
        # than the old foo.out (a change to foo.in may or may not change foo.out)
        && touch foo.out.stamp

I can't do this:

    foo.out.stamp: foo.in
        # update foo.out if and only if the new foo.out has different contents
        # than the old foo.out (a change to foo.in may or may not change foo.out)
        && touch foo.out.stamp

    foo.out: foo.out.stamp

Because if `foo.in` changes, but the recipe for `foo.out.stamp` does not change `foo.out`, `make` will always view `foo.out` as out of date.

Is there any way to write this kind of rule?