From 0b586a50b0e95e2b8d102f59a97119a1a2964bc0 Mon Sep 17 00:00:00 2001 From: Jan Darmochwal Date: Fri, 8 Oct 2010 13:31:47 +0200 Subject: Fix for bugs in build.sh * don't remove BUILDDIR when called with --clean from wrong directory * set SCRIPTNAME before displaying it --- build.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'build.sh') diff --git a/build.sh b/build.sh index 7a515e4..fdd8b44 100755 --- a/build.sh +++ b/build.sh @@ -8,6 +8,15 @@ BUILDDIR="build" DIR=$(pwd) +SCRIPTNAME=$(basename "$0" 2>/dev/null || echo "$0") + +if [[ ! -f "$DIR"/"$SRCDIR"/CMakeLists.txt ]] +then + echo "$SRCDIR/CMakeLists.txt not found" >&2 + echo "please run '$SCRIPTNAME' from its containing directory" >&2 + exit 1 +fi + for OPTION in "$@" do if [[ "$OPTION" == "--clean" ]] @@ -22,14 +31,6 @@ do fi done -if [[ ! -f "$DIR"/"$SRCDIR"/CMakeLists.txt ]] -then - echo "$SRCDIR/CMakeLists.txt not found" >&2 - SCRIPTNAME=$(basename "$0" 2>/dev/null || echo "$0") - echo "please run '$SCRIPTNAME' from its containing directory" >&2 - exit 1 -fi - # note: NCORES may be too large on systems with hyperthreading NCORES=$(grep -c "^processor" /proc/cpuinfo 2>/dev/null) if [[ ! $NCORES -ge 1 ]] -- cgit v1.2.3-55-g7522