#!/bin/sh # scripts/kcc-ar2 # # Script to insert a module into an archive with KCC. # Use this when --no_split is used to avoid a bug where KCC will # delete needed template instantiations. # # sss Feb, 1998. # args=$* # Pull the object files and the target library out from the arglist. objlist="" target_lib="" next_is_lib=0 for a in $args do if [ `expr $a : '.*\.o'` -ne 0 ]; then objlist="$objlist $a" fi if [ $next_is_lib -eq 1 ]; then target_lib=$a next_is_lib=0 fi if [ $a = '-o' ]; then next_is_lib=1 fi done if [ "$target_lib" != "" -a "$objlist" != "" ]; then # Pull the objects out of the target library. # Insert them first to avoid `not found' errors. ar cr $target_lib $objlist # Remove directory names from the objects. baseobjs="" for o in $objlist; do baseobjs="$baseobjs `basename $o`"; done # Do the removal. ar d $target_lib $baseobjs fi # On linux, the prelinker doesn't automatically see the target library??? if [ `expr $BFARCH : Linux2` != 0 ]; then args="$args $target_lib" fi # Now do it for real. KCC $args