- Fortran compiler:
gfortran(GCC Fortran) - C compiler:
gcc - NetCDF libraries: netCDF-C and netCDF-Fortran with HDF5 support
- Make: GNU Make
On macOS without admin/Homebrew access, compilers and libraries can be installed entirely in user space via conda-forge:
# Install compilers
conda install -c conda-forge gfortran_osx-arm64 gcc_osx-arm64
# Install netCDF and HDF5
conda install -c conda-forge netcdf-fortran hdf5 libnetcdfThe conda compilers use target-prefixed names
(e.g. arm64-apple-darwin20.0.0-gfortran). Create short symlinks
in ~/bin for convenience:
mkdir -p ~/bin
ln -sf ~/miniconda3/bin/arm64-apple-darwin20.0.0-gfortran ~/bin/gfortran
ln -sf ~/miniconda3/bin/arm64-apple-darwin20.0.0-gcc ~/bin/gccEnsure ~/bin is on your PATH.
The Makefile shipped in build/ is configured for macOS with
conda-forge toolchains. Key differences from a Linux build:
- No
--staticlinker flag — macOS does not support fully static linking. UseusrLDFLAGS = -ginstead. - GCC 15 compatibility flags — Modern gfortran requires
-fallow-invalid-boz(for octal BOZ literals in legacy code) and-fallow-argument-mismatch(for legacy Fortran calling conventions). These are included inusrFFLAGS. CONDA_PREFIX— The Makefile uses this variable to locate headers and libraries under~/miniconda3.
Edit the top section of build/Makefile to set paths for your system:
# Conda environment (adjust if not using default miniconda3 location)
CONDA_PREFIX = $(HOME)/miniconda3
# Compiler paths (use absolute paths or ensure ~/bin is on PATH)
FC = /Users/yourusername/bin/gfortran
CC = /Users/yourusername/bin/gcc
# NetCDF/HDF5 include and library paths
usrCPP_INCS = -I$(CONDA_PREFIX)/include
nchdflib = -L$(CONDA_PREFIX)/lib -lnetcdff -lnetcdf \
-lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lsz -lzOther Makefile variables you may need to adjust:
| Variable | Default | Purpose |
|---|---|---|
precision_mode |
r8 |
Double precision |
usrFFLAGS |
-O3 -ffixed-line-length-132 -fallow-invalid-boz -fallow-argument-mismatch |
Fortran compile flags |
usrLDFLAGS |
-g |
Linker flags (no --static on macOS) |
usrCPP_DEFS_AER |
-DDST -DCAER -DSCYC -DWETDEP -DDRYDEP -DASSIM |
Aerosol module selection |
Filepath lists the source directories to search, one per line.
Use relative paths from the build/ directory:
../readers/ncep
../readers
../src/spitfire
../dst
../src_scyc
../src_assim
../src
cd build
make
This compiles all source listed in Srcfiles, placing object files
in build/OBJ/, and links the match executable in build/.
To rebuild dependencies after adding or removing source files:
make Depends
To clean and rebuild:
make clean
make
| File | Purpose |
|---|---|
Makefile |
Compiler flags, paths, pattern rules |
Filepath |
Directories to search for source (sets VPATH) |
Srcfiles |
List of all source files to compile |
Depends |
Auto-generated dependency rules (#include and use tracking) |
makdep / makdep_usrbinperl |
Perl script that scans source to generate Depends |
params.h |
Compile-time grid parameters |
Some files require modified optimization or flags:
fft.F— Cannot use bounds checkingadvect.F,advfix.F— UsespecFFLAGS2(separate optimization level)
These are handled by explicit rules in the Makefile.
The utils/ directory builds two post-processing programs:
ccm2nc— Converts CCM-format history files to netCDFhsum— Computes hash checksums of history files
cd utils
Edit Makefile to set the NetCDF path:
CC = gcc
NETCDF_DIR = /path/to/netcdfThen:
make
MATCH supports two meteorological input formats. The reader is
selected by which dyninp.F appears in the Filepath search order:
- NCEP GRIB (
readers/ncep/) — reads GRIB-format reanalysis files viagrib.c/gribr.c - NetCDF (
readers/netcdf/) — reads NetCDF-format reanalysis
The default Filepath lists readers/ncep first, selecting the GRIB reader.