build: fix updated mod files not triggering recompiles#968
Open
VincentVanlaer wants to merge 1 commit intomainfrom
Open
build: fix updated mod files not triggering recompiles#968VincentVanlaer wants to merge 1 commit intomainfrom
VincentVanlaer wants to merge 1 commit intomainfrom
Conversation
make treats rules with no recipe different from rules with an empty recipe. The absence of a recipe conveys purely a dependency for the target. If however, there is no other recipe that actually updates the target, then make will not consider the target to be remade even if the dependencies have changed. Hence, any dependents of the target will not need to be remade according to make. The empty recipe fixes this, as make will consider the target to have a recipe, and thus will cause its dependents to also be remade. Consider the following example (we use these type of dependency trees with ".anc" targets to handle fortran files producing multiple module files): ```make a.anc: a.f90 ... build commands ... a.mod: a.anc b.anc: b.f90 a.mod ... build commands ... b.mod: b.anc ``` If `a.f90` gets updated with a change that also updates `a.mod` (for example, by changing something from `private` to `public`), it is necessary to also recompile `b.f90`. However, make does the following: 1. Remake `a.anc` by executing the build comments 2. Consider `a.mod` out of date 3. No recipe for `a.mod`, consider it remade, but do not consider its timestamp updated 4. Consider `b.anc` to be up-to-date as neither `b.f90` nor `a.mod` have a timestamp newer than `b.anc` from make points of view, even though `a.mod` has a newer timestamp in reality. By changing `a.mod: a.anc` to `a.mod: a.anc ;`, we now have recipe to remake `a.mod` (even though it doesn't do anything), make considers `a.mod` to be updated, and finally will remake `b.anc`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
make treats rules with no recipe different from rules with an empty recipe. The absence of a recipe conveys purely a dependency for the target. If however, there is no other recipe that actually updates the target, then make will not consider the target to be remade even if the dependencies have changed. Hence, any dependents of the target will not need to be remade according to make. The empty recipe fixes this, as make will consider the target to have a recipe, and thus will cause its dependents to also be remade.
Consider the following example (we use these type of dependency trees with ".anc" targets to handle fortran files producing multiple module files):
If
a.f90gets updated with a change that also updatesa.mod(for example, by changing something fromprivatetopublic), it is necessary to also recompileb.f90. However, make does the following:a.ancby executing the build commentsa.modout of datea.mod, consider it remade, but do not consider its timestamp updatedb.ancto be up-to-date as neitherb.f90nora.modhave a timestamp newer thanb.ancfrom make points of view, even thougha.modhas a newer timestamp in reality.By changing
a.mod: a.anctoa.mod: a.anc ;, we now have recipe to remakea.mod(even though it doesn't do anything), make considersa.modto be updated, and finally will remakeb.anc.