| 1 |
root |
1.1 |
# To incorporate the 7300/3b1 shared library, run this script in place |
| 2 |
|
|
# of 'CC'. |
| 3 |
|
|
# You can skip this is you have the shcc program installed as cc in |
| 4 |
|
|
# your path. |
| 5 |
|
|
# First: Run 'Configure' through to the end and run 'make depend'. |
| 6 |
|
|
# Second: Edit 'makefile' ( not Makefile ) and set CC = 3b1cc. |
| 7 |
|
|
# Third: Edit 'x2p/makefile' and set CC = 3b1cc. |
| 8 |
|
|
# |
| 9 |
|
|
# Do not use '3b1cc' as the default compiler. The call to the default |
| 10 |
|
|
# compiler is used by 'perl' and will not be available when running |
| 11 |
|
|
# 'perl'. |
| 12 |
|
|
# |
| 13 |
|
|
# Note: This script omits libraries which are redundant in the shared |
| 14 |
|
|
# library. It is an excerpt from a grander version available upon |
| 15 |
|
|
# request from "zebra!vern" or "vern@zebra.alphacdc.com". |
| 16 |
|
|
|
| 17 |
|
|
CC="cc" |
| 18 |
|
|
LIBS= |
| 19 |
|
|
INCL= |
| 20 |
|
|
|
| 21 |
|
|
LD="ld" |
| 22 |
|
|
SHAREDLIB="/lib/crt0s.o /lib/shlib.ifile" |
| 23 |
|
|
|
| 24 |
|
|
# Local variables |
| 25 |
|
|
COBJS= |
| 26 |
|
|
LOBJS= |
| 27 |
|
|
TARG= |
| 28 |
|
|
FLAGS= |
| 29 |
|
|
CMD= |
| 30 |
|
|
|
| 31 |
|
|
# These are libraries which are incorporated in the shared library |
| 32 |
|
|
OMIT="-lmalloc" |
| 33 |
|
|
|
| 34 |
|
|
# These routines are in libc.a but not in the shared library |
| 35 |
|
|
if [ ! -f vsprintf.o -o ! -f doprnt.o ] |
| 36 |
|
|
then |
| 37 |
|
|
echo "Extracting vsprintf.o from libc.a" |
| 38 |
|
|
ar -x /lib/libc.a vsprintf.o doprnt.o |
| 39 |
|
|
fi |
| 40 |
|
|
|
| 41 |
|
|
CMD="$CC" |
| 42 |
|
|
while [ $# -gt 0 ] |
| 43 |
|
|
do |
| 44 |
|
|
case $1 in |
| 45 |
|
|
-c) CFLAG=$1;; |
| 46 |
|
|
-o) CFLAG=$1 |
| 47 |
|
|
shift |
| 48 |
|
|
TARG="$1";; |
| 49 |
|
|
-l*) match=false |
| 50 |
|
|
for i in $OMIT |
| 51 |
|
|
do |
| 52 |
|
|
[ "$i" = "$1" ] && match=true |
| 53 |
|
|
done |
| 54 |
|
|
[ "$match" != false ] || LIBS="$LIBS $1";; |
| 55 |
|
|
-*) FLAGS="$FLAGS $1";; |
| 56 |
|
|
*.c) COBJS="$COBJS $1";; |
| 57 |
|
|
*.o) LOBJS="$LOBJS $1";; |
| 58 |
|
|
*) TARG="$1";; |
| 59 |
|
|
esac |
| 60 |
|
|
shift |
| 61 |
|
|
done |
| 62 |
|
|
|
| 63 |
|
|
if [ -n "$COBJS" ] |
| 64 |
|
|
then |
| 65 |
|
|
CMD="$CMD $FLAGS $INCL $LPATHS $LIBS $COBJS $CFLAG $TARG" |
| 66 |
|
|
elif [ -n "$LOBJS" ] |
| 67 |
|
|
then |
| 68 |
|
|
LOBJS="$LOBJS vsprintf.o doprnt.o" |
| 69 |
|
|
CMD="$LD -r $LOBJS $LPATHS $LIBS -o temp.o" |
| 70 |
|
|
echo "\t$CMD" |
| 71 |
|
|
$CMD |
| 72 |
|
|
CMD="$LD -s temp.o $SHAREDLIB -o $TARG" |
| 73 |
|
|
echo "\t$CMD" |
| 74 |
|
|
$CMD |
| 75 |
|
|
ccrslt=$? |
| 76 |
|
|
if [ $ccrslt -ne 0 ] |
| 77 |
|
|
then |
| 78 |
|
|
exit $ccrslt |
| 79 |
|
|
fi |
| 80 |
|
|
CMD="rm -f temp.o" |
| 81 |
|
|
else |
| 82 |
|
|
exit 1 |
| 83 |
|
|
fi |
| 84 |
|
|
echo "\t$CMD" |
| 85 |
|
|
$CMD |
| 86 |
|
|
ccrslt=$? |
| 87 |
|
|
rm -f $$.c |
| 88 |
|
|
exit $ccrslt |