[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: best practice for serialization of dependencies of a target
From: |
Bruno Haible |
Subject: |
Re: best practice for serialization of dependencies of a target |
Date: |
Sun, 26 Jun 2022 19:26:12 +0200 |
Hi Paul,
Thanks for the review and reply!
> I'm not sure either of these are equivalent, because they will not
> build "target" if the $(DEPS1) prerequisites are older but the $(DEPS2)
> prerequisites are newer than "target".
>
> Say DEPS1 = one and DEPS2 = two, and the modification times are one <
> target < two.
>
> Now in your original, "target" will be rebuilt because "two" is newer
> than it. But in both of your replacements, "target" will not be built
> because it doesn't list DEPS2 ("two") as a prerequisite.
>
> And in fact, because "target" is not built make won't even try to build
> DEPS2, so they won't get rebuilt at all unless some DEPS1 prerequisite
> makes "target" out of date.
>
> If we assume that this doesn't matter (maybe "target" is PHONY),
Yes, in my case, 'target' is phony, so its modification time counts as
minus infinity. Thanks for catching this, that my two transformation rules
are not universal.
> then the only obvious difference to me is that in the first option, it's
> possible that the submake won't be run at all (if DEPS2 is empty) while
> in the second option you will always run a sub-make. If your makefiles
> have side-effects merely by being invoked (such as rebuilding included
> files or whatever) that could make a difference.
In my case, there are no such implicit side effects. So, other than that,
there is no behavioral difference. Thanks for that review!
Bruno