## Makefile Template for Shared Libraries
##
-COMPILE = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c
+NT_LTFLAGS = --only-$(LINKAGE)
+LTFLAGS = $(@PLAT@_LTFLAGS)
+
+NT_DYN_LT_NO_UNDEF = -no-undefined
+LT_NO_UNDEF = $(@PLAT@_@LIB_LINKAGE@_LT_NO_UNDEF)
+
+COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CFLAGS) $(EXTRA_DEFS) -c
+LTLIBLINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) \
+ $(LTVERSION) $(LT_NO_UNDEF)
+
MKDEPFLAG = -l
.SUFFIXES: .c .o .lo
.c.lo:
$(COMPILE) $<
+
+# DYN_EXT (@DYN_EXT@) describes the extension assoicated with a
+# dynamic library, e.g. so, dll
+
+DYN_EXT=@DYN_EXT@
+
$(LIBRARY): version.lo
- $(LTLIBLINK) -rpath $(libdir) -o $@ $(OBJS) version.lo
- $(RM) ../$@; \
+ $(LTLIBLINK) -rpath $(libdir) -o $@ $(OBJS) version.lo $(EXTRA_LIBS)
+ $(RM) ../$@
(d=`$(PWD)` ; $(LN_S) `$(BASENAME) $$d`/$@ ../$@)
$(RM) ../`$(BASENAME) $@ .la`.a; \
(d=`$(PWD)`; t=`$(BASENAME) $@ .la`.a; $(LN_S) `$(BASENAME) $$d`/.libs/$$t ../$$t)
# If we want our binaries to link dynamically with libldap{,_r} liblber...
# We also symlink the .so.# so we can run the tests without installing
if test "$(LINK_BINS_DYNAMIC)" = "yes"; then \
- (d=`$(PWD)`; t=`$(BASENAME) $@ .la`.so; $(LN_S) `$(BASENAME) $$d`/.libs/$$t ../$$t); \
- (d=`$(PWD)`; b=`$(BASENAME) $@ .la`; t=`ls $$d/.libs/$$b.so.?`; $(LN_S) `$(BASENAME) $$d`/.libs/`$(BASENAME) $$t` ../`$(BASENAME) $$t`); \
+ (d=`$(PWD)`; b=`$(BASENAME) $@ .la`; t=`ls $$d/.libs/$$b*.$(DYN_EXT)`; t=`$(BASENAME) $$t`; $(LN_S) `$(BASENAME) $$d`/.libs/$$t ../$$t); \
+ if test "$(DYN_EXT)" != dll; then \
+ (d=`$(PWD)`; b=`$(BASENAME) $@ .la`; t=`ls $$d/.libs/$$b.$(DYN_EXT).?`; $(LN_S) `$(BASENAME) $$d`/.libs/`$(BASENAME) $$t` ../`$(BASENAME) $$t`); \
+ fi \
fi
Makefile: $(top_srcdir)/build/lib-shared.mk
+
$(RM) $(LIBRARY) ../$(LIBRARY) $(XLIBRARY) \
$(PROGRAMS) $(XPROGRAMS) $(XSRCS) $(XXSRCS) \
*.o *.lo a.out core version.c .libs/* \
- ../`$(BASENAME) $(LIBRARY) .la`.so*
+ ../`$(BASENAME) $(LIBRARY) .la`.so* \
+ ../`$(BASENAME) $(LIBRARY) .la`*.dll *.exe
depend-common: FORCE
$(MKDEP) $(DEFS) $(DEFINES) $(SRCS) $(XXSRCS)
LIBRARY = $(LIBBASE).la
LIBSTAT = lib$(LIBBASE).a
+
LTFLAGS = --only-$(LINKAGE)
+COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CFLAGS) $(MODDEFS) -c
+LTLIBLINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) \
+ $(LTVERSION) $(LT_NO_UNDEF)
+
+MKDEPFLAG = -l
+
+.SUFFIXES: .c .o .lo
+
+.c.lo:
+ $(COMPILE) $<
+
all-no lint-no 5lint-no depend-no install-no: FORCE
@echo "run configure with $(BUILD_OPT) to make $(LIBBASE)"
$(RM) $@
$(MKVERSION) $(LIBBASE) > $@
-$(LIBRARY): version.lo
- $(LTLIBLINK) -module -rpath $(moduledir) -o $@ $(OBJS) version.lo $(MODLIBS)
+$(LIBRARY): $(MODDEPS) version.lo
+ $(LTLIBLINK) -module -rpath $(moduledir) -o $@ $(OBJS) version.lo \
+ $(MODLIBS)
$(LIBSTAT): version.lo
$(AR) ruv $@ `echo $(OBJS) | sed 's/\.lo/.o/g'` version.o
veryclean-local-lib:
veryclean-lib: clean-lib veryclean-local-lib
-COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CFLAGS) -c
-MKDEPFLAG = -l
-
-.SUFFIXES: .c .o .lo
-
-.c.lo:
- $(COMPILE) $<
-
Makefile: $(top_srcdir)/build/mod.mk
+
all-common: $(PROGRAMS) FORCE
clean-common: FORCE
- $(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o *.lo a.out core *.core .libs/*
+ $(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o *.lo a.out core *.core \
+ .libs/* *.exe
depend-common: FORCE
$(MKDEP) $(DEFS) $(DEFINES) $(SRCS)
clean-local-srv:
clean-srv: clean-local-srv FORCE
- $(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o a.out core .libs/*
+ $(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o a.out core .libs/* *.exe
depend-local-srv:
depend-yes: depend-local-srv FORCE
LIBTOOL = @LIBTOOL@
LIBVERSION = 0:0:0
LTVERSION = -version-info $(LIBVERSION)
-LTLIBLINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LTVERSION)
LTLINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS)
LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
FORCE:
##---------------------------------------------------------------------------
+
# $OpenLDAP$
-PROGRAMS= rp500 fax500 xrpcomp.tmp
+UNIX_PRGS = rp500 fax500
+EXEPRGS = $(@PLAT@_PRGS)
+PROGRAMS = xrpcomp.tmp $(EXEPRGS)
SRCS= main.c faxtotpc.c rp500.c
XSRCS=fax5version.c rpversion.c
install-local: $(PROGRAMS) FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 rp500 $(DESTDIR)$(libexecdir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 fax500 $(DESTDIR)$(libexecdir)
- $(INSTALL) $(INSTALLFLAGS) -m 755 xrpcomp.tmp $(DESTDIR)$(libexecdir)/xrpcomp
+ @( \
+ for prg in $(EXEPRGS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(libexecdir); \
+ done \
+ )
+ $(INSTALL) $(INSTALLFLAGS) -m 755 xrpcomp.tmp \
+ $(DESTDIR)$(libexecdir)/xrpcomp
SRCS= main.c
XSRCS= version.c
OBJS= main.o
-PROGRAMS= in.xfingerd
+
+UNIX_PRGS = in.xfingerd
+PROGRAMS = $(@PLAT@_PRGS)
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
install-local: $(PROGRAMS) FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 in.xfingerd $(DESTDIR)$(libexecdir)
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(libexecdir); \
+ done \
+ )
+
##
## Makefile for gopher clients
##
-PROGRAMS= go500gw go500
+
+UNIX_PRGS= go500gw go500
+PROGRAMS = $(@PLAT@_PRGS)
SRCS= go500.c go500gw.c
+
XSRCS= gwversion.c goversion.c
GOOBJS = go500.o
GWOBJS = go500gw.o
install-local: $(PROGRAMS) go500gw.help FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir) $(DESTDIR)$(datadir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 go500 $(DESTDIR)$(libexecdir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 go500gw $(DESTDIR)$(libexecdir)
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(libexecdir); \
+ done \
+ )
-$(MV) $(DESTDIR)$(datadir)/go500gw.help $(DESTDIR)$(datadir)/go500gw.help-
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/go500gw.help $(DESTDIR)$(datadir)
+
# $OpenLDAP$
-PROGRAMS= mail500
+UNIX_PRGS = mail500
+PROGRAMS = $(@PLAT@_PRGS)
SRCS= main.c
XSRCS= version.c
install-local: $(PROGRAMS) FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 mail500 $(DESTDIR)$(libexecdir)
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(libexecdir); \
+ done \
+ )
+
# $OpenLDAP$
-PROGRAMS= rcpt500
+UNIX_PRGS = rcpt500
+PROGRAMS = $(@PLAT@_PRGS)
+
SRCS= main.c cmds.c help.c query.c
XSRCS= version.c
OBJS= main.o cmds.o help.o query.o
install-local: $(PROGRAMS) rcpt500.help FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir) $(DESTDIR)$(datadir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 rcpt500 $(DESTDIR)$(libexecdir)
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(libexecdir); \
+ done \
+ )
-$(MV) $(DESTDIR)$(datadir)/rcpt500.help $(DESTDIR)$(datadir)/rcpt500.help-
$(INSTALL) $(INSTALLFLAGS) -m 644 $(srcdir)/rcpt500.help $(DESTDIR)$(datadir)
+
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-XLIBS = -lldif -lldap -llber -llutil
+NT_DYN_DEFS = -DLIBLBER_DECL=dllimport -DLIBLDAP_DECL=dllimport
+CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_DEFS)
+
+XLIBS = -llutil -lldif -lldap -llber
XXLIBS = $(SECURITY_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
XSRCS = ldsversion.c ldmversion.c lddversion.c ldrversion.c ldpversion.c
install-local: FORCE
-$(MKDIR) $(DESTDIR)$(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldapsearch $(DESTDIR)$(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldapmodify $(DESTDIR)$(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldapdelete $(DESTDIR)$(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldapmodrdn $(DESTDIR)$(bindir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ldappasswd $(DESTDIR)$(bindir)
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(bindir); \
+ done \
+ )
$(RM) $(DESTDIR)$(bindir)/ldapadd$(EXEEXT)
$(LN) $(DESTDIR)$(bindir)/ldapmodify$(EXEEXT) $(DESTDIR)$(bindir)/ldapadd$(EXEEXT)
+
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-XLIBS = -lldif -lldap -llber -llutil
+NT_DYN_DEFS = -DLIBLBER_DECL=dllimport -DLIBLDAP_DECL=dllimport
+CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_DEFS)
+
+XLIBS = -llutil -lldif -lldap -llber
XXLIBS = $(TERMCAP_LIBS) $(SECURITY_LIBS) $(LUTIL_LIBS)
ud : version.o
install-local: FORCE
-$(MKDIR) $(DESTDIR)$(bindir)
-mv -f $(DESTDIR)$(bindir)/ud $(DESTDIR)$(bindir)/ud-
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 ud $(DESTDIR)$(bindir)
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(bindir); \
+ done \
+ )
+
XLIBS = -llber
XXLIBS =
+LINKAGE = @LT_LIB_LINKAGE@
+
+NT_DYN_LIB_DEFS = -DLIBLBER_DECL=dllexport
+NT_DYN_TEST_DEFS = -DLIBLBER_DECL=dllimport
+
+# Extras for building the library
+EXTRA_DEFS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
+EXTRA_LIBS =
+
+# Only the test programs will pick up these defs.
+CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_TEST_DEFS)
+
dtest: $(LIBRARY) dtest.o
$(LTLINK) $(LDFLAGS) -o $@ dtest.o $(LIBS)
etest: $(LIBRARY) etest.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-XLIBS = -lldap -llber
+XLIBS = -lldap -llber -llutil
XXLIBS = $(SECURITY_LIBS) $(TLS_LIBS)
+LINKAGE = @LT_LIB_LINKAGE@
+
+NT_DYN_LIB_LIBS = -llber $(AC_LIBS)
+NT_DYN_LIB_DEFS = -DLIBLBER_DECL=dllimport -DLIBLDAP_DECL=dllexport
+NT_DYN_TEST_DEFS = -DLIBLBER_DECL=dllimport -DLIBLDAP_DECL=dllimport
+
+# Extras for building the library
+EXTRA_DEFS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
+EXTRA_LIBS = $(@PLAT@_@LIB_LINKAGE@_LIB_LIBS)
+
+# Only the test programs will pick up these defs.
+CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_TEST_DEFS)
+
apitest: $(LIBRARY) apitest.o $(LDAP_LIBLBER_DEPEND)
$(LTLINK) $(LDFLAGS) -o $@ apitest.o $(LIBS)
ltest: $(LIBRARY) test.o $(LDAP_LIBLBER_DEPEND)
LDAP_LIBDIR= ../../libraries
XDEFS = -DLDAP_R_COMPILE -I$(XXDIR)
-XLIBS = -lldap_r -llber
+XLIBS = -lldap_r -llber -llutil
XXLIBS = $(SECURITY_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS)
+LINKAGE = @LT_LIB_LINKAGE@
+
+NT_DYN_LIB_LIBS = -llber $(AC_LIBS)
+NT_DYN_LIB_DEFS = -DLIBLBER_DECL=dllimport -DLIBLDAP_DECL=dllexport
+NT_DYN_TEST_DEFS = -DLIBLBER_DECL=dllimport -DLIBLDAP_DECL=dllimport
+
+# Extras for building the library
+EXTRA_DEFS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
+EXTRA_LIBS = $(@PLAT@_@LIB_LINKAGE@_LIB_LIBS)
+
+# Only the test programs will pick up these defs.
+CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_TEST_DEFS)
+
.links :
@for i in $(XXSRCS); do \
$(RM) $$i ; \
##
LIBRARY = liblutil.a
-SRCS = base64.c debug.c detach.c entropy.c \
- md5.c passwd.c sha1.c getpass.c lockf.c utils.c sockpair.c
-OBJS = base64.o debug.o detach.o entropy.o \
+
+NT_SRCS = nt_err.c ntservice.c
+NT_OBJS = nt_err.o ntservice.o slapdmsg.res
+
+UNIX_SRCS = detach.c
+UNIX_OBJS = detach.o
+
+SRCS = base64.c debug.c entropy.c \
+ md5.c passwd.c sha1.c getpass.c lockf.c utils.c sockpair.c \
+ @LIBSRCS@ $(@PLAT@_SRCS)
+
+OBJS = base64.o debug.o entropy.o \
md5.o passwd.o sha1.o getpass.o lockf.o utils.o sockpair.o \
- @LIBOBJS@
+ @LIBOBJS@ $(@PLAT@_OBJS)
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
+# These rules are for a Mingw32 build, specifically.
+# It's ok for them to be here because the clean rule is harmless, and
+# slapdmsg.res won't get built unless it's declared in OBJS.
+
+slapdmsg.res: slapdmsg.rc slapdmsg.bin
+ windres $< -O coff -o $@
+
+clean-local:
+ $(RM) *.res
+
## Makefile.in for slurpd
##
-PROGRAMS = slurpd
+UNIX_PRGS = slurpd
+
+PROGRAMS = $(@PLAT@_PRGS)
XPROGRAMS = sslurpd
XSRCS = version.c
BUILD_OPT = "--enable-slurpd"
BUILD_SRV = @BUILD_SLURPD@
-all-local-srv: slurpd
+all-local-srv: $(PROGRAMS)
# $(LTHREAD_LIBS) must be last!
XLIBS = -lldif -lldap_r -llber -llutil
install-local-srv: FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir)
- $(LTINSTALL) $(INSTALLFLAGS) -m 755 slurpd $(DESTDIR)$(libexecdir)
+ @( \
+ for prg in $(PROGRAMS); do \
+ $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT) \
+ $(DESTDIR)$(libexecdir); \
+ done \
+ )
+
##
## tests Makefile.in for OpenLDAP
-PROGRAMS = slapd-tester slapd-search slapd-read slapd-addel
+UNIX_PRGS = slapd-tester slapd-search slapd-read slapd-addel
+PROGRAMS = $(@PLAT@_PRGS)
+
SRCS = slapd-tester.c slapd-search.c slapd-read.c slapd-addel.c
LDAP_INCDIR= ../../include