Skip to content

Commit

Permalink
Case insensitive F90 compile rule (wrf-model#2057)
Browse files Browse the repository at this point in the history
The .F90 source files in physics_mmm need to be compiled directly to .o
on case-insensitive file systems (like MacOS standard FS). This PR
avoids the creation of a .f90 temporary, which will clobber the .F90
version.

TYPE: [bug fix]

KEYWORDS: case-insensitive filesystem

SOURCE:  "Ted Mansell (NOAA/NSSL)"

DESCRIPTION OF CHANGES:
Problem:
1. On case-insensitive file systems (like MacOS standard FS), the
creation of .f90 temporary files from .F90 source will clobber the
source files.
2. The configure.defaults has an unrecognized option for Apple clang

Solution:
1. In postamble: Removed the .F90.f90 rule and compacted the .F90.o rule
to use only the fortran compiler to do any necessary preprocessing. It
is convention among fortran compilers that .F90 will be preprocessed.
2. In configure.defaults: For Darwin compile with ifort+clang, removed
the -qopenmp from OMPCC (Apple clang does not support OpenMP)

ISSUE: Addresses .F90.f90 issue raised in
wrf-model#1989

LIST OF MODIFIED FILES: 
arch/postamble
arch/configure.defaults

TESTS CONDUCTED: 
1. Compiles correctly on MacOS (Intel CPU with ifort + clang) and Linux
2. Are the Jenkins tests all passing? Yes.

RELEASE NOTE: Fixed a compile problem with .F90 source files on
case-insensitive file systems.
  • Loading branch information
MicroTed authored Oct 11, 2024
1 parent d810865 commit 6e71a0a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions arch/postamble
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ wrfio_esmf :
$(RM) $@
sed -e "s/^\!.*'.*//" -e "s/^ *\!.*'.*//" $*.F90 > $*.G
$(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $(OMPCPP) $*.G > $*.bb
$(SED_FTN) $*.bb | $(CPP) $(TRADFLAG) > $*.f90
$(SED_FTN) $*.bb | $(CPP) $(TRADFLAG) > $*.tmp.f90
$(RM) $*.G $*.bb
$(FC) -o $@ -c $(FCFLAGS) $(OMP) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $*.f90
$(FC) -o $@ -c $(FCFLAGS) $(OMP) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $*.tmp.f90

.F.f90:
$(RM) $@
Expand All @@ -218,13 +218,6 @@ wrfio_esmf :
$(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.H > $@
$(RM) $*.G $*.H

.F90.f90:
$(RM) $@
sed -e "s/^\!.*'.*//" -e "s/^ *\!.*'.*//" $*.F90 > $*.G
$(SED_FTN) $*.G > $*.H
$(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.H > $@
$(RM) $*.G $*.H

.f90.o:
$(RM) $@
$(FC) -o $@ -c $(FCFLAGS) $(PROMOTION) $(FCSUFFIX) $*.f90
Expand Down

0 comments on commit 6e71a0a

Please sign in to comment.