| 1 |
XCOMM!/bin/sh |
| 2 |
|
| 3 |
XCOMM make a Makefile from an Imakefile from inside or outside the sources |
| 4 |
|
| 5 |
usage="usage: $0 [-a] [top_of_sources_pathname [current_directory]]" |
| 6 |
|
| 7 |
configdirspec=CONFIGDIRSPEC |
| 8 |
topdir= |
| 9 |
curdir=. |
| 10 |
do_all= |
| 11 |
imake_defines= |
| 12 |
|
| 13 |
while [ $# -gt 0 ] |
| 14 |
do |
| 15 |
case "$1" in |
| 16 |
-D*) |
| 17 |
imake_defines="$imake_defines $1" |
| 18 |
shift |
| 19 |
;; |
| 20 |
-a) |
| 21 |
do_all="yes" |
| 22 |
shift |
| 23 |
;; |
| 24 |
*) |
| 25 |
break |
| 26 |
;; |
| 27 |
esac |
| 28 |
done |
| 29 |
|
| 30 |
case $# in |
| 31 |
0) ;; |
| 32 |
1) topdir=$1 ;; |
| 33 |
2) topdir=$1 curdir=$2 ;; |
| 34 |
*) echo "$usage" 1>&2; exit 1 ;; |
| 35 |
esac |
| 36 |
|
| 37 |
case "$topdir" in |
| 38 |
-*) echo "$usage" 1>&2; exit 1 ;; |
| 39 |
esac |
| 40 |
|
| 41 |
if [ -f Makefile ]; then |
| 42 |
echo mv -f Makefile Makefile.bak |
| 43 |
mv -f Makefile Makefile.bak |
| 44 |
fi |
| 45 |
|
| 46 |
if [ "$topdir" = "" ]; then |
| 47 |
args="-DUseInstalled "$configdirspec |
| 48 |
else |
| 49 |
args="-I$topdir/config/cf -DTOPDIR=$topdir -DCURDIR=$curdir" |
| 50 |
fi |
| 51 |
|
| 52 |
echo imake $imake_defines $args |
| 53 |
case "$do_all" in |
| 54 |
yes) |
| 55 |
imake $imake_defines $args && |
| 56 |
echo "make Makefiles" && |
| 57 |
make Makefiles && |
| 58 |
echo "make includes" && |
| 59 |
make includes && |
| 60 |
echo "make depend" && |
| 61 |
make depend |
| 62 |
;; |
| 63 |
*) |
| 64 |
imake $imake_defines $args |
| 65 |
;; |
| 66 |
esac |