annotate kdiff3/admin/do_make @ 69:8febbfb1148c

KDiff3 0.9.89
author joachim99
date Mon, 10 Apr 2006 08:40:51 +0000
parents
children
rev   line source
joachim99@69 1 #!/bin/bash
joachim99@69 2
joachim99@69 3 # this is a script around make which basicly checks
joachim99@69 4 # if it's in srcdir or in builddir and changes to
joachim99@69 5 # the right directory for calling /usr/bin/make
joachim99@69 6 # (C) Stephan Kulow
joachim99@69 7
joachim99@69 8 # You may need to set OBJ_REPLACEMENT variable to get it to work.
joachim99@69 9 # In the variable use the sed syntax to switch directories, for example
joachim99@69 10 # export OBJ_REPLACEMENT="s:/home/zack/cvs/kde:/home/zack/build:"
joachim99@69 11 # will assure that the builds are performed under /home/zack/build
joachim99@69 12 # directory, when the cvs is held under /home/zack/cvs/kde.
joachim99@69 13
joachim99@69 14 file=Makefile
joachim99@69 15 dir=.
joachim99@69 16 args=()
joachim99@69 17 jobs=
joachim99@69 18
joachim99@69 19 while test $# -gt 0 ; do
joachim99@69 20 case "${1}" in
joachim99@69 21 -f)
joachim99@69 22 shift
joachim99@69 23 file="${1}"
joachim99@69 24 shift
joachim99@69 25 args=("${args[@]}" -f $file)
joachim99@69 26 ;;
joachim99@69 27 -C)
joachim99@69 28 shift
joachim99@69 29 dir="${1}"
joachim99@69 30 shift ;;
joachim99@69 31 -j)
joachim99@69 32 shift
joachim99@69 33 jobs="${1}"
joachim99@69 34 shift ;;
joachim99@69 35 -j*)
joachim99@69 36 jobs="${1/-j/}"
joachim99@69 37 shift ;;
joachim99@69 38 *)
joachim99@69 39 args=("${args[@]}" "$1")
joachim99@69 40 shift
joachim99@69 41 ;;
joachim99@69 42 esac
joachim99@69 43 done
joachim99@69 44
joachim99@69 45 if test ! -f $dir/$file; then
joachim99@69 46 if test -n "$OBJ_SUBDIR"; then
joachim99@69 47 dir=$PWD
joachim99@69 48 subdir=.
joachim99@69 49 while test ! -f $dir/$OBJ_SUBDIR/$file; do
joachim99@69 50 subdir=`basename $dir`"/$subdir"
joachim99@69 51 dir=`dirname $dir`
joachim99@69 52 if test "$dir" = "/"; then
joachim99@69 53 # the case that someone puts the compile dir in /
joachim99@69 54 # is very unlikely, so we better skip here ;)
joachim99@69 55 echo "can't find $OBJ_SUBDIR above current dir"
joachim99@69 56 exit 1
joachim99@69 57 fi
joachim99@69 58 done
joachim99@69 59 cd $dir/$OBJ_SUBDIR/$subdir
joachim99@69 60 else
joachim99@69 61 if test -n "$OBJ_REPLACEMENT"; then
joachim99@69 62 pwd=`echo $PWD | sed -e "$OBJ_REPLACEMENT"`
joachim99@69 63 if test ! -f $pwd/$dir/$file; then
joachim99@69 64 echo "no objdir found. Tried $pwd"
joachim99@69 65 exit 1
joachim99@69 66 fi
joachim99@69 67 cd $pwd/$dir
joachim99@69 68 fi
joachim99@69 69 fi
joachim99@69 70 else
joachim99@69 71 cd $dir
joachim99@69 72 fi
joachim99@69 73
joachim99@69 74 echo "makeobj[0]: Entering directory \`$PWD'"
joachim99@69 75 if test -z "$MAKE"; then
joachim99@69 76 if head -n 1 $file | grep unsermake >/dev/null; then
joachim99@69 77 MAKE=`type -p unsermake`
joachim99@69 78 if test ! -x "$MAKE"; then
joachim99@69 79 echo 'Makefile was created with unsermake, but there'
joachim99@69 80 echo 'is no unsermake in $PATH'
joachim99@69 81 exit 1
joachim99@69 82 fi
joachim99@69 83 MAKE="$MAKE --no-real-compare VERBOSE=1"
joachim99@69 84 if test -n "$jobs"; then args=("${args[@]}" --compile-jobs=$jobs); fi
joachim99@69 85 else
joachim99@69 86 MAKE=/usr/bin/make
joachim99@69 87 if test -n "$jobs"; then args=("${args[@]}" -j $jobs); fi
joachim99@69 88 fi
joachim99@69 89 fi
joachim99@69 90
joachim99@69 91 echo "Calling $MAKE ${args[@]}"
joachim99@69 92 LANGUAGE=C $MAKE "${args[@]}"
joachim99@69 93 retval=$?
joachim99@69 94 echo "makeobj[0]: Leaving directory \`$PWD'"
joachim99@69 95 exit $retval
joachim99@69 96