From 2370cf97bac38ca5056c6c3182e8b6e040432e6b Mon Sep 17 00:00:00 2001 From: Randy McDermott Date: Wed, 23 Oct 2024 17:31:54 -0500 Subject: [PATCH] Build: add --clean-hypre option to make_fds.sh --- Build/Scripts/HYPRE/build_hypre.sh | 7 +++ Build/impi_intel_linux_db/make_fds.sh | 64 +++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/Build/Scripts/HYPRE/build_hypre.sh b/Build/Scripts/HYPRE/build_hypre.sh index 0e9ee150c85..261b84c24e3 100755 --- a/Build/Scripts/HYPRE/build_hypre.sh +++ b/Build/Scripts/HYPRE/build_hypre.sh @@ -1,8 +1,15 @@ #!/bin/bash CONFMAKE=$1 +CLEAN_HYPRE=$2 dir=`pwd` +echo "CLEAN_HYPRE = $CLEAN_HYPRE" +if [ "$CLEAN_HYPRE" = true ]; then + echo "Removing hypre library ..." + rm -r $FIREMODELS/libs/hypre +fi + echo "Checking for hypre library..." if [ -d "$FIREMODELS/libs/hypre" ]; then diff --git a/Build/impi_intel_linux_db/make_fds.sh b/Build/impi_intel_linux_db/make_fds.sh index 78bac97a830..51e87780c45 100755 --- a/Build/impi_intel_linux_db/make_fds.sh +++ b/Build/impi_intel_linux_db/make_fds.sh @@ -1,5 +1,63 @@ #!/bin/bash -ARG=$1 + +# PARSE OPTIONS FOR CLEAN LIBRARY BUILDS #################################### + +# Parse the long options first using getopt +OPTIONS=$(getopt -o "" --long clean-hypre,clean-sundials -- "$@") + +# Check if getopt parsed successfully +if [ $? -ne 0 ]; then + echo "Error parsing options." + exit 1 +fi + +# Evaluate the parsed options +eval set -- "$OPTIONS" + +# Initialize variables for options +clean_hypre=false +clean_sundials=false +ARG="" + +# Loop through the options +while true; do + case "$1" in + --clean-hypre) + clean_hypre=true # Set the flag to true when --clean-hypre is used + shift + ;; + --clean-sundials) + clean_sundials=true + shift + ;; + --) + shift + break + ;; + *) + echo "Invalid option." + exit 1 + ;; + esac +done + +# After all options are processed, check for any remaining positional argument (ARG) +if [ -n "$1" ]; then + ARG=$1 +fi + +# Use ARG and the options +#echo "ARG is: $ARG" + +if [ "$clean_hypre" = true ]; then + echo "Option --clean-hypre is set." +fi + +if [ "$clean_sundials" = true ]; then + echo "Option --clean-sundials is set." +fi + +# FINISHED WITH CLEANING OPTIONS ########################################### source ../Scripts/set_intel_compiler.sh $ARG @@ -7,10 +65,10 @@ dir=`pwd` target=${dir##*/} # build hypre -source ../Scripts/HYPRE/build_hypre.sh confmake_impi_intel_linux.sh +source ../Scripts/HYPRE/build_hypre.sh confmake_impi_intel_linux.sh $clean_hypre ## build sundials -#source ../Scripts/SUNDIALS/build_sundials.sh +#source ../Scripts/SUNDIALS/build_sundials.sh $arg-1 $arg-2 ... $clean_sundials # build fds echo Building $target with Intel MPI and $INTEL_IFORT