Index: /issm/trunk-jpl/externalpackages/emscripten/install.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/emscripten/install.sh	(revision 26238)
+++ /issm/trunk-jpl/externalpackages/emscripten/install.sh	(revision 26239)
@@ -5,32 +5,42 @@
 # TODO:
 # - Introduce build step to $ISSM_DIR/jenkins/jenkins.sh to compile Fortran code in $ISSM_DIR/src/c/modules/GiaDefelectionCorex/ to C with f2c
-#	- Then, revert $ISSM_DIR/externalpackages/emscripten/install.sh to r24306 and test clean build
-#	- When builtin support for Fortran is available, remove build step
+#       - Then, revert $ISSM_DIR/externalpackages/emscripten/install.sh to r24306 and test clean build
+#       - When builtin support for Fortran is available, remove build step
 #
 
+## Constants
+#
 VER="latest" # Set this to "latest", or last tag that works in case of failure
+
+## Environment
+#
+PREFIX="${ISSM_DIR}/externalpackages/emscripten/install"
 
 # Get Emscripten SDK (emsdk) driver if we have not previously installed
 # Emscripten. Otherwise, just get the latest version.
-if [[ ! -d ./install ]]; then
-	# Get the emsdk repo
-	git clone https://github.com/emscripten-core/emsdk.git
+if [[ ! -d ${PREFIX} ]]; then
+        # Get the emsdk repo
+        git clone https://github.com/emscripten-core/emsdk.git
 
-	# Move source to 'install' directory
-	mv ./emsdk ./install
+        # Create $PREFIX directory
+        mkdir -p ${PREFIX}
 
-	cd ./install
+        # Move source to $PREFIX directory
+        mv emsdk/* ${PREFIX}
+        rm -rf emsdk
+
+        cd ${PREFIX}
 else
-	# Fetch the latest version of the emsdk
-	cd ./install
-	git pull
+        # Fetch the latest version of the emsdk
+        cd ${PREFIX}
+        git pull
 fi
 
 # Download and install the latest SDK tools.
-./emsdk install $VER
+./emsdk install ${VER}
 
 # Make the "latest" SDK "active" for the current user. (writes ~/.emscripten
 # file)
-./emsdk activate $VER
+./emsdk activate ${VER}
 
 # Activate PATH and other environment variables in the current terminal
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.12-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.12-linux.sh	(revision 26238)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.12-linux.sh	(revision 26239)
@@ -43,5 +43,4 @@
 	--download-hdf5=1
 
-
 # Compile and install
 make
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.13-pleiades.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.13-pleiades.sh	(revision 26238)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.13-pleiades.sh	(revision 26239)
@@ -2,22 +2,32 @@
 set -eu
 
-#Some cleanup
-rm -rf install petsc-3.13.3 src
-mkdir install src
 
-#Download from ISSM server
-#$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/petsc-lite-3.13.3.tar.gz' 'petsc-3.13.3.tar.gz'
-$ISSM_DIR/scripts/DownloadExternalPackage.sh 'http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.13.3.tar.gz' 'petsc-3.13.3.tar.gz'
+## Constants
+#
+VER="3.13.6"
 
-#Untar and move petsc to install directory
-tar -zxvf  petsc-3.13.3.tar.gz
-mv petsc-3.13.3/* src/
-rm -rf petsc-3.13.3
+# Download source
+$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz' 'petsc-${VER}.tar.gz'
 
-#configure (based on /nasa/petsc/3.7.5/intel_mpt/lib/petsc/conf/petscvariables look for CONFIGURE_OPTIONS)
-cd src
+# Unpack source
+tar -zxvf petsc-${VER}.tar.gz
+
+# Cleanup
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir ${PETSC_DIR}
+
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
+rm -rf petsc-${VER}
+
+
+# Configure
+#
+# NOTE: Based on /nasa/petsc/3.7.5/intel_mpt/lib/petsc/conf/petscvariables; look for CONFIGURE_OPTIONS
+#
+cd ${PETSC_DIR}
 ./config/configure.py \
-	--prefix="$ISSM_DIR/externalpackages/petsc/install" \
-	--PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-cc=icc --with-cxx=icpc --with-fc=ifort --with-f77=ifort\
 	-COPTFLAGS="-g -O3 -axCORE-AVX2,AVX -xSSE4.2" -CXXOPTFLAGS="-g -O3 -axCORE-AVX2,AVX -xSSE4.2" -FOPTFLAGS="-g -O3 -axCORE-AVX2,AVX -xSSE4.2" \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-linux.sh	(revision 26238)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-linux.sh	(revision 26239)
@@ -4,5 +4,9 @@
 
 ## Constants
+#
 VER="3.14.0"
+
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
 
 # Download source
@@ -13,16 +17,16 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
 # Configure
-cd src
+cd ${PETSC_DIR}
 ./config/configure.py \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-debugging=0 \
 	--with-valgrind=0 \
@@ -39,5 +43,4 @@
 	--download-hdf5=1
 
-
 # Compile and install
 make
