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