#-----------------------------------------------------------------------------
# Copyright (c) 1995 Regents of the University of Michigan.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that this notice is preserved and that due credit is given
# to the University of Michigan at Ann Arbor. The name of the University
# may not be used to endorse or promote products derived from this
# software without specific prior written permission. This software
# is provided ``as is'' without express or implied warranty.
#
#       ldbm backend to stand-alone LDAP server makefile
#
#-----------------------------------------------------------------------------
LDAPSRC	= ../../..
HDIR	= $(LDAPSRC)/include
LDIR	= $(LDAPSRC)/libraries
VERSIONFILE = $(LDAPSRC)/build/version

SRCS	= idl.c add.c search.c cache.c dbcache.c dn2id.c id2entry.c \
		index.c id2children.c nextid.c abandon.c compare.c \
		modify.c modrdn.c delete.c init.c config.c bind.c attr.c \
		filterindex.c unbind.c kerberos.c close.c
OBJS	= idl.o add.o search.o cache.o dbcache.o dn2id.o id2entry.o \
		index.o id2children.o nextid.o abandon.o compare.o \
		modify.o modrdn.o delete.o init.o config.o bind.o attr.o \
		filterindex.o unbind.o kerberos.o close.o

INCLUDES= -I. -I.. -I$(HDIR) $(KRBINCLUDEFLAG)
DEFINES = $(DEFS) $(THREADS)
CFLAGS	= $(INCLUDES) $(THREADSINCLUDE) $(DEFINES) $(ACFLAGS)
LDFLAGS	= -L$(LDIR) $(KRBLIBFLAG)

all:	FORCE
	-@echo "$(SLAPD_BACKENDS)" | grep LDAP_LDBM 2>&1 > /dev/null; \
	if [ $$? = 0 ]; then \
            $(MAKE) $(MFLAGS) CC=$(CC) libback-ldbm.a; \
	else \
	    echo "Include -DLDAP_LDBM in SLAPD_BACKENDS in the"; \
	    echo "Make-common file to build the ldbm backend"; \
        fi

libback-ldbm.a:	version.o
	$(AR) ruv $@ $(OBJS) version.o
	@if [ ! -z "$(RANLIB)" ]; then \
		$(RANLIB) $@; \
	fi
	@touch ../.backend

version.c: $(OBJS)
	$(RM) $@
	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
	-e "s|%VERSION%|$${v}|" \
	< Version.c > $@)

lint:	FORCE
	$(LINT) $(INCLUDES) $(DEFINES) $(SRCS)

5lint:	FORCE
	$(5LINT) $(INCLUDES) $(DEFINES) $(SRCS)

clean:	FORCE
	$(RM) libback-ldbm.a *.o core a.out version.c

depend:	FORCE
	$(MKDEP) $(INCLUDES) $(DEFINES) $(SRCS)

links:
	@$(LN) .src/*.[ch] .
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

idl.o: idl.c ../slap.h ../../../include/avl.h ../../../include/lber.h
idl.o: ../../../include/ldap.h ../../../include/lthread.h
idl.o: ../../../include/ldif.h ../../../include/ldapconfig.h back-ldbm.h
idl.o: ../../../include/ldbm.h
add.o: add.c ../slap.h ../../../include/avl.h ../../../include/lber.h
add.o: ../../../include/ldap.h ../../../include/lthread.h
add.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
search.o: search.c ../slap.h ../../../include/avl.h ../../../include/lber.h
search.o: ../../../include/ldap.h ../../../include/lthread.h
search.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
cache.o: cache.c ../slap.h ../../../include/avl.h ../../../include/lber.h
cache.o: ../../../include/ldap.h ../../../include/lthread.h
cache.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
dbcache.o: dbcache.c ../../../include/portable.h ../slap.h
dbcache.o: ../../../include/avl.h ../../../include/lber.h
dbcache.o: ../../../include/ldap.h ../../../include/lthread.h
dbcache.o: ../../../include/ldif.h ../../../include/ldapconfig.h back-ldbm.h
dbcache.o: ../../../include/ldbm.h
dn2id.o: dn2id.c ../slap.h ../../../include/avl.h ../../../include/lber.h
dn2id.o: ../../../include/ldap.h ../../../include/lthread.h
dn2id.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
id2entry.o: id2entry.c ../slap.h ../../../include/avl.h ../../../include/lber.h
id2entry.o: ../../../include/ldap.h ../../../include/lthread.h
id2entry.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
index.o: index.c ../slap.h ../../../include/avl.h ../../../include/lber.h
index.o: ../../../include/ldap.h ../../../include/lthread.h
index.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
id2children.o: id2children.c ../slap.h ../../../include/avl.h
id2children.o: ../../../include/lber.h ../../../include/ldap.h
id2children.o: ../../../include/lthread.h ../../../include/ldif.h back-ldbm.h
id2children.o: ../../../include/ldbm.h
nextid.o: nextid.c ../slap.h ../../../include/avl.h ../../../include/lber.h
nextid.o: ../../../include/ldap.h ../../../include/lthread.h
nextid.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
abandon.o: abandon.c
compare.o: compare.c ../slap.h ../../../include/avl.h ../../../include/lber.h
compare.o: ../../../include/ldap.h ../../../include/lthread.h
compare.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
modify.o: modify.c ../slap.h ../../../include/avl.h ../../../include/lber.h
modify.o: ../../../include/ldap.h ../../../include/lthread.h
modify.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
modrdn.o: modrdn.c ../slap.h ../../../include/avl.h ../../../include/lber.h
modrdn.o: ../../../include/ldap.h ../../../include/lthread.h
modrdn.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
delete.o: delete.c ../slap.h ../../../include/avl.h ../../../include/lber.h
delete.o: ../../../include/ldap.h ../../../include/lthread.h
delete.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
init.o: init.c ../slap.h ../../../include/avl.h ../../../include/lber.h
init.o: ../../../include/ldap.h ../../../include/lthread.h
init.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
config.o: config.c ../slap.h ../../../include/avl.h ../../../include/lber.h
config.o: ../../../include/ldap.h ../../../include/lthread.h
config.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
bind.o: bind.c ../slap.h ../../../include/avl.h ../../../include/lber.h
bind.o: ../../../include/ldap.h ../../../include/lthread.h
bind.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
attr.o: attr.c ../slap.h ../../../include/avl.h ../../../include/lber.h
attr.o: ../../../include/ldap.h ../../../include/lthread.h
attr.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
filterindex.o: filterindex.c ../slap.h ../../../include/avl.h
filterindex.o: ../../../include/lber.h ../../../include/ldap.h
filterindex.o: ../../../include/lthread.h ../../../include/ldif.h back-ldbm.h
filterindex.o: ../../../include/ldbm.h
unbind.o: unbind.c ../slap.h ../../../include/avl.h ../../../include/lber.h
unbind.o: ../../../include/ldap.h ../../../include/lthread.h
unbind.o: ../../../include/ldif.h
kerberos.o: kerberos.c ../slap.h ../../../include/avl.h ../../../include/lber.h
kerberos.o: ../../../include/ldap.h ../../../include/lthread.h
kerberos.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h
close.o: close.c ../slap.h ../../../include/avl.h ../../../include/lber.h
close.o: ../../../include/ldap.h ../../../include/lthread.h
close.o: ../../../include/ldif.h back-ldbm.h ../../../include/ldbm.h

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
