I have a Fortran program that uses modules, i.e. it creates .mod
-files during compilation.
I also wrote a Makefile
that uses all the .f90
-files from src/
puts all created .o
-files in obj/
and the binary in the current folder, and everything works fine.
I now recompile my program in different folders for different calculations (say calc1/
), i.e. I copy the Makefile
into calc1/
, type make all
in calc1/
and all it does is the linking, because the object-files already exist. However, if the program includes any modules the compiler needs the corresponding .mod
-files to be present in calc1/
. Until now, I recompiled everything (make clean all
), but with the program growing this takes too much time!
A possible solution I came up with is to have one specific folder for the binaries (bin/
). But this is not a viable option because I have jobs in the queue, which obviously need a stable binary, while I also try new features in the meantime.
So, I'm looking for a solution that somehow treats the .mod
-files similar to .o
-files, e.g. places them in obj/
.