home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / cellsim / v2_5 / cm2 / rule_mdr / make_fcn.csh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1990-02-26  |  1.5 KB  |  55 lines

  1. #!/bin/csh -f
  2. # Shell-script to compile lookup-table routines
  3. #
  4. # Set MDIR to be the directory where the Function-makefiles and C routines
  5. # are.
  6.  
  7. set MDIR=$1
  8.  
  9. if (-f /bin/arch) then
  10.   set arch=sun4
  11. else
  12.   set arch=vax
  13. endif
  14.  
  15. set TABLE_DIR = $3
  16. set FCN_DIR = $4
  17.  
  18.  
  19. echo "arguments are $*"
  20. set suffix=$2:e
  21. set nborhood = `echo $suffix | sed 's/\(.\).*/\1/'`
  22. echo "nborhood = $nborhood"
  23. set rest = `echo $suffix | sed s/$nborhood//`
  24. set nstates = `echo $rest | sed 's/\([0-9]*\).*/\1/'`
  25. echo "nstates = $nstates"
  26. set rest = `echo $rest | sed s/$nstates//`
  27. set radius=``
  28. if ("$#rest") then
  29.     set char = `echo $rest | sed 's/\(.\).*/\1/'`
  30.     if ("$char" != "r") then
  31.         echo "bad character in filename extension: $char"
  32.         exit 1
  33.     endif
  34.     set radius = `echo $rest | sed s/$char//`
  35.     echo "radius = $radius"
  36. endif
  37.  
  38.  
  39. set compiler="cc"
  40. set extension=".c"
  41.  
  42. if ("$nstates" == "256") then
  43.     echo "making $2.$arch.o"
  44.     $compiler -I$MDIR -c $2$extension
  45.     mv $2.o $2.$arch.o
  46.     if ($FCN_DIR != ".") mv $2.$arch.o $FCN_DIR
  47. else
  48.     if ("$#radius") then
  49.     $compiler -I$MDIR -o MKTABLE -DOUTPUT=\"$2\" -DNSTATES=$nstates $2$extension $MDIR/main_loop.${nborhood}r$radius.c -lm && rm -f $2.o main_loop.${nborhood}r$radius.o && ./MKTABLE && if ($TABLE_DIR != ".") mv $2 $TABLE_DIR
  50.     else
  51.     $compiler -I$MDIR -o MKTABLE -DOUTPUT=\"$2\" -DNSTATES=$nstates $2$extension $MDIR/main_loop.$nborhood.c -lm && rm -f $2.o main_loop.$nborhood.o && ./MKTABLE && if ($TABLE_DIR != ".") mv $2 $TABLE_DIR
  52.     endif
  53.     rm -f ./MKTABLE
  54. endif
  55.