X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=servers%2Fslapd%2FMakefile.in;h=d4e76b33de3e50833694bdf0ba270f59f6b4aad9;hb=437d2ce5a920d12402b557b4b814e6d14cd40c9d;hp=b25e48efa078241c1c819e2d8ba6816c28aba462;hpb=f9195f9b6f9fc995fe120a9ff0fcd01d51fd0cc8;p=openldap diff --git a/servers/slapd/Makefile.in b/servers/slapd/Makefile.in index b25e48efa0..d4e76b33de 100644 --- a/servers/slapd/Makefile.in +++ b/servers/slapd/Makefile.in @@ -9,92 +9,258 @@ XSRCS=version.c NT_SRCS = nt_svc.c NT_OBJS = nt_svc.o ../../libraries/liblutil/slapdmsg.res -SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \ - attr.c entry.c config.c backend.c result.c operation.c \ +SRCS = main.c globals.c config.c daemon.c \ + connection.c search.c filter.c add.c cr.c \ + attr.c entry.c backend.c result.c operation.c \ dn.c compare.c modify.c delete.c modrdn.c ch_malloc.c \ value.c ava.c bind.c unbind.c abandon.c filterentry.c \ phonetic.c acl.c str2filter.c aclparse.c init.c user.c \ repl.c lock.c controls.c extended.c kerberos.c passwd.c \ - schema.c schema_check.c schema_init.c schemaparse.c \ - at.c mr.c syntax.c oc.c \ - monitor.c configinfo.c starttls.c \ - root_dse.c sasl.c module.c suffixalias.c $(@PLAT@_SRCS) - -OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \ - attr.o entry.o config.o backend.o result.o operation.o \ + schema.c schema_check.c schema_init.c schema_prep.c \ + schemaparse.c ad.c at.c mr.c syntax.c oc.c saslauthz.c \ + oidm.c starttls.c index.c sets.c referral.c \ + root_dse.c sasl.c module.c mra.c mods.c \ + limits.c backglue.c operational.c matchedValues.c cancel.c \ + $(@PLAT@_SRCS) + +OBJS = main.o globals.o config.o daemon.o \ + connection.o search.o filter.o add.o cr.o \ + attr.o entry.o backend.o result.o operation.o \ dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o \ value.o ava.o bind.o unbind.o abandon.o filterentry.o \ phonetic.o acl.o str2filter.o aclparse.o init.o user.o \ repl.o lock.o controls.o extended.o kerberos.o passwd.o \ - schema.o schema_check.o schema_init.o schemaparse.o \ - at.o mr.o syntax.o oc.o \ - monitor.o configinfo.o starttls.o \ - root_dse.o sasl.o module.o suffixalias.o $(@PLAT@_OBJS) - -LDAP_INCDIR= ../../include + schema.o schema_check.o schema_init.o schema_prep.o \ + schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o \ + oidm.o starttls.o index.o sets.o referral.o \ + root_dse.o sasl.o module.o mra.o mods.o \ + limits.o backglue.o operational.o matchedValues.o cancel.o \ + $(@PLAT@_OBJS) + +LDAP_INCDIR= ../../include -I$(srcdir)/slapi LDAP_LIBDIR= ../../libraries SLAP_DIR= -SLAPD_MODULES=@SLAPD_MODULES_LIST@ +SLAPD_STATIC_DEPENDS=@SLAPD_NO_STATIC@ libbackends.a +SLAPD_STATIC_BACKENDS=@SLAPD_STATIC_BACKENDS@ +SLAPD_DYNAMIC_BACKENDS=@SLAPD_DYNAMIC_BACKENDS@ + XDEFS = $(MODULES_CPPFLAGS) -XLDFLAGS = $(MODULES_LDFLAGS) $(SLAPD_MODULES) +XLDFLAGS = $(MODULES_LDFLAGS) -# $(LTHREAD_LIBS) must be last -XLIBS = libbackends.a -lavl -lldbm -lldif -llutil -lldap_r -llber -XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) \ - $(SLAPD_PERL_LDFLAGS) $(SECURITY_LIBS) \ - $(LDIF_LIBS) $(LUTIL_LIBS) -XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS) +XLIBS = $(SLAPD_STATIC_DEPENDS) $(SLAPD_L) +XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) $(SECURITY_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS) +XXXLIBS = $(LTHREAD_LIBS) $(SLAPI_LIBS) @LIBSLAPI@ $(MODULES_LIBS) BUILD_OPT = "--enable-slapd" BUILD_SRV = @BUILD_SLAPD@ all-local-srv: all-cffiles -NT_DYN_DEFS = -DLIBLBER_DECL=dllimport -DLIBLDAP_DECL=dllimport - -DEFINES = $(@PLAT@_@LIB_LINKAGE@_DEFS) - -slapd.def: slapd.syms - ( \ - echo EXPORTS > $@; \ - _hint=1; \ - for symbol in `cat $<`; do \ - echo " $$symbol @ $$_hint ; " >> $@; \ - _hint=`expr 1 + $$_hint`; \ - done \ - ) - -slapd.base: version.o - $(LTLINK) -o slapd $(OBJS) version.o $(LIBS) $(WRAP_LIBS) \ - -Wl,--base-file,$@ - rm -f slapd - -slapd.exp: slapd.def slapd.base - dlltool --dllname slapd.exe --def slapd.def --base-file slapd.base \ - --output-exp $@ - -libslapd.a: slapd.def - dlltool --dllname slapd.exe --def $< --output-lib $@ - -NT_EXP = slapd.exp -NT_IMP_LIB = libslapd.a - -slapd: $(@PLAT@_IMP_LIB) libbackends.a version.o $(@PLAT@_EXP) - $(LTLINK) -o $@ $(OBJS) version.o $(LIBS) $(WRAP_LIBS) $(@PLAT@_EXP) - (cd tools; $(MAKE) $(MFLAGS) all) +NT_SLAPD_DEPENDS = slapd.exp +NT_SLAPD_OBJECTS = slapd.exp symdummy.o $(OBJS) version.o + +UNIX_SLAPD_DEPENDS = $(SLAPD_STATIC_DEPENDS) version.o $(SLAPD_L) +UNIX_SLAPD_OBJECTS = $(OBJS) version.o + +SLAPD_DEPENDS = $(@PLAT@_SLAPD_DEPENDS) +SLAPD_OBJECTS = $(@PLAT@_SLAPD_OBJECTS) + +# Notes about slapd for Windows +# ============================= +# slapd.exe must export all of its global symbols, just like a DLL. +# The purpose of this is to allow dynamic modules (dynamic backends +# or external dynamic modules) to bind with the symbols at run-time. +# +# Exporting symbols from an .EXE is a bit tricky and involves multiple +# steps. First a .DEF file must be generated. The .DEF file indicates +# the set of symbols that are to be exported. Many times, it's possible +# to manually create this file with an editor. However, with slapd, +# we want to export EVERY global symbol that it knows about (NOT including +# symbols that are imported from other DLLs). The set of symbols to +# export INCLUDES symbols from all static libraries that slapd gets +# linked with, e.g. avl, ldbm, ldif, lunicode, lutil, etc. This list +# will also include liblber and libldap_r if they were built as static +# libraries. ALSO included will be symbols from other STATIC libraries +# outside the domain of the OpenLDAP source tree, e.g. regex, ltdl, +# crypto, ssl, sasl, etc. (If these libraries are dynamic, we won't want +# to include their symbols in the list). The correct set of symbols +# CAN be determined at build time. The slapd.def target automatically +# determines the correct set of symbols and generates the slapd.def file. +# +# The slapd.def file, serving multiple purposes, will: +# +# 1) be used to generate libslapd.a, the import library for slapd.exe. +# +# 2) be used to generate the symdummy.c file. +# +# 3) be used to help create slapd.exp, the binary-formated slapd export file. +# +# The import library is used by dynamic modules at link time. With this +# library, dynamic modules indicate to the linker that it will resolve +# these symbols from the slapd.exe binary at run-time. Of course, whenever +# a module imports dynamic symbols, those symbols should be marked with +# the __declspec(dllimport) directive in the header files that the dynamic +# modules build with. In OpenLDAP, this is handled automatically in the +# header files. (See ldap_cdefs.h for an explanation). Writers of +# dynamic backend modules should keep in mind that slapd.exe might export +# other global symbols that are not part of OpenLDAP (e.g. regex, ltdl, +# crypto, ssl, sasl, etc.) When a writer actually uses (i.e. imports) these +# symbols, he must verify that the header files from these external packages +# include a mechanism to mark imported symbols with the __declspec(dllimport) +# directive. Whether or not such a mechanism exists, the writer must be +# able to include these directives appropriately when their symbols are +# being imported from slapd.exe. The directive is not completely necessary +# for functions, but it is required for variables. +# +# The symdummy.c file basically references EVERY symbol available to slapd.exe, +# including symbols that slapd.exe never actually refereneced. The file +# is compiled and included at link time. Without this object file, slapd.exe +# would NOT export symbols that it never referenced. The reason that these +# symbols must still be exported is because a dynamic module may want to +# use a symbol even if it had not been referenced by slapd.exe. +# + +# +# slapd.def REALLY depends upon all slapd objects and all static libraries +# included in $(LIBS), including static libraries outside of OpenLDAP. +# When slapd.def is built, the absolute paths to all static libraries +# (both inside and outside of OpenLDAP) are generated. We don't have +# any way to include this generated list as a dependency of slapd.def (sigh). +# Thus, we do the best we can by depending on version.o, which depends +# on its own very long list of dependencies. +# +slapd.def: libbackends.a version.o + @for i in $(LDFLAGS) ; do \ + path=`expr "$$i" : "-L\(.*\)"`; \ + if test $$? != 0; then continue; fi; \ + paths="$$paths $$path"; \ + done; \ + objs=""; \ + for i in $(OBJS) version.o $(LIBS) ; do \ + obj="" ; \ + case $$i in \ + -l*) \ + done="" ;\ + base=`expr "$$i" : "-l\(.*\)"`; \ + for p in $$paths ; do \ + for ext in la dll a ; do \ + path=$$p/lib$$base.$$ext; \ + test ! -f $$path && continue; \ + if test $$ext = la ; then \ + for t in dlname old_library ; do \ + line=`grep "^$$t=" $$path`; \ + lib=`expr "$$line" : "[^']*'\(.*\)'"`; \ + test -n "$$lib" && test -f $$p/$$lib && \ + path=$$p/$$lib && break; \ + done; \ + test $$t = dlname && ext=dll; \ + test $$t = old_library && ext=a; \ + fi; \ + if test $$ext = a ; then \ + obj=$$path; \ + fi; \ + done=done; \ + break; \ + done; \ + test -n "$$done" && break; \ + done; \ + test -z "$$obj" && continue; \ + ;; \ + *.o | *.a) \ + obj=$$i; \ + esac; \ + objs="$$objs $$obj"; \ + done; \ + echo dlltool --exclude-symbols main,ServiceMain@8 --export-all-symbols \ + --output-def $@.tmp $$objs; \ + dlltool --exclude-symbols main,ServiceMain@8 --export-all-symbols \ + --output-def $@.tmp $$objs; + echo EXPORTS > $@ + $(SED) -e 1,2d -e 's/ @ [0-9][0-9]*//' $@.tmp | sort >> $@ + $(RM) $@.tmp + +symdummy.c: slapd.def + $(RM) $@ + @echo "generating $@..."; \ + echo "static void never_called() {" > $@.tmp; \ + cat $< | while read line; \ + do \ + set dummy $$line; \ + case $$# in \ + 3) \ + echo "int $$2();" >> $@; \ + echo "$$2();" >> $@.tmp; \ + ;; \ + 4) \ + echo "extern int $$2;" >> $@; \ + echo "$$2 = 0;" >> $@.tmp; \ + ;; \ + esac; \ + done; \ + echo "" >> $@; \ + echo "}" >> $@.tmp; \ + cat $@.tmp >> $@; \ + $(RM) $@.tmp + +libslapd.a: symdummy.o + dlltool --dllname slapd.exe --input-def slapd.def --output-lib $@ + +slapd.exp: libslapd.a + @echo $(LTLINK) -Wl,--base-file,slapd.base -o slapd \ + $(OBJS) symdummy.o version.o $(LIBS) $(WRAP_LIBS); \ + $(LTLINK) -Wl,--base-file,slapd.base -o slapd \ + $(OBJS) symdummy.o version.o $(LIBS) $(WRAP_LIBS) + $(RM) slapd.exe + @echo dlltool --dllname slapd.exe --input-def slapd.def \ + --base-file slapd.base --output-exp $@; \ + dlltool --dllname slapd.exe --input-def slapd.def \ + --base-file slapd.base --output-exp $@; \ + echo $(LTLINK) -Wl,--base-file,slapd.base -o slapd $@ \ + $(OBJS) symdummy.o version.o $(LIBS) $(WRAP_LIBS); \ + $(LTLINK) -Wl,--base-file,slapd.base -o slapd $@ \ + $(OBJS) symdummy.o version.o $(LIBS) $(WRAP_LIBS) + $(RM) slapd.exe + @echo dlltool --dllname slapd.exe --input-def slapd.def \ + --base-file slapd.base --output-exp $@; \ + dlltool --dllname slapd.exe --input-def slapd.def \ + --base-file slapd.base --output-exp $@ + +libslapi.a: .slapi + (cd slapi; $(MAKE) $(MFLAGS) all) + cp slapi/.libs/libslapi.a . + +.slapi: $(SLAPD_OBJECTS) + $(AR) ruv slapi/libtmpslapd.a $(OBJS) + (cd slapi; $(MAKE) $(MFLAGS) all) + +slapd: $(SLAPD_DEPENDS) @LIBSLAPI@ + $(LTLINK) -o $@ $(SLAPD_OBJECTS) $(LIBS) \ + $(WRAP_LIBS) sslapd: version.o $(LTLINK) -static -o $@ $(OBJS) version.o $(LIBS) $(WRAP_LIBS) +tools $(SLAPD_DYNAMIC_BACKENDS): slapd + cd $@; $(MAKE) $(MFLAGS) all + @touch $@ + +# +# In Windows, dynamic backends have to be built after slapd. For this +# reason, we only build static backends now and dynamic backends later. +# .backend: FORCE - @for i in back-*; do \ - if [ -d $$i ]; then \ - echo " "; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \ - ( cd $$i; $(MAKE) $(MFLAGS) all ); \ + @if test -n "$(SLAPD_STATIC_BACKENDS)"; then \ + echo "building static backends..."; \ + for i in XX $(SLAPD_STATIC_BACKENDS); do \ + if test $$i != XX; then \ + echo " "; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \ + ( cd $$i; $(MAKE) $(MFLAGS) all ); \ + if test $$? != 0; then exit 1; fi; \ fi; \ - done; \ - echo " " + done; \ + echo " "; \ + fi libbackends.a: .backend @$(RM) -r tmp @@ -103,50 +269,55 @@ libbackends.a: .backend ( \ cd tmp; \ $(AR) x ../$$i; \ - pre=`echo $$i | sed -e 's/\/.*$$//' -e 's/back-//'`; \ + pre=`echo $$i | $(SED) -e 's/\/.*$$//' -e 's/back-//'`; \ for j in *.o; do \ mv $$j $${pre}$$j; \ done; \ $(AR) ruv libbackends.a *.o 2>&1 | grep -v truncated; \ - $(RM) *.o __.SYMDEF; \ + $(RM) *.o __.SYMDEF ________64ELEL_ ; \ echo "added backend library $$i"; \ + echo ""; \ ); \ done @mv -f tmp/libbackends.a ./libbackends.a @$(RM) -r tmp - @if [ ! -z "$(RANLIB)" ]; then \ + @if test ! -z "$(RANLIB)" ; then \ $(RANLIB) libbackends.a; \ fi - @ls -l libbackends.a + @ls -l libbackends.a; echo "" -version.c: libbackends.a $(OBJS) $(SLAPD_LIBDEPEND) +version.c: Makefile @-$(RM) $@ $(MKVERSION) -s -n Versionstr slapd > $@ +version.o: version.c $(OBJS) $(SLAPD_LIBDEPEND) + depend-local-srv: FORCE - @for i in back-* shell-backends tools; do \ - if [ -d $$i ]; then \ + @for i in back-* shell-backends slapi tools; do \ + if test -d $$i -a -f $$i/Makefile ; then \ echo; echo " cd $$i; $(MAKE) $(MFLAGS) depend"; \ ( cd $$i; $(MAKE) $(MFLAGS) depend ); \ + if test $$? != 0 ; then exit 1; fi ; \ fi; \ done @echo "" clean-local: - rm -f *.exp *.def *.base *.a + rm -f *.exp *.def *.base *.a *.objs symdummy.c clean-local-srv: FORCE - @for i in back-* shell-backends tools; do \ - if [ -d $$i ]; then \ + @for i in back-* shell-backends slapi tools; do \ + if test -d $$i -a -f $$i/Makefile ; then \ echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \ ( cd $$i; $(MAKE) $(MFLAGS) clean ); \ + if test $$? != 0 ; then exit 1; fi ; \ fi; \ done rm -f *.tmp all-cffiles veryclean-local-srv: FORCE - @for i in back-* shell-backends tools; do \ - if [ -d $$i ]; then \ + @for i in back-* shell-backends slapi tools; do \ + if test -d $$i -a -f $$i/Makefile ; then \ echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \ ( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \ fi; \ @@ -157,60 +328,66 @@ install-local-srv: install-slapd install-conf install-schema install-tools install-slapd: FORCE -$(MKDIR) $(DESTDIR)$(libexecdir) -$(MKDIR) $(DESTDIR)$(localstatedir) - $(LTINSTALL) $(INSTALLFLAGS) -m 755 slapd$(EXEEXT) \ - $(DESTDIR)$(libexecdir) - @if [ ! -z "$(SLAPD_MODULES)" ]; then \ - for i in back-* shell-backends tools; do \ - if [ -d $$i ]; then \ - echo; echo " cd $$i; $(MAKE) $(MFLAGS) install"; \ - ( cd $$i; $(MAKE) $(MFLAGS) install ); \ - fi; \ - done; \ - fi - - -CFFILES=slapd.conf slapd.at.conf slapd.oc.conf - -all-cffiles: slapd - @for i in $(CFFILES); do \ - tmpcf=$$i.tmp; \ - $(SED) -e 's;%SYSCONFDIR%;$(sysconfdir);' \ - -e 's;%LOCALSTATEDIR%;$(localstatedir);' \ - $(srcdir)/$$i > $$tmpcf ; \ + $(LTINSTALL) $(INSTALLFLAGS) -s -m 755 \ + slapd$(EXEEXT) $(DESTDIR)$(libexecdir) + @for i in back-* shell-backends slapi tools; do \ + if test -d $$i -a -f $$i/Makefile ; then \ + echo; echo " cd $$i; $(MAKE) $(MFLAGS) install"; \ + ( cd $$i; $(MAKE) $(MFLAGS) install ); \ + if test $$? != 0 ; then exit 1; fi ; \ + fi; \ done + +all-cffiles: slapd $(SLAPD_DYNAMIC_BACKENDS) tools + @if test $(PLAT) = NT; then \ + sysconfdir=`cygpath -w $(sysconfdir) | \ + $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \ + localstatedir=`cygpath -w $(localstatedir) | \ + $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \ + moduledir=`cygpath -w $(moduledir) | \ + $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \ + else \ + sysconfdir=$(sysconfdir); \ + localstatedir=$(localstatedir); \ + moduledir=$(moduledir); \ + fi; \ + $(SED) -e "s;%SYSCONFDIR%;$$sysconfdir;" \ + -e "s;%LOCALSTATEDIR%;$$localstatedir;" \ + -e "s;%MODULEDIR%;$$moduledir;" \ + $(srcdir)/slapd.conf > slapd.conf.tmp ; \ touch all-cffiles install-schema: FORCE - @-$(MKDIR) $(DESTDIR)$(sysconfdir)/schema - @for i in schema/*.schema schema/*.conf ; do \ - if test ! -f $(DESTDIR)$(sysconfdir)/$$i; then \ - echo "installing $$i in $(sysconfdir)"; \ - echo $(INSTALL) $(INSTALLFLAGS) $$i $(DESTDIR)$(sysconfdir)/$$i; \ - $(INSTALL) $(INSTALLFLAGS) $$i $(DESTDIR)$(sysconfdir)/$$i; \ + @-$(MKDIR) $(DESTDIR)$(schemadir) + i="$(srcdir)/schema/README" ; \ + SF=`basename $$i` ; \ + SD="$(DESTDIR)$(schemadir)/$$SF" ; \ + echo $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD ; \ + $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD + for i in $(srcdir)/schema/*.schema ; do \ + SF=`basename $$i` ; \ + SD="$(DESTDIR)$(schemadir)/$$SF" ; \ + if test ! -f $$SD ; then \ + echo "installing $$SF in $(schemadir)" ; \ + echo $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD ; \ + $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD ; \ else \ - echo "PRESERVING EXISTING SCHEMA FILE $(DESTDIR)$(sysconfdir)/$$i"; \ - fi; \ - $(INSTALL) $(INSTALLFLAGS) $$i $(DESTDIR)$(sysconfdir)/$$i.default ; \ + echo "PRESERVING EXISTING SCHEMA FILE $$SD" ; \ + fi ; \ + $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD.default ; \ done install-conf: FORCE @-$(MKDIR) $(DESTDIR)$(sysconfdir) - @for i in $(CFFILES); do \ - tmpcf=$$i.tmp ; \ - if test $$i = slapd.conf ; then \ - mode=600 ; \ - else \ - mode=644 ; \ - fi ; \ - if test ! -f $(DESTDIR)$(sysconfdir)/$$i; then \ - echo "installing $$i in $(sysconfdir)"; \ - echo "$(INSTALL) $(INSTALLFLAGS) -m $$mode $$tmpcf $(DESTDIR)$(sysconfdir)/$$i"; \ - $(INSTALL) $(INSTALLFLAGS) -m $$mode $$tmpcf $(DESTDIR)$(sysconfdir)/$$i; \ - else \ - echo "PRESERVING EXISTING CONFIGURATION FILE $(DESTDIR)$(sysconfdir)/$$i" ; \ - fi; \ - $(INSTALL) $(INSTALLFLAGS) -m $$mode $$tmpcf $(DESTDIR)$(sysconfdir)/$$i.default ; \ - done + @-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-data + $(INSTALL) $(INSTALLFLAGS) -m 600 slapd.conf.tmp $(DESTDIR)$(sysconfdir)/slapd.conf.default + if test ! -f $(DESTDIR)$(sysconfdir)/slapd.conf; then \ + echo "installing slapd.conf in $(sysconfdir)"; \ + echo "$(INSTALL) $(INSTALLFLAGS) -m 600 slapd.conf.tmp $(DESTDIR)$(sysconfdir)/slapd.conf"; \ + $(INSTALL) $(INSTALLFLAGS) -m 600 slapd.conf.tmp $(DESTDIR)$(sysconfdir)/slapd.conf; \ + else \ + echo "PRESERVING EXISTING CONFIGURATION FILE $(DESTDIR)$(sysconfdir)/slapd.conf" ; \ + fi install-tools: FORCE @-$(MKDIR) $(DESTDIR)$(sbindir)