Skip to content

Commit

Permalink
Set the git version string of MPAS to a more descriptive value
Browse files Browse the repository at this point in the history
Before, it would always show "N/A" in the log, which is not very helpful.

Now, if the git submodule of MPAS is aligned at a tag, it will just show the tag
name (e.g., "v8.2.1"). Otherwise, if the git submodule of MPAS is not aligned at
a tag, it will show the nearest tag name, the number of commits after that tag
and the abbreviated commit hash (e.g., "v8.0.1-54-ged6f8e39e").
  • Loading branch information
kuanchihwang committed Aug 14, 2024
1 parent eebbb4b commit 35ca3b0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/dynamics/mpas/Makefile.in.CESM
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ ifeq ($(strip $(LIBROOT)),)
LIBROOT = ..
endif

ifeq ($(strip $(SRCROOT)),)
$(warning `SRCROOT` should not be empty. Defaulting to `..`)

SRCROOT = ..
MPAS_SRC_ROOT = $(SRCROOT)
else
MPAS_SRC_ROOT = $(SRCROOT)/src/dynamics/mpas/dycore
endif

#
# Define and export variables used by MPAS build infrastructure.
#
Expand All @@ -19,7 +28,7 @@ export BUILD_TARGET = N/A
export CORE = atmosphere
export EXE_NAME = atmosphere_model
export GEN_F90 = false
export GIT_VERSION = N/A
export GIT_VERSION = $(shell git -C "$(MPAS_SRC_ROOT)" describe --always --dirty --tags || echo "N/A")
export NAMELIST_SUFFIX = atmosphere

# Customize variables (e.g., build options) for use with CESM.
Expand Down Expand Up @@ -57,9 +66,9 @@ all:
@echo 'Users are responsible to provide all necessary build options via environment variables or command line arguments.'
@echo ''
@echo 'Usage hints:'
@echo ' `make libmpas-prepare ESM="CESM" LIBROOT="..."`'
@echo ' `make libmpas-build ESM="CESM" LIBROOT="..."`'
@echo ' `make libmpas-clean ESM="CESM" LIBROOT="..."`'
@echo ' `make libmpas-prepare ESM="CESM" LIBROOT="..." SRCROOT="..."`'
@echo ' `make libmpas-build ESM="CESM" LIBROOT="..." SRCROOT="..."`'
@echo ' `make libmpas-clean ESM="CESM" LIBROOT="..." SRCROOT="..."`'

.PHONY: libmpas-prepare
libmpas-prepare: libmpas-archiver-script.txt libmpas-no-physics libmpas-prefix-namelist-groups libmpas-preview
Expand Down

0 comments on commit 35ca3b0

Please sign in to comment.