home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / gcc-2.95.3-3 / bin / chill < prev    next >
Encoding:
Text File  |  2001-07-15  |  2.8 KB  |  131 lines

  1. #!/bin/sh
  2. # Compile GNU Chill programs.
  3. : || exec /bin/sh -f $0 $argv:q
  4.  
  5. # The compiler name might be different when doing cross-compilation
  6. # (this should be configured)
  7. gcc_name=gcc
  8. whatgcc=/gg/bin/gcc
  9. speclang=-xnone
  10. startfile=/gg/lib/gcc-lib/m68k-amigaos/2.95.3/chillrt0.o
  11. gnuchill_script_flags=""
  12. gnuchill_version=1.5.2
  13. extraflags=
  14.  
  15. # replace the command name by the name of the new command
  16. progname=`basename $0`
  17. case "$0" in
  18.   */*)
  19.     gcc=`echo $0 | sed -e "s;/[^/]*$;;"`/$gcc_name
  20.     ;;
  21.   *)
  22.     gcc=$gcc_name
  23.     ;;
  24. esac
  25.  
  26. # $first is yes for first arg, no afterwards.
  27. first=yes
  28. # If next arg is the argument of an option, $quote is non-empty.
  29. # More precisely, it is the option that wants an argument.
  30. quote=
  31. # $library is made empty to disable use of libchill.
  32. library="-lchill"
  33. libpath=
  34. numargs=$#
  35.  
  36. for arg
  37. do
  38.   if [ $first = yes ]
  39.   then
  40.     # Need some 1st arg to `set' which does not begin with `-'.
  41.     # We get rid of it after the loop ends.
  42.     set gcc
  43.     first=no
  44.   fi
  45.   # If you have to ask what this does, you should not edit this file. :-)
  46.   # The ``S'' at the start is so that echo -nostdinc does not eat the
  47.   # -nostdinc.
  48.   arg=`echo "S$arg" | sed "s/^S//; s/'/'\\\\\\\\''/g"`
  49.   if [ x$quote != x ]
  50.   then
  51.     quote=
  52.   else
  53.     quote=
  54.     case $arg in
  55.       -nostdlib)
  56.     # Inhibit linking with -lchill.
  57.     library=
  58.     libpath=
  59.     startfile=
  60.     ;;
  61.       -B*)
  62.     gcc=`echo $arg | sed -e "s/^-B//"`$gcc_name
  63.     ;;
  64.       -[bBVDUoeTuIYmLiA] | -Tdata | -Xlinker)
  65.     # these switches take following word as argument,
  66.     # so don't treat it as a file name.
  67.     quote=$arg
  68.     ;;
  69.       -[cSEM] | -MM)
  70.     # Don't specify libraries if we won't link,
  71.     # since that would cause a warning.
  72.     library=
  73.     libpath=
  74.     startfile=
  75.     ;;
  76.       -x*)
  77.     speclang=$arg
  78.     ;;
  79.       -v)
  80.     # catch `chill -v'
  81.     if [ $numargs = 1 ] ; then
  82.       library=
  83.       libpath=
  84.       startfile=
  85.     fi
  86.     echo "GNUCHILL version $gnuchill_version"
  87.     ;;
  88.       -fgrant-only | -fchill-grant-only)
  89.         #inhibit production of an object file
  90.         extraflags="-S -o /dev/null"
  91.     library=
  92.     libpath=
  93.     startfile=
  94.         ;;
  95.       -*)
  96.     # Pass other options through; they don't need -x and aren't inputs.
  97.     ;;
  98.       *)
  99.     # If file ends in .i, put options around it.
  100.     # But not if a specified -x option is currently active.
  101.     case "$speclang $arg" in -xnone\ *.[i])
  102.       set "$@" -xchill "'$arg'" -xnone
  103.       continue
  104.     esac
  105.     ;;
  106.     esac
  107.   fi
  108.   set "$@" "'$arg'"
  109. done
  110.  
  111. # Get rid of that initial 1st arg
  112. if [ $first = no ]; then
  113.   shift
  114. else
  115.   echo "$0: No input files specified."
  116.   exit 1
  117. fi
  118.  
  119. if [ x$quote != x ]
  120. then
  121.   echo "$0: argument to \`$quote' missing"
  122.   exit 1
  123. fi
  124.  
  125. # The '-ansi' flag prevents cpp from changing this:
  126. #  NEWMODE x = SET (sun, mon, thu, wed, thu, fri, sat);
  127. #to this:
  128. #  NEWMODE x = SET (1, mon, thu, wed, thu, fri, sat);
  129. #which is a CHILL syntax error.
  130. eval $whatgcc -ansi $gnuchill_script_flags $startfile "$@" $libpath $library $extraflags
  131.