#!/bin/sh

# Construct a segment of a Makefile for a library.
# Writes to stdout.
#
# usage: putlibmf target $(SRCS)

# Check that we have enough arguments
#
case $# in
0|1)	echo "usage: $0 target $(SRCS)" 1>&2; exit 2;;
esac


# Extract arguments; remaining arguments are source files
#
TARGET=$1; shift

putobjs "OBJS" $*

# Construct rule to build target
#
echo
echo "$TARGET: \$(OBJS)"
echo "	ar cr @$TARGET \$(OBJS)"
echo "	\$(RANLIB) @$TARGET"
echo "	mv @$TARGET $TARGET"
#     ^^these are tabs!
echo
echo ".PRECIOUS: $TARGET"

puttargets $*
