summaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-01-02 16:40:08 -0800
committerDylan Baker <dylan@pnwbakers.com>2025-04-03 12:27:07 -0700
commitaa0a2a03c098de0942319addd737c8a3540b09ba (patch)
tree87493d752a7242dcf044c08eb5d3cdee09985279 /mesonbuild/backend/ninjabackend.py
parent3996272ca7eabcc9bf6efdabb9abd33727d678f9 (diff)
downloadmeson-aa0a2a03c098de0942319addd737c8a3540b09ba.tar.gz
backend/ninja: fortran must fully depend on all linked targets
Because we use this dependency to ensure that any binary module files are generated, we must have a full dependency. Otherwise, if a new module is added to a dependent target, and used in our target, we race the generation of the binary module definition.
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 2faf8c1d3..b28bec34b 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -3144,8 +3144,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
d = os.path.join(self.get_target_private_dir(target), d)
element.add_orderdep(d)
element.add_dep(pch_dep)
- for i in self.get_fortran_orderdeps(target, compiler):
- element.add_orderdep(i)
+ for i in self.get_fortran_module_deps(target, compiler):
+ element.add_dep(i)
if dep_file:
element.add_item('DEPFILE', dep_file)
if compiler.get_language() == 'cuda':
@@ -3212,10 +3212,12 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
# Fortran is a bit weird (again). When you link against a library, just compiling a source file
# requires the mod files that are output when single files are built. To do this right we would need to
# scan all inputs and write out explicit deps for each file. That is too slow and too much effort so
- # instead just have an ordered dependency on the library. This ensures all required mod files are created.
+ # instead just have a full dependency on the library. This ensures all required mod files are created.
# The real deps are then detected via dep file generation from the compiler. This breaks on compilers that
- # produce incorrect dep files but such is life.
- def get_fortran_orderdeps(self, target, compiler):
+ # produce incorrect dep files but such is life. A full dependency is
+ # required to ensure that if a new module is added to an existing file that
+ # we correctly rebuild.
+ def get_fortran_module_deps(self, target, compiler) -> T.List[str]:
if compiler.language != 'fortran':
return []
return [