# 
# Mach Operating System
# Copyright (c) 1992 Carnegie Mellon University
# All Rights Reserved.
# 
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
# 
# CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 
# CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
# ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
# 
# Carnegie Mellon requests users of this software to return to
# 
#  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
#  School of Computer Science
#  Carnegie Mellon University
#  Pittsburgh PA 15213-3890
# 
# any improvements or extensions that they make and grant Carnegie the
# rights to redistribute these changes.
# 
#
# HISTORY
# $Log:	Makefile-lib,v $
# Revision 2.3  92/03/05  22:47:22  rpd
# 	Changed to use double-colon rules for top-level targets.
# 	Moved man page rules to Makefile-man.
# 	[92/02/28            rpd]
# 
# Revision 2.2  92/01/22  23:18:01  rpd
# 	Created.
# 	[92/01/17            rpd]
# 

# Makefile-lib is intended for simple libraries.
# Makefiles using it should look like
#
#	include ${MAKETOP}Makefile-common
#
#	LIBRARY = libfoo.a
#
#	OBJECTS = foo.o bar.o
#
#	include ${MAKETOP}Makefile-lib
#	-include Makedep
#
# The library is made from OBJECTS.
#
# If for some reason the library should be installed in a directory
# other than lib/, the Makefile can redefine LIBDIR.
# (Its normal definition is in Makefile-common.)
#
# Makefile-man can be used to install man pages associated with the library.

ILIBTARGET = ${INSTALLDIR}/${LIBDIR}${LIBRARY}

TLIBTARGET = ${TRELEASEDIR}/${LIBDIR}${LIBRARY}

FLIBTARGET = ${FRELEASEDIR}/${LIBDIR}${LIBRARY}

# Top-level targets:
# If the Makefile wants to do more stuff, it can also have its own
# all/install/release/clean rules.

all :: ${LIBRARY}

install :: ${ILIBTARGET}

release :: ${TLIBTARGET}

clean ::
	${RM} ${ILIBTARGET}

# installation rules

${ILIBTARGET} : ${LIBRARY}
	${RM} $@
	${CP} $? $@
	${CHMOD_LIB} $@

# release rules

${TLIBTARGET} : ${FLIBTARGET}
	${RM} $@
	${CP} $? $@

# build rules

${LIBRARY} : ${OBJECTS}
	${RM} $@
	${AR} cq $@ ${OBJECTS}
	${RANLIB} $@
