Open dafyddstephenson opened 2 months ago
Is this moving forward?
I prefer a minimalist approach here with for instance different makedef.inc files for different machines. In general, I would like more communication ahead of time before pull requests are made for the ucla-roms repo.
Hi again! This PR comes from our use of ROMS on multiple machines (I think I'm up to 6 now...), each with their own idiosyncrasies. I've overhauled
Makedefs.inc
and made changes to the otherMakefile
s so that they are more flexible, without losing any of the existing functionality. The makefiles should now be machine-independent, and options can now be directly invoked without modifying the files, e.g.make COMPILER=gnu BUILD_MODE=debug
.As always, happy to incorporate any feedback.
Here's a list of what I've done:
In
Makedefs.inc
:COMPILER
(defaultintel
),MPI_DIST
(defaultgeneric
, so usempifort
),BUILD_MODE
(defaultregular
, but can be set to, .e.g.debug
),KEEP_PPSRC
(for keeping preprocessed source code after compilation, defaultfalse
).F
->.f
; this is problematic on macOS)FFLAGS
approach to settingFFLAGS
based on user optionBUILD_MODE
(e.g.debug
)COMPILER
variable (currently eithergnu
orintel
)mpifort
is wrapping the expected compiler, exit if notcppdefs.opt
(if present) to check if we need to compile with MARBL libraries. Without this change, MARBL include and lib statements are present inMakedefs.inc
even when the user does not plan to use MARBL.n{c,f}-config --args
returns an empty string, as happens on some systems (perlmutter, cheyenne)In
src/Makefile
:SRCS
list using shell instead of manually entering every.F
file; manually include or exclude additional files.F
files which seemingly did not belong to any target intosrc/other
for further evaluation (possible Legacy code)Tools-Roms/makedep.py
) ifmakedepf90
fails, as happens on some distributions with.F
files.help
targetin
Work/Makefile
:perl
instead ofsed
onadd_git_hash
, which is more consistent across distributionstools-roms
option, similarly to thenhmg
optionnhmg
option to go straight to$ROMS_ROOT/NHMG/src
and run make, as running make in$ROMS_ROOT/NHMG
was effectively just doingcd src;make
. Deleted$ROMS_ROOT/NHMG/Makefile
in
Tools-Roms/Makefile
:Makedefs.inc
. There is now a check for the presence of the-ip
flag in theFFLAGS
variable inherited fromMakedefs.inc
, and it is removed automatically if so.r2r_bry
before: make a list as a variable and provide that list to the target. This allowed for variable file extensions (as needed on case-insensitive filesystems) without cluttering the appearance of the file.in
NHMG/src/Makefile
:$sources -> $SRCS
SRCS
list automatically rather than manually listing.f90
files, as insrc/Makefile
Makedefs.inc
, no longer neededI've tested it on a few machines and it works as expected, let me know your thoughts! Thanks Dafydd