home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / stdwin / Conf / mkmf < prev    next >
Encoding:
Text File  |  1993-04-05  |  2.0 KB  |  110 lines  |  [TEXT/????]

  1. #! /bin/sh
  2. # mkmf - friendly interface to makemakefile
  3.  
  4. PROGNAME=`basename $0`
  5. USAGE="usage: $PROGNAME [-a arch] [-o os] [-t topdir] [-p port] [application];
  6.     if no application specified, a port makefile is created,
  7.     else an application makefile is created."
  8.  
  9. TOP=`(cd ..; pwd)`
  10. case $TOP in
  11. /tmp_mnt/meermin/meermin/ufs1/amoeba/*)    TOP=`
  12.     echo "$TOP" | sed 's,^/tmp_mnt/meermin/meermin/ufs1/amoeba/,/ufs/,'
  13.             `
  14.         ;;
  15. /tmp_mnt/meermin/meermin/*)    TOP=`
  16.             echo "$TOP" | sed 's,^/tmp_mnt/meermin/,/hosts/,'
  17.             `
  18.         ;;
  19. esac
  20.  
  21. PORT=x11
  22.  
  23. if ARCH=`(arch) 2>/dev/null`
  24. then
  25.     case $ARCH in
  26.     sun[34])    OS=sunos;;
  27.     sgi)        OS=sysv;;
  28.     dec_risc)    OS=ultrix;;
  29.     esac
  30. elif ARCH=`(machine) 2>/dev/null`
  31. then
  32.     case $ARCH in
  33.     vax)        OS=ultrix;;
  34.     tahoe)        OS=bsd;;
  35.     esac
  36. elif (hp-pa) 2>/dev/null
  37. then
  38.     ARCH=hppa
  39.     OS=hpux
  40. elif (mips) 2>/dev/null
  41. then
  42.     ARCH=mips
  43.     OS=riscos
  44. fi
  45.  
  46. while :
  47. do
  48.     case $1 in
  49.     -a)    ARCH=$2; shift; shift;;
  50.     -o)    OS=$2; shift; shift;;
  51.     -p)    PORT=$2; shift; shift;;
  52.     -t)    TOP=$2; shift; shift;;
  53.     -*)    echo "$USAGE" 1>&2; exit 2;;
  54.     *)    break;;
  55.     esac
  56. done
  57.  
  58. case $OS in
  59. '')    echo "Sorry, can't guess operating system, use -o"; exit 2;;
  60. esac
  61.  
  62. case $ARCH in
  63. '')    echo "Sorry, can't guess architecture, use -a" 1>&2; exit 2;;
  64. esac
  65.  
  66. # Check out how to suppress trailing newline with echo
  67.  
  68. case `echo -n` in
  69. -n)    n=; c='\c';;
  70. '')    n=-n; c=;;
  71. esac
  72.  
  73. # Create top level in the Build tree if necessary
  74.  
  75. if test ! -d $TOP/Build
  76. then
  77.     echo $n "Create $TOP/Build? [ny] $c"
  78.     read reply
  79.     case $reply in
  80.     [yY]*)    mkdir $TOP/Build || exit;;
  81.     *)    exit;;
  82.     esac
  83. fi
  84.  
  85. if test ! -d $TOP/Build/$ARCH
  86. then
  87.     echo $n "Create $TOP/Build/$ARCH? [ny] $c"
  88.     read reply
  89.     case $reply in
  90.     [yY]*)    mkdir $TOP/Build/$ARCH || exit;;
  91.     *)    exit;;
  92.     esac
  93. fi
  94.  
  95. if test ! -d $TOP/Build/$ARCH/$PORT
  96. then
  97.     echo $n "Create $TOP/Build/$ARCH/$PORT? [ny] $c"
  98.     read reply
  99.     case $reply in
  100.     [yY]*)    mkdir $TOP/Build/$ARCH/$PORT || exit;;
  101.     *)    exit;;
  102.     esac
  103. fi
  104.  
  105. case $# in
  106. 0)    set -x; makemakefile $TOP $OS $ARCH $PORT Ports/$PORT lib;;
  107. 1)    set -x; makemakefile $TOP $OS $ARCH $PORT Appls/$1 $1;;
  108. *)    echo "$USAGE" 1>&2; exit 2;;
  109. esac
  110.