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