aboutsummaryrefslogtreecommitdiff
path: root/ninjabackend.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-08-23 20:07:21 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-08-23 20:17:37 +0300
commit5467b7d58b310c3dab975ea924de4e28fec884fc (patch)
treea32c9bfbf029ca852121be587a9f70ba21985fe1 /ninjabackend.py
parent7c6e99149bc742ba0e98521907a690a526bb894c (diff)
downloadmeson-5467b7d58b310c3dab975ea924de4e28fec884fc.zip
meson-5467b7d58b310c3dab975ea924de4e28fec884fc.tar.gz
meson-5467b7d58b310c3dab975ea924de4e28fec884fc.tar.bz2
Made Fortran static libraries work. Closes #237.
Diffstat (limited to 'ninjabackend.py')
-rw-r--r--ninjabackend.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ninjabackend.py b/ninjabackend.py
index 6f10e38..b0419de 100644
--- a/ninjabackend.py
+++ b/ninjabackend.py
@@ -1225,11 +1225,24 @@ rule FORTRAN_DEP_HACK
element.add_orderdep(d)
element.add_orderdep(pch_dep)
element.add_orderdep(extra_orderdeps)
+ for i in self.get_fortran_orderdeps(target, compiler):
+ element.add_orderdep(i)
element.add_item('DEPFILE', dep_file)
element.add_item('ARGS', commands)
element.write(outfile)
return rel_obj
+ # 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 stoo slow and too much effort so
+ # instead just have an ordered dependendy on the library. This ensures all reqquired 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):
+ if compiler.language != 'fortran':
+ return []
+ return [os.path.join(lt.subdir, lt.filename) for lt in target.link_targets]
+
def generate_msvc_pch_command(self, target, compiler, pch):
if len(pch) != 2:
raise RuntimeError('MSVC requires one header and one source to produce precompiled headers.')