+# $OpenLDAP$
##
## Makefile for LDAP tools
##
-SRCS = ldapsearch.c ldapmodify.c ldapdelete.c ldapmodrdn.c ldappasswd.c
-OBJS = ldapsearch.o ldapmodify.o ldapdelete.o ldapmodrdn.o ldappasswd.o
-
-XLIBS = $(KRB_LIBS)
+SRCS = ldapsearch.c ldapmodify.c ldapdelete.c ldapmodrdn.c \
+ ldappasswd.c ldapwhoami.c ldapcompare.c common.c
+OBJS = ldapsearch.o ldapmodify.o ldapdelete.o ldapmodrdn.o \
+ ldappasswd.o ldapwhoami.o ldapcompare.o common.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-XSRCS = ldsversion.c ldmversion.c lddversion.c ldrversion.c
+XLIBS = $(LDAP_LIBLDIF_A) $(LDAP_L)
+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 ldappasswd
ldapsearch: ldsversion.o
- $(LTLINK) -o $@ ldapsearch.o ldsversion.o $(LIBS)
+ $(LTLINK) -o $@ ldapsearch.o common.o ldsversion.o $(LIBS)
ldapmodify: ldmversion.o
- $(LTLINK) -o $@ ldapmodify.o ldmversion.o $(LIBS)
+ $(LTLINK) -o $@ ldapmodify.o common.o ldmversion.o $(LIBS)
ldapdelete: lddversion.o
- $(LTLINK) -o $@ ldapdelete.o lddversion.o $(LIBS)
+ $(LTLINK) -o $@ ldapdelete.o common.o lddversion.o $(LIBS)
ldapmodrdn: ldrversion.o
- $(LTLINK) -o $@ ldapmodrdn.o ldrversion.o $(LIBS)
+ $(LTLINK) -o $@ ldapmodrdn.o common.o ldrversion.o $(LIBS)
+
+ldappasswd: ldpversion.o
+ $(LTLINK) -o $@ ldappasswd.o common.o ldpversion.o $(LIBS)
-ldappasswd: ldappasswd.o
- $(LTLINK) -o $@ ldappasswd.o $(LIBS) @LUTIL_LIBS@ $(LDAP_LIBPATH) -llutil
+ldapwhoami: ldwversion.o
+ $(LTLINK) -o $@ ldapwhoami.o common.o ldwversion.o $(LIBS)
+
+ldapcompare: ldcversion.o
+ $(LTLINK) -o $@ ldapcompare.o common.o ldcversion.o $(LIBS)
ldapadd: ldapmodify
- $(RM) $@
- $(LN) ldapmodify ldapadd
-
-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}|" \
- < $(srcdir)/Versionlds.c > $@)
-
-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}|" \
- < $(srcdir)/Versionldm.c > $@)
-
-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}|" \
- < $(srcdir)/Versionldd.c > $@)
-
-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}|" \
- < $(srcdir)/Versionldr.c > $@)
+ @-$(RM) $@$(EXEEXT)
+ $(LN_H) ldapmodify$(EXEEXT) ldapadd$(EXEEXT)
+
+
+ldsversion.c: ldapsearch.o common.o $(XLIBS)
+ @-$(RM) $@
+ $(MKVERSION) ldapsearch > $@
+
+ldmversion.c: ldapmodify.o common.o $(XLIBS)
+ @-$(RM) $@
+ $(MKVERSION) ldapmodify > $@
+
+lddversion.c: ldapdelete.o common.o $(XLIBS)
+ @-$(RM) $@
+ $(MKVERSION) ldapdelete > $@
+
+ldpversion.c: ldappasswd.o common.o $(XLIBS)
+ @-$(RM) $@
+ $(MKVERSION) ldappasswd > $@
+
+ldrversion.c: ldapmodrdn.o common.o $(XLIBS)
+ @-$(RM) $@
+ $(MKVERSION) ldapmodrdn > $@
+
+ldwversion.c: ldapwhoami.o common.o $(XLIBS)
+ @-$(RM) $@
+ $(MKVERSION) ldapwhoami > $@
+
+ldcversion.c: ldapcompare.o common.o $(XLIBS)
+ @-$(RM) $@
+ $(MKVERSION) ldapcompare > $@
+
install-local: FORCE
- -$(MKDIR) $(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldapsearch $(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldapmodify $(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldapdelete $(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldapmodrdn $(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldappasswd $(bindir)
- $(RM) $(bindir)/ldapadd
- $(LN) $(bindir)/ldapmodify $(bindir)/ldapadd
+ -$(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)
+