+# $OpenLDAP$
+
SRCS= main.c find.c mod.c print.c auth.c util.c help.c \
string_to_key.c group.c edit.c globals.c
XSRCS= version.c
HDRS= ud.h
PROGRAMS= ud
-XLIBS = $(LIBTERMCAP)
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+NT_DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
+CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_DEFS)
+
+XLIBS = -llutil -lldif -lldap -llber
+XXLIBS = $(TERMCAP_LIBS) $(SECURITY_LIBS) $(LUTIL_LIBS)
ud : version.o
- $(CC) $(LDFLAGS) -o $@ version.o $(OBJS) $(LIBS)
+ $(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
version.c: ${OBJS} $(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}|" \
- < Version.c > $@)
-
-install: $(PROGRAMS) FORCE
- -$(MKDIR) -p $(bindir)
- -mv -f $(bindir)/ud $(bindir)/ud-
- $(INSTALL) $(INSTALLFLAGS) -m 775 ud $(bindir)
+ @-$(RM) $@
+ $(MKVERSION) -s -c -n Version UserDirectory > $@
+
+install-local: FORCE
+ -$(MKDIR) $(DESTDIR)$(bindir)
+ -mv -f $(DESTDIR)$(bindir)/ud $(DESTDIR)$(bindir)/ud-
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -s -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(bindir); \
+ done \
+ )
+