home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / perl / os2perl / cflags.sh < prev    next >
Text File  |  1991-06-11  |  2KB  |  85 lines

  1. case $CONFIG in
  2. '')
  3.     if test ! -f config.sh; then
  4.     ln ../config.sh . || \
  5.     ln ../../config.sh . || \
  6.     ln ../../../config.sh . || \
  7.     (echo "Can't find config.sh."; exit 1)
  8.     fi
  9.     . config.sh
  10.     ;;
  11. esac
  12. : This forces SH files to create target in same directory as SH file.
  13. : This is so that make depend always knows where to find SH derivatives.
  14. case "$0" in
  15. */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  16. esac
  17. echo "Extracting cflags (with variable substitutions)"
  18. : This section of the file will have variable substitutions done on it.
  19. : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
  20. : Protect any dollar signs and backticks that you do not want interpreted
  21. : by putting a backslash in front.  You may delete these comments.
  22. $spitshell >cflags <<!GROK!THIS!
  23. !GROK!THIS!
  24.  
  25. : In the following dollars and backticks do not need the extra backslash.
  26. $spitshell >>cflags <<'!NO!SUBS!'
  27. case "$0" in
  28. */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  29. esac
  30. case $CONFIG in
  31. '')
  32.     if test ! -f config.sh; then
  33.     ln ../config.sh . || \
  34.     ln ../../config.sh . || \
  35.     ln ../../../config.sh . || \
  36.     (echo "Can't find config.sh."; exit 1)
  37.     fi 2>/dev/null
  38.     . ./config.sh
  39.     ;;
  40. esac
  41.  
  42. also=': '
  43. case $# in
  44. 1) also='echo 1>&2 "      CCCMD = "'
  45. esac
  46.  
  47. case $# in
  48. 0) set *.c; echo "The current C flags are:" ;;
  49. esac
  50.  
  51. set `echo "$* " | sed 's/\.[oc] / /g'`
  52.  
  53. for file do
  54.  
  55.     case "$#" in
  56.     1) ;;
  57.     *) echo $n "    $file.c    $c" ;;
  58.     esac
  59.  
  60.     : allow variables like str_cflags to be evaluated
  61.  
  62.     eval 'eval ${'"${file}_cflags"'-""}'
  63.  
  64.     : or customize here
  65.  
  66.     case "$file" in
  67.     a2p) ;;
  68.     a2py) ;;
  69.     hash) ;;
  70.     str) ;;
  71.     util) ;;
  72.     walk) ;;
  73.     *) ;;
  74.     esac
  75.  
  76.     echo "$cc -c $ccflags $optimize $large $split"
  77.     eval "$also "'"$cc -c $ccflags $optimize $large $split"'
  78.  
  79.     . ./config.sh
  80.  
  81. done
  82. !NO!SUBS!
  83. chmod +x cflags
  84. $eunicefix cflags
  85.