#!/bin/csh -f
#	$NetBSD: makelib,v 1.2 1999/11/25 18:51:47 erh Exp $

# simplistic library builder
# usage: makelib is_elf outfile.so.x.y infile...

#echo __ELF__ | $CC -E - | grep -q __ELF__
setenv IS_ELF $1
shift
if ($IS_ELF == 0) then
	ld -Bshareable -Bforcearchive -o $* |& sed /RRS/d || exit 1
else
	ld -shared -soname $1:r --whole-archive -o $* || exit 1
	ln -sf $1 $1:r
	ln -sf $1 $1:r:r
endif
