home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / cellsim / v2_5 / rule_mdr / make_fcn.csh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1990-02-26  |  1.4 KB  |  49 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. set arch=`/bin/arch`
  9.  
  10. set TABLE_DIR = $3
  11. set FCN_DIR = $4
  12.  
  13.  
  14. echo "arguments are $*"
  15. set suffix=$2:e
  16. set nborhood = `echo $suffix | sed 's/\(.\).*/\1/'`
  17. echo "nborhood = $nborhood"
  18. set rest = `echo $suffix | sed s/$nborhood//`
  19. set nstates = `echo $rest | sed 's/\([0-9]*\).*/\1/'`
  20. echo "nstates = $nstates"
  21. set rest = `echo $rest | sed s/$nstates//`
  22. set radius=``
  23. if ("$#rest") then
  24.     set char = `echo $rest | sed 's/\(.\).*/\1/'`
  25.     if ("$char" != "r") then
  26.         echo "bad character in filename extension: $char"
  27.         exit 1
  28.     endif
  29.     set radius = `echo $rest | sed s/$char//`
  30.     echo "radius = $radius"
  31. endif
  32.  
  33.  
  34. set compiler="cc"
  35. set extension=".c"
  36.  
  37. if ("$nstates" == "256") then
  38.     echo "making $2.$arch.o"
  39.     $compiler -I$MDIR -c -o $2.$arch.o $2$extension
  40.     if ($FCN_DIR != ".") mv $2.$arch.o $FCN_DIR
  41. else
  42.     if ("$#radius") then
  43.     $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
  44.     else
  45.     $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
  46.     endif
  47.     rm -f ./MKTABLE
  48. endif
  49.