From 46fe127503ec0a07f56904fb44b5ae9aac4374a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volker=20Wei=C3=9Fmann?= Date: Mon, 20 Mar 2023 13:10:01 +0100 Subject: [PATCH] Add restat = 1 to the fortran_COMPILER rule gfortran does not update the modification time of *.mod files. Fixes #11552 --- mesonbuild/backend/ninjabackend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 258fab4d0..c3fa7e1c5 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2375,8 +2375,12 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) self.generate_cython_compile_rules(compiler) return crstr = self.get_rule_suffix(compiler.for_machine) + options = self._rsp_options(compiler) if langname == 'fortran': self.generate_fortran_dep_hack(crstr) + # gfortran does not update the modification time of *.mod files, therefore restat is needed. + # See also: https://github.com/ninja-build/ninja/pull/2275 + options['extra'] = 'restat = 1' rule = self.compiler_to_rule_name(compiler) depargs = NinjaCommandArg.list(compiler.get_dependency_gen_args('$out', '$DEPFILE'), Quoting.none) command = compiler.get_exelist() @@ -2388,7 +2392,6 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) else: deps = 'gcc' depfile = '$DEPFILE' - options = self._rsp_options(compiler) self.add_rule(NinjaRule(rule, command, args, description, **options, deps=deps, depfile=depfile))