Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all .mod files with make new #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rjleveque
Copy link
Member

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 as amrclaw/src/2d was not removed if the user had a custom version of the *_module.f90 file in a different directory, and make new would still use the old version when compiling other library routines that use 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.

Determine all directories containing source files and remove any .mod files
from these directories to avoid using old versions.
Copy link
Member

@mandli mandli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So these new lists catch all .mod files present in any source directory but does not remove the corresponding .o file? Could this lead to some issues when a .mod file is deleted and an .o still exists?

@rjleveque
Copy link
Member Author

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.

@mandli
Copy link
Member

mandli commented Dec 31, 2019

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.

@rjleveque
Copy link
Member Author

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!!

@mandli
Copy link
Member

mandli commented Jan 1, 2020

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?

@rjleveque
Copy link
Member Author

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.

@mandli
Copy link
Member

mandli commented Jan 1, 2020

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.

@rjleveque
Copy link
Member Author

This isn't urgent so let's hold off on merging for now and discuss some more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants