scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

mklib (414B)


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