+# $OpenLDAP$
##
## Makefile for LDAP tools
##
-SRCS = ldapsearch.c ldapmodify.c ldapdelete.c ldapmodrdn.c
-OBJS = ldapsearch.o ldapmodify.o ldapdelete.o ldapmodrdn.o
-XLIBS = -llber -lldap
+SRCS = ldapsearch.c ldapmodify.c ldapdelete.c ldapmodrdn.c \
+ ldappasswd.c ldapwhoami.c
+OBJS = ldapsearch.o ldapmodify.o ldapdelete.o ldapmodrdn.o \
+ ldappasswd.o ldapwhoami.o
-XSRCS = ldsversion.c ldmversion.c lddversion.c ldrversion.c
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+XLIBS = -llutil -lldif -lldap -llber
+XXLIBS = $(SECURITY_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
+
+XSRCS = ldsversion.c ldmversion.c lddversion.c ldrversion.c \
+ ldpversion.c ldwversion.c ldcversion.c
+
+PROGRAMS = ldapsearch ldapmodify ldapdelete ldapmodrdn ldapadd \
+ ldappasswd ldapwhoami ldapcompare
-PROGRAMS = ldapsearch ldapmodify ldapdelete ldapmodrdn ldapadd
ldapsearch: ldsversion.o
- $(CC) $(LDFLAGS) -o $@ ldapsearch.o ldsversion.o $(LIBS)
+ $(LTLINK) -o $@ ldapsearch.o ldsversion.o $(LIBS)
ldapmodify: ldmversion.o
- $(CC) $(LDFLAGS) -o $@ ldapmodify.o ldmversion.o $(LIBS)
+ $(LTLINK) -o $@ ldapmodify.o ldmversion.o $(LIBS)
ldapdelete: lddversion.o
- $(CC) $(LDFLAGS) -o $@ ldapdelete.o lddversion.o $(LIBS)
+ $(LTLINK) -o $@ ldapdelete.o lddversion.o $(LIBS)
ldapmodrdn: ldrversion.o
- $(CC) $(LDFLAGS) -o $@ ldapmodrdn.o ldrversion.o $(LIBS)
+ $(LTLINK) -o $@ ldapmodrdn.o ldrversion.o $(LIBS)
+
+ldappasswd: ldpversion.o
+ $(LTLINK) -o $@ ldappasswd.o ldpversion.o $(LIBS)
+
+ldapwhoami: ldwversion.o
+ $(LTLINK) -o $@ ldapwhoami.o ldwversion.o $(LIBS)
+
+ldapcompare: ldcversion.o
+ $(LTLINK) -o $@ ldapcompare.o ldcversion.o $(LIBS)
ldapadd: ldapmodify
- $(RM) $@
- $(LN) ldapmodify ldapadd
+ @-$(RM) $@$(EXEEXT)
+ $(LN_H) ldapmodify$(EXEEXT) ldapadd$(EXEEXT)
+
ldsversion.c: ldapsearch.o $(LDAP_LIBDEPEND)
- $(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}|" \
- < Versionlds.c > $@)
+ @-$(RM) $@
+ $(MKVERSION) ldapsearch > $@
ldmversion.c: ldapmodify.o $(LDAP_LIBDEPEND)
- $(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}|" \
- < Versionldm.c > $@)
+ @-$(RM) $@
+ $(MKVERSION) ldapmodify > $@
lddversion.c: ldapdelete.o $(LDAP_LIBDEPEND)
- $(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}|" \
- < Versionldd.c > $@)
+ @-$(RM) $@
+ $(MKVERSION) ldapdelete > $@
+
+ldpversion.c: ldappasswd.o $(LDAP_LIBDEPEND)
+ @-$(RM) $@
+ $(MKVERSION) ldappasswd > $@
ldrversion.c: ldapmodrdn.o $(LDAP_LIBDEPEND)
- $(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}|" \
- < Versionldr.c > $@)
-
-installlocal: ldapsearch ldapmodify ldapdelete ldapmodrdn ldapadd FORCE
- -$(MKDIR) -p $(bindir)
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldapsearch $(bindir)
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldapmodify $(bindir)
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldapdelete $(bindir)
- $(INSTALL) $(INSTALLFLAGS) -m 755 ldapmodrdn $(bindir)
- $(RM) $(BINDIR)/ldapadd
- $(LN) $(BINDIR)/ldapmodify $(bindir)/ldapadd
+ @-$(RM) $@
+ $(MKVERSION) ldapmodrdn > $@
+
+ldwversion.c: ldapwhoami.o $(LDAP_LIBDEPEND)
+ @-$(RM) $@
+ $(MKVERSION) ldapwhoami > $@
+
+ldcversion.c: ldapcompare.o $(LDAP_LIBDEPEND)
+ @-$(RM) $@
+ $(MKVERSION) ldapcompare > $@
+
+
+install-local: FORCE
+ -$(MKDIR) $(DESTDIR)$(bindir)
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -s -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(bindir); \
+ done \
+ )
+ $(RM) $(DESTDIR)$(bindir)/ldapadd$(EXEEXT)
+ $(LN) $(DESTDIR)$(bindir)/ldapmodify$(EXEEXT) $(DESTDIR)$(bindir)/ldapadd$(EXEEXT)
+