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