
#
# Copyright (c) 1983 Regents of the University of California.
# All rights reserved.  The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
#	@(#)Makefile	5.4 (Berkeley) 9/5/85
#

OBJS=  \
	_dbm_close.o	\
	_dbm_delete.o	\
	_dbm_fetch.o	\
	_dbm_frstkey.o	\
	_dbm_forder.o	\
	_dbm_nextkey.o	\
	_dbm_open.o	\
	_dbm_store.o	\
	_p_cdname.o	\
	_p_class.o	\
	_p_rr.o	\
	_p_time.o	\
	_p_type.o	\
	_fp_query.o

SRCS=  \
	_dbm_close.s	\
	_dbm_delete.s	\
	_dbm_fetch.s	\
	_dbm_frstkey.s	\
	_dbm_forder.s	\
	_dbm_nextkey.s	\
	_dbm_open.s	\
	_dbm_store.s	\
	_p_cdname.s	\
	_p_class.s	\
	_p_rr.s	\
	_p_time.s	\
	_p_type.s	\
	_fp_query.s

CFLAGS=	-O ${DEFS}

.c.o: 
	${CC} ${CFLAGS} -c $*.c

../libbsd.a: ${OBJS}
	${AR} rv ../libbsd.a ${OBJS}
	rm -f ${OBJS}
	
tags:
	cwd=`pwd`; \
	for i in ${SRCS}; do \
		ctags -a -f ${TAGSFILE} $$cwd/$$i; \
	done

clean:
	rm -f *.o errs a.out core hostlib hostlib_p profiled/*.o \
		tags Makefile.bak

depend:
	for i in ${SRCS}; do \
	    cc -M ${CFLAGS} $$i | oawk ' { if ($$1 != prev) \
		{ if (rec != "") print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		else rec = rec " " $$2 } } \
		END { print rec } ' >> makedep; done
	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	ed - Makefile < eddep
	rm eddep makedep
	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
	echo '# see make depend above' >> Makefile

# DO NOT DELETE THIS LINE -- make depend uses it
