clawpack / clawutil

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

Multiple instances if -I included directories from Makefile.common - recursive call? #61

Closed rjleveque closed 10 years ago

rjleveque commented 11 years ago

Doing 'make .exe' in a geoclaw application expands the compile step to what's below, and in amclaw you also get 3 repetitions of the the amrclaw/src/2d

gfortran -c /Users/rjl/git/clawpack/geoclaw/src/2d/shallow/utility_module.f90 -J/Users/rjl/git/clawpack/geoclaw/src/2d/shallow -I/Users/rjl/git/clawpack/geoclaw/src/2d/shallow/ -I/Users/rjl/git/clawpack/amrclaw/src/2d/ -I/Users/rjl/git/clawpack/amrclaw/src/2d/ -I/Users/rjl/git/clawpack/amrclaw/src/2d/ -I/Users/rjl/git/clawpack/geoclaw/src/2d/shallow/ -I/Users/rjl/git/clawpack/geoclaw/src/2d/shallow/ -I/Users/rjl/git/clawpack/geoclaw/src/2d/shallow/ -I/Users/rjl/git/clawpack/geoclaw/src/2d/shallow/ -I/Users/rjl/git/clawpack/geoclaw/src/2d/shallow/ -I/Users/rjl/git/clawpack/geoclaw/src/2d/shallow/ -I/Users/rjl/git/clawpack/geoclaw/src/2d/shallow/ -I/Users/rjl/git/clawpack/geoclaw/tests/bowl-slosh/ -O2 -fopenmp -o /Users/rjl/git/clawpack/geoclaw/src/2d/shallow/utility_module.o

mandli commented 11 years ago

I have a simple solution to this issue at mandli/clawutil@95738d1a4c56fba15f980d80a282e219c988584f but there is one drawback, it reorders the list of paths. I am not sure if this is really a big deal since the user does not actually create this list directly. The trouble would start if someone created a module with the same name as a library module for instance. Since the include directives are followed in order this could lead to the wrong .mod file being found. I am somewhat inclined to stick with this simple solution and say you should not do that latter. Anybody have other thoughts?

The more complex solution is here if anyone is interested. The main drawback there as I see it is having to test for the version of make people are using. Many distros have moved past 3.82 with patches (3.82 by itself broke a lot of backward compatibility) but it is far from uniform (Mac OS X for example still uses 3.81).

mandli commented 11 years ago

Does anyone have any opinion on this? Otherwise I will issue a PR with the solution in mandli/clawutil@95738d1a4c56fba15f980d80a282e219c988584f.

rjleveque commented 11 years ago

I think it's fine. I just tested it with tests in amrclaw, classic, and geoclaw.

mandli commented 11 years ago

PR #64 has been issued for this.