Open rjleveque opened 4 years ago
Good question. In my tests it seemed to recompile as long as .mod
was removed. It would be cleaner to also remove all the corresponding .o files, but currently it just removes *.mod
and unless we also want to remove *.o
it would take a bit more work to construct the list, I think.
I think we still only to check to see if the .o
file is present to see if it should be recompiled. If the .o
file is there and the .mod
is not it may lead to errors. That being said, if this is in a new command it won't be an issue as long as the paths are correct. Maybe though it would be best to remove both the .o
files and .mod
files.
Here's a version that removes all *_module.mod
and *_module.o
files, which should work for our library modules since we have the convention of naming them *_module.f90
.
There's another line commented out that I couldn't get to work, using subst
. If you try it with make debug_new
you will see that it wants to remove *
from any source directory that doesn't have any modules, so test with extreme care!!
Oh, that is a bit scary. Probably why many call to the shell to do regular expression type stuff. Maybe we should put that warning in there just in case?
We should just remove that version that is commented out -- I left it there in case you knew how to fix it.
If there's a way to call to the shell and return the files identified by *_module.o
that might be good to do in place of having the wildcard in the Makefile since it seems possibly dangerous.
There are a few places that we could do this. There was a PR that had a python script that had some of these utilities. I might suggest that we raise an issue to do this but merge this in the mean time.
This isn't urgent so let's hold off on merging for now and discuss some more.
Determine all directories containing source files and remove any .mod files from these directories to avoid using old versions.
Previously a
.mod
file in a library such asamrclaw/src/2d
was not removed if the user had a custom version of the*_module.f90
file in a different directory, andmake new
would still use the old version when compiling other library routines thatuse
the module.I think this may eliminate some frustrations we've had with modules.
The
debug_new
target is useful for testing, but could be removed before merging to clean this up.