#############################################################################
#	$RCSfile: Makefile,v $
#	$Revision: 0.13 $
#	$Author: ripe-dbm $
#	$Date: 1995/07/07 16:05:30 $
#############################################################################
#
# YOU ARE NOT SUPPOSED TO MAKE CHANGES TO ANYTHING BELOW
#
#############################################################################

LIBS=	rconf dbopen dbclose donetdbm enread 			\
	addkey enkeys enukey misc entype syslog dbmatch enwrite \
	adderror dbadd defines encmp enparse syntax dblock	\
	updatecheck rfc822 handle notify defaults template	\
	maintainer net2net serial cldb time

PROGS=	showdbm netdbm whoisd dbupdate newdb cleandb sortdb whois backupupd

# cleanhandledb checkupd

BINMODE= 755
LIBMODE= 644

.SUFFIXES: .pl .


default:
	@echo "-- DO NOT RUN MAKE HERE, ONE DIRECTORY UP PLEASE --"

all:	$(LIBS) $(PROGS)


.pl:	Makefile
	install -c -m $(LIBMODE) $< $(LIBDIR)/$<


checkupd:	checkupd.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'	\
		-e 's:DEFCONFIG:$(DEFCONFIG):g'	\
		-e 's:PERL:$(PERL):g'	\
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< checkupd.pl > $@
	chmod $(BINMODE) $@


netdbm:	netdbm.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'	\
		-e 's:DEFCONFIG:$(DEFCONFIG):g'	\
		-e 's:PERL:$(PERL):g'	\
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< netdbm.pl > $@
	chmod $(BINMODE) $@

backupupd: backupupd.pl
	sed	-e 's:BINDIR:$(BINDIR):g'        \
		-e 's:LIBDIR:$(LIBDIR):g'       \
		-e 's:DEFCONFIG:$(DEFCONFIG):g'  \
		-e 's:PERL:$(PERL):g'    \
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< backupupd.pl > $@
	chmod $(BINMODE) $@

showdbm: showdbm.pl
	sed	-e 's:PERL:$(PERL):g'		\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< showdbm.pl > $@
	chmod $(BINMODE) $@


whoisd:	whoisd.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'        \
		-e 's:DEFCONFIG:$(DEFCONFIG):g'  \
		-e 's:PERL:$(PERL):g'    \
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< whoisd.pl > $@
	chmod $(BINMODE) $@


cleandb: cleandb.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'	\
		-e 's:DEFCONFIG:$(DEFCONFIG):g'	\
		-e 's:PERL:$(PERL):g'	\
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< cleandb.pl > $@
	chmod $(BINMODE) $@


newdb:	newdb.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'	\
		-e 's:DEFCONFIG:$(DEFCONFIG):g'	\
		-e 's:PERL:$(PERL):g'	\
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< newdb.pl > $@
	chmod $(BINMODE) $@


dbupdate:	dbupdate.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'	\
		-e 's:DEFCONFIG:$(DEFCONFIG):g'	\
		-e 's:PERL:$(PERL):g'	\
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< dbupdate.pl > $@
	chmod $(BINMODE) $@


sortdb:	sortdb.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'	\
		-e 's:DEFCONFIG:$(DEFCONFIG):g'	\
		-e 's:PERL:$(PERL):g'	\
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< sortdb.pl > $@
	chmod $(BINMODE) $@

cleanhandledb:	cleanhandledb.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'	\
		-e 's:DEFCONFIG:$(DEFCONFIG):g'	\
		-e 's:PERL:$(PERL):g'	\
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		-e 's:USE_DBM:$(USE_DBM):g'	\
		< cleanhandledb.pl > $@
	chmod $(BINMODE) $@

whois: whois.pl
	sed	-e 's:LIBDIR:$(LIBDIR):g'	\
		-e 's:DEFCONFIG:$(DEFCONFIG):g'	\
		-e 's:PERL:$(PERL):g'	\
		-e 's:SOCKSTREAMVALUE:$(SOCKSTREAMVALUE):g'	\
		-e 's:WHOISPORT:$(WHOISPORT):g'	\
		< whois.pl > $@
	chmod $(BINMODE) $@


install: $(PROGS) $(LIBS)
	install -m $(BINMODE) $(PROGS) $(BINDIR)


clean:
	rm -f $(PROGS) core
