Mercurial > hg > easyhg-kdiff3
comparison kdiff3/admin/do_make @ 69:8febbfb1148c
KDiff3 0.9.89
author | joachim99 |
---|---|
date | Mon, 10 Apr 2006 08:40:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:d7cafcda8c99 | 69:8febbfb1148c |
---|---|
1 #!/bin/bash | |
2 | |
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 | |
7 | |
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. | |
13 | |
14 file=Makefile | |
15 dir=. | |
16 args=() | |
17 jobs= | |
18 | |
19 while test $# -gt 0 ; do | |
20 case "${1}" in | |
21 -f) | |
22 shift | |
23 file="${1}" | |
24 shift | |
25 args=("${args[@]}" -f $file) | |
26 ;; | |
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 ;; | |
38 *) | |
39 args=("${args[@]}" "$1") | |
40 shift | |
41 ;; | |
42 esac | |
43 done | |
44 | |
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 | |
57 fi | |
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 | |
66 fi | |
67 cd $pwd/$dir | |
68 fi | |
69 fi | |
70 else | |
71 cd $dir | |
72 fi | |
73 | |
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 | |
82 fi | |
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 | |
88 fi | |
89 fi | |
90 | |
91 echo "Calling $MAKE ${args[@]}" | |
92 LANGUAGE=C $MAKE "${args[@]}" | |
93 retval=$? | |
94 echo "makeobj[0]: Leaving directory \`$PWD'" | |
95 exit $retval | |
96 |