summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/hints/3b1cc
blob: 0001e046b8c9b06cb11334661cec70069c2457e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# To incorporate the 7300/3b1 shared library, run this script in place
# of 'CC'.
# You can skip this is you have the shcc program installed as cc in
# your path.
# First: Run 'Configure' through to the end and run 'make depend'.
# Second: Edit 'makefile' ( not Makefile ) and set CC = 3b1cc.
# Third: Edit 'x2p/makefile' and set CC = 3b1cc.
#
# Do not use '3b1cc' as the default compiler.  The call to the default
# compiler is used by 'perl' and will not be available when running
# 'perl'.
#
# Note: This script omits libraries which are redundant in the shared
# library.  It is an excerpt from a grander version available upon
# request from "zebra!vern" or "vern@zebra.alphacdc.com".

CC="cc"
LIBS=
INCL=

LD="ld"
SHAREDLIB="/lib/crt0s.o /lib/shlib.ifile"

# Local variables
COBJS=
LOBJS=
TARG=
FLAGS=
CMD=

# These are libraries which are incorporated in the shared library
OMIT="-lmalloc"

# These routines are in libc.a but not in the shared library
if [ ! -f vsprintf.o -o ! -f doprnt.o ]
then
	echo "Extracting vsprintf.o from libc.a"
	ar -x /lib/libc.a vsprintf.o doprnt.o
fi

CMD="$CC"
while [ $# -gt 0 ]
do
	case $1 in
	-c)	CFLAG=$1;;
	-o)	CFLAG=$1
		shift
		TARG="$1";;
	-l*)	match=false
		for i in $OMIT
		do
			[ "$i" = "$1" ] && match=true
		done
		[ "$match" != false ] || LIBS="$LIBS $1";;
	-*)	FLAGS="$FLAGS $1";;
	*.c)	COBJS="$COBJS $1";;
	*.o)	LOBJS="$LOBJS $1";;
	*)	TARG="$1";;
	esac
	shift
done

if [ -n "$COBJS" ]
then
	CMD="$CMD $FLAGS $INCL $LPATHS $LIBS $COBJS $CFLAG $TARG"
elif [ -n "$LOBJS" ]
then
	LOBJS="$LOBJS vsprintf.o doprnt.o"
	CMD="$LD -r $LOBJS $LPATHS $LIBS -o temp.o"
	echo "\t$CMD"
	$CMD
	CMD="$LD -s temp.o $SHAREDLIB -o $TARG"
	echo "\t$CMD"
	$CMD
	ccrslt=$?
	if [ $ccrslt -ne 0 ]
	then
		exit $ccrslt
	fi
	CMD="rm -f temp.o"
else
	exit 1
fi
echo "\t$CMD"
$CMD
ccrslt=$?
rm -f $$.c	
exit $ccrslt