clawpack / clawutil

General utility programs
BSD 3-Clause "New" or "Revised" License
10 stars 31 forks source link

Replacing a module in Makefile doesn't always work as expected #99

Open rjleveque opened 8 years ago

rjleveque commented 8 years ago

Another problem I discovered with the new Makefile system: if you replace a module with a local version, e.g. via:

MODULES = \
  amr_module.f90 \

where the local version has a different value of max1d, for example, and then do make new, this module will get compiled after the other modules listed in Makefile.amr_2d whereas it is supposed to be compiled first because other modules use this one.

Actually I think it's worse than that -- the other modules when compiled will use src/2d/amr_module.mod rather than the local version unless the other modules are also copied to the local directory and also added to the Makefile.

This suggests we shouldn't allow changing library modules in the Makefile in this manner, although the user could still add additional local modules that aren't replacing those in the library and that can be compiled after the library versions.

rjleveque commented 8 years ago

Moreover, when I reverted back to the original Makefile and did make new, it still used the local amr_module.mod file left over from my testing with a smaller max1d, which is very strange since the compile log shows it using the library version.

mjberger commented 8 years ago

this might explain why my i*8 recompilation didn’t work properly.

In the end i delete all *mod files - if I can find them all - and keep trying. modules still don’t work right.

— Marsha

On Feb 22, 2016, at 1:16 AM, Randall J. LeVeque notifications@github.com wrote:

Moreover, when I reverted back to the original Makefile and did make new, it still used the local amr_module.mod file left over from my testing with a smaller max1d, which is very strange since the compile log shows it using the library version.

— Reply to this email directly or view it on GitHub.

mandli commented 8 years ago

@malchera has been having issues with this as well but I am not sure he's using the new makefiles.

malchera commented 8 years ago

I am currently not able to reproduce the problem but what I do as a workaround is to delete all object files and module files within $CLAW along with a make new. rm -ffind $CLAW -regex '.*.(mod|o)$'`` The obvious drawback is that it requires me to always compile everything again, but I don't know if there's currently a better solution for that. This is also required when switching compilers, for example. I pulled the new Makefiles from the repo so that I get the changes for Makefile.common, but for my examples I am using the old files since I did change a lot.

mandli commented 8 years ago

I have been exploring options to fix this today and have made the following observations regarding modules and compilation:

I am still thinking about where this leaves us.

mandli commented 8 years ago

BTW, I noticed that there are mistakes in the Makefile.geoclaw and Makefile.amrclaw files pointing to the wrong source in some cases. I will issue PRs for the fixes.