Skip to content

Commit

Permalink
shellcheck it
Browse files Browse the repository at this point in the history
  • Loading branch information
aerorahul committed Mar 18, 2024
1 parent 85be0ac commit 192b7d6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/rdbfmsua.fd/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ $(CMD): $(OBJS)
$(FC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)

clean:
-rm -f ${OBJS} ${CMD}
-rm -f ${OBJS}

clobber: clean
-rm -f ${CMD}

install:
-mv ${CMD} ${PREFIX}/
-mv ${CMD} ${PREFIX}/bin/

37 changes: 19 additions & 18 deletions ush/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -eu

# Get the root of the cloned GFS-utils directory
#shellcheck disable=SC2155
readonly DIR_ROOT=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )/.." && pwd -P)

# User Options
Expand All @@ -15,45 +16,45 @@ INSTALL_PREFIX=${INSTALL_PREFIX:-"${DIR_ROOT}/install"}
#==============================================================================#

# Detect machine (sets MACHINE_ID)
source $DIR_ROOT/ush/detect_machine.sh
source "${DIR_ROOT}/ush/detect_machine.sh"

# Load modules
source $DIR_ROOT/ush/module-setup.sh
module use $DIR_ROOT/modulefiles
module load gfsutils_$MACHINE_ID.$COMPILER
source "${DIR_ROOT}/ush/module-setup.sh"
module use "${DIR_ROOT}/modulefiles"
module load "gfsutils_${MACHINE_ID}.${COMPILER}"
module list

# Collect BUILD Options
CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=$BUILD_TYPE"
CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE}"

# Install destination for built executables, libraries, CMake Package config
CMAKE_OPTS+=" -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX"
CMAKE_OPTS+=" -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}"

# Re-use or create a new BUILD_DIR (Default: create new BUILD_DIR)
[[ ${BUILD_CLEAN:-"YES"} =~ [yYtT] ]] && rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR && cd $BUILD_DIR
[[ ${BUILD_CLEAN:-"YES"} =~ [yYtT] ]] && rm -rf "${BUILD_DIR}"
mkdir -p "${BUILD_DIR}" && cd "${BUILD_DIR}"

# Configure, build, install
set -x
cmake $CMAKE_OPTS $DIR_ROOT
make -j ${BUILD_JOBS:-8} VERBOSE=${BUILD_VERBOSE:-}
cmake "${CMAKE_OPTS}" "${DIR_ROOT}"
make -j "${BUILD_JOBS:-8}" VERBOSE="${BUILD_VERBOSE:-}"
make install
set +x

# Build rdbfmsua.x separately due to GEMPAK issues
# Build rdbfmsua.x with makefile separately due to GEMPAK issues in cmake
# Load modules
source $DIR_ROOT/ush/module-setup.sh
module use $DIR_ROOT/modulefiles
module load rdbfmsua_$MACHINE_ID.$COMPILER
source "${DIR_ROOT}/ush/module-setup.sh"
module use "${DIR_ROOT}/modulefiles"
module load "rdbfmsua_${MACHINE_ID}.${COMPILER}"
module show gempak
module list

cd $DIR_ROOT/src/rdbfmsua.fd
cd "${DIR_ROOT}/src/rdbfmsua.fd"
export MACHINE_ID
export COMPILER
export PREFIX=${INSTALL_PREFIX}/bin
export PREFIX="${INSTALL_PREFIX}"
make clean
make VERBOSE=${BUILD_VERBOSE:-}
make install VERBOSE=${BUILD_VERBOSE:-}
make VERBOSE="${BUILD_VERBOSE:-}"
make install VERBOSE="${BUILD_VERBOSE:-}"

exit

0 comments on commit 192b7d6

Please sign in to comment.