Skip to content

Commit

Permalink
Adds --with-driver option to configure
Browse files Browse the repository at this point in the history
- Following suggestion from @marshallward I've implemented an option
  to select the driver code at the configure stage  (changes to
  configure.ac)
- This allows the target build/coupled/ocean_model_MOM.o to be built
  using the .testing ac tools.
  • Loading branch information
adcroft committed Jan 13, 2021
1 parent dc74767 commit 43ae9ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
23 changes: 6 additions & 17 deletions .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,19 @@ build/asymmetric/Makefile: MOM_ENV=$(PATH_FMS) $(ASYMMETRIC_FCFLAGS) $(MOM_LDFLA
build/repro/Makefile: MOM_ENV=$(PATH_FMS) $(REPRO_FCFLAGS) $(MOM_LDFLAGS)
build/openmp/Makefile: MOM_ENV=$(PATH_FMS) $(OPENMP_FCFLAGS) $(MOM_LDFLAGS)
build/target/Makefile: MOM_ENV=$(PATH_FMS) $(TARGET_FCFLAGS) $(MOM_LDFLAGS)

build/coupled/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(SYMMETRIC_LDFLAGS)
build/nuopc/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(SYMMETRIC_LDFLAGS)
build/mct/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(SYMMETRIC_LDFLAGS)

# Configure script flags
build/symmetric/Makefile: MOM_ACFLAGS=
build/asymmetric/Makefile: MOM_ACFLAGS=--enable-asymmetric
build/repro/Makefile: MOM_ACFLAGS=
build/openmp/Makefile: MOM_ACFLAGS=--enable-openmp
build/target/Makefile: MOM_ACFLAGS=

build/coupled/Makefile: MOM_ACFLAGS=--with-driver=coupled_driver
build/nuopc/Makefile: MOM_ACFLAGS=--with-driver=nuopc_driver
build/mct/Makefile: MOM_ACFLAGS=--with-driver=mct_driver

# Fetch regression target source code
build/target/Makefile: | $(TARGET_CODEBASE)
Expand Down Expand Up @@ -336,29 +340,14 @@ $(DEPS)/Makefile: ../ac/deps/Makefile
# - use autoconf rather than mkmf templates
MK_TEMPLATE ?= ../../$(DEPS)/mkmf/templates/ncrc-gnu.mk
# NUOPC driver
build/nuopc/Makefile: ../config_src/nuopc_driver $(MOM_SOURCE)
mkdir -p $(@D)
cd $(@D) \
&& $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/nuopc_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \
&& $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names
build/nuopc/mom_ocean_model_nuopc.o: build/nuopc/Makefile
cd $(@D) && make $(@F)
check_mom6_api_nuopc: build/nuopc/mom_ocean_model_nuopc.o
# GFDL coupled driver
build/coupled/Makefile: ../config_src/coupled_driver $(MOM_SOURCE)
mkdir -p $(@D)
cd $(@D) \
&& $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/coupled_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \
&& $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names
build/coupled/ocean_model_MOM.o: build/coupled/Makefile
cd $(@D) && make $(@F)
check_mom6_api_coupled: build/coupled/ocean_model_MOM.o
# MCT driver
build/mct/Makefile: ../config_src/mct_driver $(MOM_SOURCE)
mkdir -p $(@D)
cd $(@D) \
&& $(MOM_ENV) ../../$(DEPS)/mkmf/bin/list_paths -l ../../$(DEPS)/fms/src ../../../config_src/mct_driver ../../../config_src/dynamic_symmetric ../../../src/ ../../../config_src/external \
&& $(MOM_ENV) ../../$(DEPS)/mkmf/bin/mkmf -t $(MK_TEMPLATE) -p MOM6 path_names
build/mct/mom_ocean_model_mct.o: build/mct/Makefile
cd $(@D) && make $(@F)
check_mom6_api_mct: build/mct/mom_ocean_model_mct.o
Expand Down
10 changes: 8 additions & 2 deletions ac/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ AC_ARG_ENABLE([asymmetric],
AS_IF([test "$enable_asymmetric" = yes],
[MEM_LAYOUT=${srcdir}/config_src/dynamic])

# Default to solo_driver
DRIVER_DIR=${srcdir}/config_src/solo_driver
AC_ARG_WITH([driver],
AS_HELP_STRING([--with-driver=coupled_driver|solo_driver], [Select directory for driver source code]))
AS_IF([test "x$with_driver" != "x"],
[DRIVER_DIR=${srcdir}/config_src/${with_driver}])

# TODO: Rather than point to a pre-configured header file, autoconf could be
# used to configure a header based on a template.
Expand Down Expand Up @@ -210,10 +216,10 @@ AS_IF([test -z "$MKMF"], [
AC_CONFIG_COMMANDS([path_names],
[list_paths -l \
${srcdir}/src \
${srcdir}/config_src/solo_driver \
${srcdir}/config_src/ext* \
${DRIVER_DIR} \
${MEM_LAYOUT}
], [MEM_LAYOUT=$MEM_LAYOUT])
], [MEM_LAYOUT=$MEM_LAYOUT DRIVER_DIR=$DRIVER_DIR])


AC_CONFIG_COMMANDS([Makefile.mkmf],
Expand Down

0 comments on commit 43ae9ae

Please sign in to comment.