@@ -147,7 +147,11 @@ if ( ! -f $mppnccombine ) then
147147endif
148148
149149set mkmf_lib = " $mkmf -f -m Makefile -a $code_dir -t $mkmfTemplate "
150- set lib_include_dirs = " $root /include $code_dir /shared/include $code_dir /shared/mpp/include"
150+ if ( ! $? FMS_EXTERNAL ) then
151+ set lib_include_dirs = " $root /include $code_dir /shared/include $code_dir /shared/mpp/include"
152+ else
153+ set lib_include_dirs = " $root /include $code_dir /shared/mpp/include"
154+ endif
151155
152156if ( $cosima_version ) then
153157 echo " Including COSIMA version in build"
@@ -156,10 +160,14 @@ if ( $cosima_version ) then
156160 set cppDefs = " $cppDefs -DCOSIMA_VERSION"
157161endif
158162
159- # Build FMS.
160- source ./FMS_compile.csh
161-
162- set includes = " -I$code_dir /shared/include -I$executable :h:h/lib_FMS -I$executable :h:h/lib_ocean"
163+ if ( ! $? FMS_EXTERNAL ) then
164+ echo " Building type=$type with internal FMS"
165+ source ./FMS_compile.csh
166+ set includes = " -I$code_dir /shared/include -I$executable :h:h/lib_FMS -I$executable :h:h/lib_ocean"
167+ else
168+ echo " Building type=$type with external FMS"
169+ set includes = " -I$executable :h:h/lib_ocean"
170+ endif
163171
164172if ( $cosima_version ) then
165173 set includes = " $includes -I$executable :h:h/lib_version/"
@@ -221,16 +229,16 @@ mkdir -p $executable:h
221229cd $executable :h
222230if( $type == MOM_solo ) then
223231 set srcList = ( mom5/drivers )
224- set libs = " $executable :h:h/lib_ocean/lib_ocean.a $executable :h:h/lib_FMS/lib_FMS.a "
232+ set libs = " $executable :h:h/lib_ocean/lib_ocean.a"
225233else if( $type == ACCESS-CM || $type == ACCESS-ESM) then
226234 set srcList = ( access/accesscm_coupler )
227- set includes = " -I$executable :h:h/lib_FMS -I $executable :h:h/ $type /lib_ocean"
235+ set includes = " -I$executable :h:h/$type /lib_ocean"
228236 set libs = " $executable :h:h/$type /lib_ocean/lib_ocean.a"
229237 setenv OASIS true
230238else if( $type == ACCESS-OM || $type == ACCESS-OM-BGC) then
231239 set srcList = ( access/accessom_coupler )
232- set includes = " -I$executable :h:h/lib_FMS -I $executable :h:h/ $type /lib_ocean"
233- set libs = " $executable :h:h/$type /lib_ocean/lib_ocean.a $executable :h:h/lib_FMS/lib_FMS.a "
240+ set includes = " -I$executable :h:h/$type /lib_ocean"
241+ set libs = " $executable :h:h/$type /lib_ocean/lib_ocean.a"
234242else if( $type == MOM_SIS ) then
235243 set srcList = ( coupler )
236244 set includes = " $includes -I$executable :h:h/lib_ice -I$executable :h:h/lib_atmos_null -I$executable :h:h/lib_land_null"
@@ -260,8 +268,12 @@ if( $type =~ ACCESS-* ) then
260268 set srcList = ( $srcList access/shared )
261269endif
262270
263- # Always include FMS
264- set libs = " $libs $executable :h:h/lib_FMS/lib_FMS.a"
271+ if ( ! $? FMS_EXTERNAL ) then
272+ set libs = " $libs $executable :h:h/lib_FMS/lib_FMS.a"
273+ if( $type == ACCESS-CM || $type == ACCESS-ESM || $type == ACCESS-OM || $type == ACCESS-OM-BGC) then
274+ set includes = " $includes -I$executable :h:h/lib_FMS"
275+ endif
276+ endif
265277
266278if ( $cosima_version ) then
267279 set libs = " $libs $executable :h:h/lib_version/lib_version.a"
0 commit comments