# Makefile for back-hdb
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2021 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
#
## Copyright 2003 Howard Chu @ Symas Corp. See master COPYRIGHT file for terms.

XXDIR = $(srcdir)/../back-bdb

XXSRCS = init.c tools.c config.c \
	add.c bind.c compare.c delete.c modify.c modrdn.c search.c \
	extended.c referral.c operational.c \
	attr.c index.c key.c dbcache.c filterindex.c trans.c \
	dn2entry.c dn2id.c error.c id2entry.c idl.c nextid.c cache.c \
	monitor.c
SRCS = $(XXSRCS)
OBJS = init.lo tools.lo config.lo \
	add.lo bind.lo compare.lo delete.lo modify.lo modrdn.lo search.lo \
	extended.lo referral.lo operational.lo \
	attr.lo index.lo key.lo dbcache.lo filterindex.lo trans.lo \
	dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo nextid.lo cache.lo \
	monitor.lo

LDAP_INCDIR= ../../../include       
LDAP_LIBDIR= ../../../libraries

BUILD_OPT = "--enable-hdb"
BUILD_MOD = @BUILD_HDB@

mod_DEFS = -DSLAPD_IMPORT
MOD_DEFS = $(@BUILD_HDB@_DEFS)
MOD_LIBS = $(BDB_LIBS)

shared_LDAP_LIBS = $(LDAP_LIBLDAP_R_LA) $(LDAP_LIBLBER_LA)
NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
UNIX_LINK_LIBS = $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)

.links : Makefile
	@for i in $(XXSRCS); do \
		$(RM) $$i; \
		$(LN_S) $(XXDIR)/$$i . ; \
	done
	touch .links

$(XXSRCS) : .links

LIBBASE = back_hdb

XINCPATH = -I.. -I$(srcdir)/.. -I$(srcdir) -I$(XXDIR)
XDEFS = $(MODULES_CPPFLAGS)

depend-local-lib: .links

all-local-lib:	../.backend

../.backend: lib$(LIBBASE).a
	@touch $@

veryclean-local: FORCE
	$(RM) $(XXSRCS) .links
