Skip to content

Commit

Permalink
Merge pull request #614 from mlee03/mkl/mod_dir_autotools
Browse files Browse the repository at this point in the history
autotools .mod build to a common directory
  • Loading branch information
thomas-robinson authored Nov 16, 2020
2 parents 9e58dfb + 7c52906 commit 6d3ac62
Show file tree
Hide file tree
Showing 53 changed files with 319 additions and 216 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ list(APPEND fms_fortran_src_files
horiz_interp/horiz_interp.F90
interpolator/interpolator.F90
memutils/memutils.F90
monin_obukhov/monin_obukhov_kernel.F90
monin_obukhov/monin_obukhov_inter.F90
monin_obukhov/monin_obukhov.F90
mosaic/gradient.F90
mosaic/grid.F90
Expand All @@ -149,7 +149,7 @@ list(APPEND fms_fortran_src_files
mpp/mpp_parameter.F90
mpp/mpp_utilities.F90
platform/platform.F90
random_numbers/MersenneTwister.F90
random_numbers/mersennetwister.F90
random_numbers/random_numbers.F90
sat_vapor_pres/sat_vapor_pres_k.F90
sat_vapor_pres/sat_vapor_pres.F90
Expand Down
8 changes: 8 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
# This directory stores libtool macros, put there by aclocal.
ACLOCAL_AMFLAGS = -I m4

# Directory to place all .mod files. Convienient place to look for these
# files.
MODDIR := .mod
$(shell test -d $(MODDIR) || mkdir -p $(MODDIR))

# Does the user want to build documentation?
if BUILD_DOCS
DOCS = docs
Expand Down Expand Up @@ -66,3 +71,6 @@ pkgconfig_DATA = FMS.pc
EXTRA_DIST = README.md #_package_init_cmake

CLEANFILES = *__genmod.mod *__genmod.f90

clean-local:
-rm -rf .mod
12 changes: 9 additions & 3 deletions affinity/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libfms_affinity.la libfms_affinity_c.la
Expand All @@ -42,4 +40,12 @@ MODFILES = fms_affinity_mod.mod
BUILT_SOURCES = $(MODFILES)
include_HEADERS = $(MODFILES)

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
18 changes: 9 additions & 9 deletions amip_interp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/time_interp
AM_CPPFLAGS += -I${top_builddir}/time_manager
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS += -I${top_builddir}/horiz_interp
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS += -I${top_builddir}/constants
AM_CPPFLAGS += -I${top_builddir}/platform
AM_CPPFLAGS += -I${top_builddir}/fms2_io
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libamip_interp.la
Expand All @@ -44,4 +36,12 @@ amip_interp_mod.mod: amip_interp.lo
BUILT_SOURCES = amip_interp_mod.mod
include_HEADERS = amip_interp_mod.mod

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
14 changes: 9 additions & 5 deletions astronomy/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS += -I${top_builddir}/time_manager
AM_CPPFLAGS += -I${top_builddir}/constants
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libastronomy.la
Expand All @@ -42,4 +38,12 @@ include_HEADERS = astronomy_mod.mod

EXTRA_DIST = astronomy.tech.ps

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
15 changes: 9 additions & 6 deletions axis_utils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,11 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS += -I${top_builddir}/constants
AM_CPPFLAGS += -I${top_builddir}/fms2_io
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libaxis_utils.la libaxis_utils2.la

# The convenience library depends on its source.
libaxis_utils_la_SOURCES = axis_utils.F90
libaxis_utils2_la_SOURCES = axis_utils2.F90

Expand All @@ -43,3 +38,11 @@ include_HEADERS = axis_utils_mod.mod axis_utils2_mod.mod
BUILT_SOURCES = axis_utils_mod.mod axis_utils2_mod.mod

CLEANFILES = *.mod

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
11 changes: 9 additions & 2 deletions block_control/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libblock_control.la
Expand All @@ -37,4 +36,12 @@ block_control_mod.mod: block_control.lo
BUILT_SOURCES = block_control_mod.mod
include_HEADERS = block_control_mod.mod

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
14 changes: 9 additions & 5 deletions column_diagnostics/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS += -I${top_builddir}/time_manager
AM_CPPFLAGS += -I${top_builddir}/constants
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libcolumn_diagnostics.la
Expand All @@ -40,4 +36,12 @@ column_diagnostics_mod.mod: column_diagnostics.lo
BUILT_SOURCES = column_diagnostics_mod.mod
include_HEADERS = column_diagnostics_mod.mod

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_SUBST([NOUNDEFINED])


# These files will be created when the configure script is run.
AC_CONFIG_FILES([Makefile
include/Makefile
Expand Down Expand Up @@ -323,7 +324,7 @@ AC_CONFIG_FILES([Makefile
sat_vapor_pres/Makefile
random_numbers/Makefile
libFMS/Makefile
docs/Makefile
docs/Makefile
test_fms/test_common.sh
test_fms/Makefile
test_fms/diag_manager/Makefile
Expand Down
11 changes: 9 additions & 2 deletions constants/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/platform
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libconstants.la
Expand All @@ -37,4 +36,12 @@ constants_mod.mod: constants.lo
BUILT_SOURCES = constants_mod.mod
include_HEADERS = constants_mod.mod

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
19 changes: 10 additions & 9 deletions coupler/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS += -I${top_builddir}/time_manager
AM_CPPFLAGS += -I${top_builddir}/diag_manager
AM_CPPFLAGS += -I${top_builddir}/data_override
AM_CPPFLAGS += -I${top_builddir}/field_manager
AM_CPPFLAGS += -I${top_builddir}/platform
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build these uninstalled convenience libraries.
noinst_LTLIBRARIES = libcoupler_types.la libensemble_manager.la \
Expand All @@ -51,8 +44,16 @@ atmos_ocean_fluxes.lo: coupler_types_mod.mod

# Mod files are built and then installed as headers.
MODFILES = coupler_types_mod.mod ensemble_manager_mod.mod \
atmos_ocean_fluxes_mod.mod
atmos_ocean_fluxes_mod.mod
include_HEADERS = $(MODFILES)
BUILT_SOURCES = $(MODFILES)

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
20 changes: 9 additions & 11 deletions data_override/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/platform
AM_CPPFLAGS += -I${top_builddir}/constants
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS += -I${top_builddir}/horiz_interp
AM_CPPFLAGS += -I${top_builddir}/time_interp
AM_CPPFLAGS += -I${top_builddir}/time_manager
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS += -I${top_builddir}/axis_utils
AM_CPPFLAGS += -I${top_builddir}/fms2_io
AM_CPPFLAGS += -I${top_builddir}/mosaic
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libdata_override.la libget_grid_version_mpp.la \
Expand All @@ -59,4 +49,12 @@ get_grid_version_fms2io_mod.mod
include_HEADERS = $(MODFILES)
BUILT_SOURCES = $(MODFILES)

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
16 changes: 9 additions & 7 deletions diag_integral/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/time_manager
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS += -I${top_builddir}/constants
AM_CPPFLAGS += -I${top_builddir}/fms2_io
AM_CPPFLAGS += -I${top_builddir}/coupler
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build this uninstalled convenience library.
noinst_LTLIBRARIES = libdiag_integral.la
Expand All @@ -43,3 +37,11 @@ include_HEADERS = diag_integral_mod.mod
BUILT_SOURCES = diag_integral_mod.mod

CLEANFILES = *.mod

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
18 changes: 9 additions & 9 deletions diag_manager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@
# Ed Hartnett 2/22/19

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS += -I${top_builddir}/fms
AM_CPPFLAGS += -I${top_builddir}/fms2_io
AM_CPPFLAGS += -I${top_builddir}/time_manager
AM_CPPFLAGS += -I${top_builddir}/constants
AM_CPPFLAGS += -I${top_builddir}/axis_utils
AM_CPPFLAGS += -I${top_builddir}/platform

AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include

# Build these uninstalled convenience libraries.
noinst_LTLIBRARIES = libdiag_data.la libdiag_axis.la libdiag_grid.la \
Expand Down Expand Up @@ -69,4 +61,12 @@ diag_manager_mod.mod
include_HEADERS = $(MODFILES)
BUILT_SOURCES = $(MODFILES)

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod
16 changes: 13 additions & 3 deletions drifters/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
.NOTPARALLEL:

# Include .h and .mod files.
AM_CPPFLAGS = -I${top_srcdir}/include
AM_CPPFLAGS += -I${top_builddir}/mpp
AM_CPPFLAGS = -I${top_builddir}/.mod -I${top_srcdir}/include


# Build these uninstalled convenience libraries.
noinst_LTLIBRARIES = libdrifters_core.la libdrifters_input.la \
Expand Down Expand Up @@ -61,5 +61,15 @@ drifters_comm_mod.mod drifters_io_mod.mod cloud_interpolator_mod.mod \
drifters_mod.mod
include_HEADERS = $(MODFILES) $(DRIFTERS_HDRS)
BUILT_SOURCES = $(MODFILES)
CLEANFILES = *.mod *__genmod.f90

EXTRA_DIST = README.md

SUFFIXES = .mod _mod.mod
.F90.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/
.F90_mod.mod:
$(PPFCCOMPILE) -c $<
@cp ${builddir}/$@ ${top_builddir}/.mod/

CLEANFILES = *.mod *__genmod.f90
Loading

0 comments on commit 6d3ac62

Please sign in to comment.