9os

Experimental kernel using plan9 ideas for embedded device
git clone git://git.simple-cc.org/9os
Log | Files | Refs | README | LICENSE

mklib (428B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 PATH=`dirname $0`:$PATH
      6 
      7 usage()
      8 {
      9 	echo usage: mklib [-o library] file ... >&2
     10 	exit 1
     11 }
     12 
     13 for i
     14 do
     15 	case "$1" in
     16 	-o)
     17 		out=$2
     18 		shift 2
     19 		;;
     20 	--)
     21 		shift
     22 		break
     23 		;;
     24 	-*)
     25 		usage
     26 		;;
     27 	esac
     28 done
     29 
     30 case $# in
     31 0)
     32 	usage
     33 	;;
     34 esac
     35 
     36 lib=${out-a.out}
     37 
     38 if ! test -f $lib
     39 then
     40 	${AR:-ar} $ARFLAGS -qv $lib $(lorder $@ | tsort)
     41 else
     42 	${AR:-ar} $ARFLAGS -ruv $lib $(lorder $@ | tsort)
     43 fi
     44 
     45 ${RL:-ranlib} $RLFLAGS $lib