+# $OpenLDAP$
+## Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#-----------------------------------------------------------------------------
-# Copyright (c) 1995 Regents of the University of Michigan.
+# Portions Copyright (c) 1995 Regents of the University of Michigan.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# Stand alone LDAP server tools makefile
#
#-----------------------------------------------------------------------------
-HAVE_ISODE = @HAVE_ISODE@
BUILD_LDBM = @BUILD_LDBM@
-EDB2LDIFSRCS = edb2ldif.c ldapsyntax.c
-EDB2LDIFOBJS = edb2ldif.o ldapsyntax.o ../strdup.o
+LDAP_INCDIR= ../../../include
+LDAP_LIBDIR= ../../../libraries
-OBJS2 = ../config.o ../ch_malloc.o ../backend.o ../charray.o \
- ../aclparse.o ../schema.o ../result.o ../filterentry.o \
- ../acl.o ../phonetic.o ../attr.o ../value.o ../entry.o \
- ../dn.o ../filter.o ../str2filter.o ../ava.o ../init.o \
- ../schemaparse.o ../strdup.o
-
-all: build-edb2ldif ldif2index ldif2ldbm ldbmcat ldif2id2entry \
- ldif2id2children centipede ldbmtest ldif
-
-XDEFS = @SLAPD_DEFS@ @LDBM_DEFS@ @LTHREAD_DEFS@
-XLIBS = @SLAPD_LIBS@ -lavl -lldbm @LDBM_LIBS@ -llthread @LTHREAD_LIBS@
-
-build-edb2ldif: FORCE
- @if [ "$(HAVE_ISODE)" = "yes" ]; then \
- $(MAKE) $(MFLAGS) edb2ldif; \
- else \
- echo "run configure with --with-isode to build edb2ldif"; \
- fi
-
-edb2ldif: edb2-vers.o
- $(CC) $(LDFLAGS) -o $@ $(EDB2LDIFOBJS) edb2-vers.o $(LIBS)
-
-edb2-vers.c: $(EDB2LDIFOBJS)
- $(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}|" \
- < Vers-edb2.c > $@)
-
-build-chlog2replog: FORCE
- @if [ "$(HAVE_ISODE)" = "yes" ]; then \
- $(MAKE) $(MFLAGS) chlog2replog; \
- else \
- echo "run configure with --with-isode to build chlog2replog"; \
- fi
-
-chlog2replog: chlog2replog.o ../lock.o ../ch_malloc.o
- $(CC) $(LDFLAGS) -o $@ chlog2replog.o ../lock.o ../ch_malloc.o $(LIBS)
+SLAP_DIR=../
+SLAPD_MODULES = @SLAPD_MODULES_LIST@
+XDEFS = $(MODULES_CPPFLAGS)
+XLDFLAGS = $(MODULES_LDFLAGS) $(SLAPD_MODULES)
-ldif2index: ldif2index.o ../libbackends.a $(OBJS2)
- $(CC) $(LDFLAGS) -o $@ ldif2index.o $(OBJS2) ../libbackends.a $(LIBS)
+XLIBS = -lavl -lldif -lldbm -llutil -llunicode -lldap_r -llber
+XXLIBS = $(SLAPD_LIBS) \
+ $(LDBM_LIBS) $(SECURITY_LIBS) \
+ $(LDIF_LIBS) $(LUTIL_LIBS)
+XXXLIBS = $(MODULES_LIBS) $(LTHREAD_LIBS)
-ldif2ldbm: ldif2ldbm.o ../libbackends.a $(OBJS2)
- $(CC) $(LDFLAGS) -o $@ ldif2ldbm.o $(OBJS2) ../libbackends.a $(LIBS)
+PROGRAMS=slapadd slapcat slapindex slappasswd
-ldif2id2entry: ldif2id2entry.o ../libbackends.a $(OBJS2)
- $(CC) $(LDFLAGS) -o $@ ldif2id2entry.o $(OBJS2) ../libbackends.a $(LIBS)
+# CPPFLAGS will include the defines for dynamic libs in Mingw32.
+NT_DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
+CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_DEFS)
-ldif2id2children: ldif2id2children.o ../libbackends.a $(OBJS2)
- $(CC) $(LDFLAGS) -o $@ ldif2id2children.o $(OBJS2) ../libbackends.a $(LIBS)
+SRCS = mimic.c slapcommon.c \
+ slapadd.c slapcat.c slapindex.c slappasswd.c
-ldbmcat: ldbmcat.o
- $(CC) $(LDFLAGS) -o $@ ldbmcat.o $(LIBS)
-
-ldif: ldif.o
- $(CC) $(LDFLAGS) -o $@ ldif.o $(LIBS) $(LIBS2)
-
-centipede: centipede.o
- $(CC) -o $@ centipede.o $(LIBS) $(KRBLIBFLAG) $(KRBLIBS)
-
-sizecount: sizecount.o ../phonetic.o ../ch_malloc.o
- $(CC) $(LDFLAGS) -o $@ sizecount.o ../phonetic.o ../ch_malloc.o \
- $(LIBS) $(KRBLIBFLAG) $(KRBLIBS)
-
-ldbmtest: ldbmtest.o ../libbackends.a $(OBJS2)
- $(CC) $(LDFLAGS) -o ldbmtest ldbmtest.o $(OBJS2) ../libbackends.a $(LIBS)
+SLAPD_OBJS = ../config.o ../ch_malloc.o ../backend.o ../charray.o \
+ ../module.o ../aclparse.o ../filterentry.o \
+ ../schema.o ../schema_check.o ../schema_init.o ../schema_prep.o \
+ ../schemaparse.o ../ad.o ../at.o ../mr.o ../oc.o ../syntax.o \
+ ../acl.o ../phonetic.o ../attr.o ../value.o ../entry.o \
+ ../dn.o ../filter.o ../str2filter.o ../ava.o ../init.o \
+ ../controls.o ../kerberos.o ../passwd.o ../index.o \
+ ../extended.o ../starttls.o ../sets.o ../mra.o ../mods.o
-install: $(sbindir) $(sbindir)/edb2ldif $(sbindir)/ldif2ldbm \
- $(sbindir)/ldif2index $(sbindir)/ldif2id2entry \
- $(sbindir)/ldif2id2children $(sbindir)/ldbmcat \
- $(sbindir)/centipede $(sbindir)/ldbmtest \
- $(sbindir)/ldif
+SLAPOBJS = $(SLAPD_OBJS) slapcommon.o mimic.o
-$(sbindir)/edb2ldif: build-edb2ldif
- @if [ "$(HAVE_ISODE)" = "yes" ]; then \
- $(INSTALL) $(INSTALLFLAGS) -m 755 edb2ldif $(sbindir); \
- else \
- exit 0; \
- fi
+all-local: build-progs
-$(sbindir)/chlog2replog: build-chlog2replog
- @if [ "$(HAVE_ISODE)" = "yes" ]; then \
- $(INSTALL) $(INSTALLFLAGS) -m 755 chlog2replog $(sbindir); \
- else \
- exit 0; \
- fi
+build-progs: $(PROGRAMS)
-$(sbindir)/ldif2ldbm: ldif2ldbm
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldif2ldbm $(sbindir)
+#
+# SLAP Tools
+#
+slapadd: slapadd.o ../libbackends.a $(SLAPOBJS) $(SLAPD_LIBDEPEND)
+ $(LTLINK) -o $@ slapadd.o $(SLAPOBJS) ../libbackends.a $(LIBS)
-$(sbindir)/ldif2index: ldif2index
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldif2index $(sbindir)
+slapcat: slapcat.o ../libbackends.a $(SLAPOBJS) $(SLAPD_LIBDEPEND)
+ $(LTLINK) -o $@ slapcat.o $(SLAPOBJS) ../libbackends.a $(LIBS)
-$(sbindir)/ldif2id2entry: ldif2id2entry
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldif2id2entry $(sbindir)
+slapindex: slapindex.o ../libbackends.a $(SLAPOBJS) $(SLAPD_LIBDEPEND)
+ $(LTLINK) -o $@ slapindex.o $(SLAPOBJS) ../libbackends.a $(LIBS)
-$(sbindir)/ldif2id2children: ldif2id2children
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldif2id2children $(sbindir)
+slappasswd: slappasswd.o $(SLAPD_LIBDEPEND)
+ $(LTLINK) -o $@ slappasswd.o $(LIBS)
-$(sbindir)/ldbmcat: ldbmcat
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldbmcat $(sbindir)
+clean-local: FORCE
+ $(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o core .libs/* *.exe
-$(sbindir)/ldif: ldif
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldif $(sbindir)
+depend-local: FORCE
+ $(MKDEP) $(DEFS) $(DEFINES) $(SRCS)
-$(sbindir)/centipede: centipede
- $(INSTALL) $(INSTALLFLAGS) -m 755 centipede $(sbindir)
+install-local: install-ldbm-$(BUILD_LDBM)
-$(sbindir)/ldbmtest: ldbmtest
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldbmtest $(sbindir)
-
-lint: FORCE
- $(LINT) $(INCLUDES) $(DEFINES) $(SRCS)
-
-5lint: FORCE
- $(5LINT) $(INCLUDES) $(DEFINES) $(SRCS)
+install-ldbm-no:
-clean: FORCE
- @echo "making clean in `$(PWD)`"
- $(RM) edb2ldif ldif2index *.o core a.out edb2-vers.c \
- ldif2ldbm ldif2id2entry ldif2id2children ldbmcat ldif \
- centipede chlog2replog sizecount ldif2ldbm.sed.c ldbmtest
-
-depend: ldif2ldbm.sed.c FORCE
- @if [ ! -z "$(HAVE_ISODE)" ]; then \
- DEPENDEXTRAS="$(ISODEINCLUDEFLAG) chlog2replog.c $(EDB2LDIFSRCS)"; \
- fi; \
- $(MKDEP) $(INCLUDES) $(DEFINES) $$DEPENDEXTRAS ldif2index.c \
- ldif2ldbm.c ldif2id2entry.c ldif2id2children.c ldbmcat.c \
- centipede.c sizecount.c ldif2ldbm.sed.c ldbmtest.c ldif.c
+install-ldbm-yes install-ldbm-mod: FORCE
+ -$(MKDIR) $(DESTDIR)$(sbindir)
+ @for bin in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -s -m 755 \
+ $$bin$(EXEEXT) $(DESTDIR)$(sbindir); \
+ done
-links:
- @echo "making links in `$(PWD)`"
- @$(LN) .src/*.[ch] .