home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / m / mawk11as.zip / BUILD_MA.WK < prev    next >
Text File  |  1991-12-18  |  3KB  |  148 lines

  1. #!/bin/sh
  2. #
  3. # build_mawk -- build mawk for a known configuration
  4. #
  5. #  usage:  build_mawk configuration  [CC=your_cc]  
  6. #       build_mawk MF
  7. #
  8. #  example:  build_mawk sun_os40  CC=gcc 
  9. #
  10. #            build_mawk MF -- to get a generic Makefile
  11. #
  12.  
  13. progname=`basename $0`
  14.  
  15.  
  16. if [ $# = 0 ]
  17.    then
  18.     echo usage: $progname  configuration [CC=your_cc]  1>&2
  19.     echo "       $progname MF"     1>&2
  20.     echo  1>&2
  21.     echo tested configurations are listed in UCONFIG  1>&2
  22.     echo MF builds a fresh Makefile  1>&2
  23.     exit 1 
  24. fi
  25.  
  26. config=$1
  27. shift
  28.  
  29. [ $# != 0 ] && eval "$@"
  30.  
  31.  
  32. [ "$CC" = "" ] && CC=cc
  33.  
  34.  
  35. case $config in
  36.  
  37.  
  38. sun_os40)
  39.     if  sun3 && [ $CC = cc ]
  40.         then cflags='-O -f68881'
  41.     fi
  42.     config=sun_os40.h ;;
  43.  
  44. sun3_os40_no68881)
  45.     config=sun_os40.h  ;;
  46.  
  47.  
  48. sun_os41)    
  49.     if  sun3 && [ $CC = cc ]
  50.         then cflags='-O -f68881'
  51.     fi
  52.     config=sun_os41.h ;;
  53.  
  54. sun3_os41_no68881)
  55.     config=sun_os41.h ;;
  56.  
  57. bsd43_vax)
  58.     config=bsd43_vax.h ;;
  59.  
  60. ultrix41_mips)
  61.     config=generic.h  ;;
  62.  
  63. ultrix42_mips)
  64.     config=ultrix42_mips.h
  65.     cflags='-O -Olimit 700' ;;
  66.  
  67. ultrix41_vax)
  68.     config=ultrix_vax.h 
  69.     cflags='-O -YSYSTEM_FIVE' ;;
  70.  
  71. ultrix31_vax)
  72.     config=ultrix_vax.h
  73.     cflags='-O -YSYSTEM_FIVE -DHAVE_VOID_PTR=0' ;;
  74.  
  75. stardentVr3)
  76.     config=generic.h  ;;
  77.  
  78. xenix_r2)
  79.     config=xenix_r2.h   ;;
  80.  
  81. sysV)
  82.     config=sysV.h  ;;
  83.  
  84. sysV_ieeefp)
  85.     config=sysV_ieeefp.h ;;
  86.  
  87. # SCO UNIX has ranlib, but doesn't use it for native UNIX libraries
  88. sysVsco)
  89.     config=sysV.h
  90.     ranlib=: ;;
  91.  
  92. apolloSR10.3)
  93.     config=apollo.h  ;;
  94.  
  95. dynix)
  96.     config=dynix.h  ;;
  97.  
  98. atarist)
  99.     config=atarist.h
  100.         ranlib=:
  101.     ar=car
  102.         mathlib=-lpml
  103.     CC=cgcc ;;
  104.     
  105. mips)
  106.     config=mips.h
  107.     cflags='-O -systype bsd43' ;;
  108.  
  109. MF)  ;;
  110.  
  111. *)  echo "$progname: $1: unrecognized configuration" 1>&2
  112.     exit 1 ;;
  113. esac
  114.  
  115. [ "$cflags" = "" ] && cflags=-O
  116. [ "$ranlib" = "" ] && ranlib=ranlib
  117. [ "$ar" = "" ] && ar=ar
  118. [ "$mathlib" = "" ] && mathlib=-lm
  119.  
  120. echo generating a Makefile
  121.  
  122. (
  123. echo "# This Makefile was generated by"
  124. echo '#'"   $0 $config $*"
  125. sed -e 1,5d   \
  126.     -e "s/%CC%/$CC/" \
  127.     -e "s/%CFLAGS%/$cflags/" \
  128.     -e "s/%RANLIB%/$ranlib/" \
  129.     -e "s/%AR%/$ar/" \
  130.     -e "s/%MATHLIB%/$mathlib/"  Makefile.in
  131. ) > Makefile
  132.  
  133. [ $config = MF ]  &&  exit 0
  134.  
  135. rm -f  config.h
  136. echo linking config/$config to config.h
  137. ln   config/$config  config.h
  138.  
  139. # make sure parse.c is not made if it exists
  140. # it should exist
  141. [ -f parse.c ] &&  { echo touching parse.c  ; touch parse.c ; }
  142.  
  143. echo make -f Makefile
  144. make -f Makefile
  145.  
  146.  
  147.  
  148.