fre.make.create_makefile_script module

For a bare-metal build: Create the Makefile used for model compilation in the [modelRoot]/[experiment name]/[platform]-[target]/exec folder.

For a container build: Create the Makefile used for model compilation in the ./tmp/[platform] directory.

  • modelRoot is defined in the platforms.yaml

  • experiment name is defined in compile.yaml

  • platform and target are passed via Click options

The Makefile

  1. Sets the SRCROOT

  2. Sets the BUILDROOT

  3. Sets the MK_TEMPLATE_PATH

    • This path is defined in the platforms.yaml and refers to a template in the mkmf repository.

  4. Sets the build and linking recipes that adhere to the following structure:

    [target]: [prerequisites]
        [recipe]
    

For more information about the Makefile, see the fre-cli glossary: https://github.com/NOAA-GFDL/fre-cli/blob/main/docs/glossary.rst

fre.make.create_makefile_script.makefile_create(yamlfile: str, platform: tuple[str], target: tuple[str])

This function makefile_create generates the top level Makefile for the source code that is specified in the model compile YAML file.

Parameters:
  • yamlfile (str) – Model compile YAML file

  • platform (tuple of strings) – FRE platforms that are defined in the platforms.yaml

  • target (tuple of strings) – Predefined FRE targets

Raises:

ValueError – Error if platform does not exist in platforms yaml configuration

Note

If additional library dependencies are defined in the compile.yaml file:

  • For a container build, where library dependencies are defined via the “container_addlibs” key in the compile.yaml, a linkline.sh script will be generated to determine paths for the additional -L/[path to libraries] and -l[library name] located inside the container to the Makefile.

    • Example: container_addlibs: [‘darcy’]

  • For a bare-metal build, library flags, -L/[path to libraries] and -l[library name], are defined via the “baremetal_linkerflags” key in the compile.yaml and added to the link line in the Makefile.

    • Example: baremetal_linkerflags: [“-L/derbyshire/pemberly -ldarcy”]