# Generic lib Makefile

# RCSid:
#	$Id: Makefile,v 1.12 1997/02/08 07:12:59 sjg Exp $
#
#	@(#) Copyright (c) 1994 Simon J. Gerraty
#
#	This file is provided in the hope that it will
#	be of use.  There is absolutely NO WARRANTY.
#	Permission to copy, redistribute or otherwise
#	use this file is hereby granted provided that 
#	the above copyright notice and this notice are
#	left intact. 
#      
#	Please send copies of changes and bug-fixes to:
#	sjg@quick.com.au
#

LIB=	${.CURDIR:T}

#SRCS=	${.CURDIR}/*.c

.if exists(${.CURDIR}/.srcs)
.include "${.CURDIR}/.srcs"
.else
all: .srcs
.endif


NOMAN=no
NOPROFILE=no
NOPIC=no

.include <bsd.lib.mk>

.if exists(${.CURDIR}/.cfg)
.include "${.CURDIR}/.cfg"
.endif

.PRECIOUS: .srcs

.ifnmake .srcs
_x=false
.endif

.srcs:
	@echo "SRCS= \\" > ${.CURDIR}/.srcs
	@cd ${.CURDIR} && /bin/ls -1 *.c | paste -s -d"     \n" - | sed -e 's/^/	/' -e 's/$$/ \\/' >> ${.CURDIR}/.srcs
	@echo >> ${.CURDIR}/.srcs
	@echo Updated .srcs now re-run ${MAKE}; ${_x}

# for testing
LDADD+= -L${.CURDIR}/obj.${MACHINE} -l${LIB}

.SUFFIXES:	.test

.c.test:
	${CC} ${CFLAGS} ${LDSTATIC} -DMAIN -o ${.TARGET} ${.IMPSRC} ${LDADD}

