wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

link (814B)


      1 #!/bin/sh -f
      2 
      3 LD=$1
      4 PACKAGES=$2
      5 LDFLAGS=$3; shift 3
      6 
      7 [ -n "$PACKAGES" ] && LDFLAGS="$(pkg-config --libs $PACKAGES) $LDFLAGS"
      8 
      9 outfile="$1"; shift
     10 bin="$(echo $0 | sed 's,/[^/]*$,,')"
     11 
     12 # Derived from Russ Cox's 9l in plan9port.
     13 ofiles=""
     14 args=""
     15 for i
     16 do
     17 	case "$i" in
     18 	*.[ao]|*.o_pic)
     19 		ofiles="$ofiles $i"
     20 		;;
     21 	*)
     22 		args="$args $i"
     23 		;;
     24 	esac
     25 done
     26 
     27 xtmp=/tmp/ld.$$.$USER.out
     28 
     29 echo LD "$($bin/cleanname ${BASE}$outfile)"
     30 [ -n "$noisycc" ] && echo $LD -o $outfile $ofiles $LDFLAGS $args
     31 $LD -o $outfile $ofiles $LDFLAGS $args >$xtmp 2>&1
     32 status=$?
     33 [ $status -eq 0 ] || echo $LD -o $outfile $ofiles $LDFLAGS $args >&2
     34 
     35 sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . |
     36 egrep -v 'is almost always misused|is dangerous, better use|in statically linked applications requires at runtime'
     37 rm -f $xtmp
     38 
     39 exit $status
     40