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
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.
19 while test $# -gt 0 ; do
25 args
=("${args[@]}" -f $file)
39 args
=("${args[@]}" "$1")
45 if test ! -f $dir/$file; then
46 if test -n "$OBJ_SUBDIR"; then
49 while test ! -f $dir/$OBJ_SUBDIR/$file; do
50 subdir
=`basename $dir`"/$subdir"
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"
59 cd $dir/$OBJ_SUBDIR/$subdir
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"
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'
83 args
=("${args[@]}" --no-real-compare)
84 if test -n "$jobs"; then args
=("${args[@]}" --compile-jobs $jobs); fi
87 if test -n "$jobs"; then args
=("${args[@]}" -j $jobs); fi
91 echo "Calling $MAKE ${args[@]}"
92 LANGUAGE
=C
$MAKE "${args[@]}"
94 echo "makeobj[0]: Leaving directory \`$PWD'"