Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/hints/3b1cc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


# 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 "[email protected]".

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

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].