wmii/util/link

38 lines
720 B
Plaintext
Raw Normal View History

#!/bin/sh -f
2009-10-10 00:40:33 +04:00
LD=$1
LDFLAGS=$2; shift 2
outfile="$1"; shift
bin="$(echo $0 | sed 's,/[^/]*$,,')"
# Derived from Russ Cox's 9l in plan9port.
ofiles=""
args=""
for i
do
case "$i" in
*.[ao]|*.o_pic)
ofiles="$ofiles $i"
;;
*)
args="$args $i"
;;
esac
done
xtmp=/tmp/ld.$$.$USER.out
echo LD "$($bin/cleanname ${BASE}$outfile)"
2007-07-17 00:52:35 +04:00
[ -n "$noisycc" ] && echo $LD -o $outfile $ofiles $LDFLAGS $args
$LD -o $outfile $ofiles $LDFLAGS $args >$xtmp 2>&1
status=$?
2008-08-25 20:47:56 +04:00
[ $? -eq 0 ] || $LD -o $outfile $ofiles $LDFLAGS $args >&2
sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . |
2008-01-21 03:10:40 +03:00
egrep -v 'is almost always misused|is dangerous, better use|in statically linked applications requires at runtime'
rm -f $xtmp
exit $status