#-------------------------------------------------------------------------
#
# postgres.lib.mk--
#    rules for building libraries. To use the rules, set the following
#    variables:
#	LIBSRCS    - source files for objects to be built in the library
#	LIB	   - name of the library (eg. LIB=pq for libpq.a)
#    postgres.mk should be included before this file.
#
# Copyright (c) 1994-5, Regents of the University of California
#
#
# IDENTIFICATION
#    $Header: /usr/local/devel/pglite/cvs/src/mk/postgres.lib.mk,v 1.5 1995/04/08 03:48:28 andrew Exp $
#
#-------------------------------------------------------------------------

LIBOBJS:=	$(LIBSRCS:.c=.o)
lib:=		lib$(LIB).a

$(lib):	$(addprefix $(objdir)/,$(LIBOBJS))
	@rm -f $(objdir)/$(lib)
	cd $(objdir); $(AR) $(AROPT) $(lib) `lorder $(LIBOBJS) | tsort`; $(RANLIB) $(lib)

CLEANFILES+= $(LIBOBJS) $(lib)

install:: localobj $(lib)
	$(INSTALL) $(INSTL_LIB_OPTS) $(objdir)/$(lib) $(DESTDIR)$(LIBDIR)/$(lib)
	@cd $(DESTDIR)$(LIBDIR); $(RANLIB) $(lib)


