|
|
1.1 root 1: #!/bin/sh
2: # Compile programs, treating .c files as C++.
1.1.1.2 root 3: : || exec /bin/sh -f $0 $argv:q
1.1 root 4:
1.1.1.4 root 5: # The compiler name might be different when doing cross-compilation
6: # (this should be configured)
7: gcc_name=gcc
8: speclang=-xnone
9:
10: # replace the command name by the name of the new command
11: progname=`basename $0`
12: case "$0" in
13: */*)
14: gcc=`echo $0 | sed -e "s;/[^/]*$;;"`/$gcc_name
15: ;;
16: *)
17: gcc=$gcc_name
18: ;;
19: esac
20:
21: # $first is yes for first arg, no afterwards.
22: first=yes
23: # If next arg is the argument of an option, $quote is non-empty.
24: # More precisely, it is the option that wants an argument.
25: quote=
26: # $library is made empty to disable use of libg++.
1.1 root 27: library=-lg++
1.1.1.4 root 28: numargs=$#
1.1 root 29:
1.1.1.4 root 30: # ash requires the newline before `do'.
31: for arg
1.1 root 32: do
1.1.1.4 root 33: if [ $first = yes ]
34: then
35: # Need some 1st arg to `set' which does not begin with `-'.
36: # We get rid of it after the loop ends.
37: set gcc
38: first=no
39: fi
40: # If you have to ask what this does, you should not edit this file. :-)
41: # The ``S'' at the start is so that echo -nostdinc does not eat the
42: # -nostdinc.
43: arg=`echo "S$arg" | sed "s/^S//; s/'/'\\\\\\\\''/g"`
44: if [ x$quote != x ]
1.1 root 45: then
1.1.1.4 root 46: quote=
1.1 root 47: else
1.1.1.4 root 48: quote=
1.1 root 49: case $arg in
50: -nostdlib)
51: # Inhibit linking with -lg++.
52: library=
53: ;;
1.1.1.5 ! root 54: -lm | -lmath)
! 55: # Because libg++ uses things from the math library, make sure it
! 56: # always comes before the math library. We recognize both -lm
! 57: # and -lmath, since on some systems (e.g. m88k SVR3), it
! 58: # doesn't call it libm.a for some reason.
1.1.1.4 root 59: set "$@" $library
60: library=""
61: ;;
1.1 root 62: -[bBVDUoeTuIYmLiA] | -Tdata)
63: # these switches take following word as argument,
64: # so don't treat it as a file name.
1.1.1.4 root 65: quote=$arg
1.1 root 66: ;;
1.1.1.3 root 67: -[cSEM] | -MM)
1.1 root 68: # Don't specify libraries if we won't link,
69: # since that would cause a warning.
70: library=
71: ;;
72: -x*)
1.1.1.4 root 73: speclang=$arg
74: ;;
75: -v)
76: # catch `g++ -v'
77: if [ $numargs = 1 ] ; then library="" ; fi
1.1 root 78: ;;
79: -*)
80: # Pass other options through; they don't need -x and aren't inputs.
81: ;;
82: *)
83: # If file ends in .c or .i, put options around it.
84: # But not if a specified -x option is currently active.
1.1.1.4 root 85: case "$speclang $arg" in -xnone\ *.[ci])
86: set "$@" -xc++ "'$arg'" -xnone
87: continue
88: esac
1.1 root 89: ;;
90: esac
91: fi
1.1.1.4 root 92: set "$@" "'$arg'"
1.1 root 93: done
94:
1.1.1.4 root 95: # Get rid of that initial 1st arg
96: if [ $first = no ]; then
97: shift
98: else
99: echo "$0: No input files specified."
1.1 root 100: exit 1
101: fi
102:
1.1.1.4 root 103: if [ x$quote != x ]
1.1 root 104: then
1.1.1.4 root 105: echo "$0: argument to \`$quote' missing"
106: exit 1
1.1 root 107: fi
1.1.1.4 root 108:
109: eval $gcc "$@" $library
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.