3 ## Makefile.in for slapd
6 XPROGRAMS=sslapd libbackends.a .backend
10 NT_OBJS = nt_svc.o ../../libraries/liblutil/slapdmsg.res
12 SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \
13 attr.c entry.c config.c backend.c result.c operation.c \
14 dn.c compare.c modify.c delete.c modrdn.c ch_malloc.c \
15 value.c ava.c bind.c unbind.c abandon.c filterentry.c \
16 phonetic.c acl.c str2filter.c aclparse.c init.c user.c \
17 repl.c lock.c controls.c extended.c kerberos.c passwd.c \
18 schema.c schema_check.c schema_init.c schema_prep.c \
19 schemaparse.c ad.c at.c mr.c syntax.c oc.c \
20 monitor.c configinfo.c starttls.c \
21 root_dse.c sasl.c module.c suffixalias.c $(@PLAT@_SRCS)
23 OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \
24 attr.o entry.o config.o backend.o result.o operation.o \
25 dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o \
26 value.o ava.o bind.o unbind.o abandon.o filterentry.o \
27 phonetic.o acl.o str2filter.o aclparse.o init.o user.o \
28 repl.o lock.o controls.o extended.o kerberos.o passwd.o \
29 schema.o schema_check.o schema_init.o schema_prep.o \
30 schemaparse.o ad.o at.o mr.o syntax.o oc.o \
31 monitor.o configinfo.o starttls.o \
32 root_dse.o sasl.o module.o suffixalias.o $(@PLAT@_OBJS)
34 LDAP_INCDIR= ../../include
35 LDAP_LIBDIR= ../../libraries
38 SLAPD_MODULES=@SLAPD_MODULES_LIST@
40 XDEFS = $(MODULES_CPPFLAGS)
41 XLDFLAGS = $(MODULES_LDFLAGS) $(SLAPD_MODULES)
43 # $(LTHREAD_LIBS) must be last
44 XLIBS = libbackends.a -lavl -lldbm -lldif -llutil -lldap_r -llber
45 XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) \
47 $(LDIF_LIBS) $(LUTIL_LIBS)
48 XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS)
50 BUILD_OPT = "--enable-slapd"
51 BUILD_SRV = @BUILD_SLAPD@
53 all-local-srv: all-cffiles
55 NT_DYN_DEFS = -DLIBLBER_DECL=dllimport -DLIBLDAP_DECL=dllimport
57 DEFINES = $(@PLAT@_@LIB_LINKAGE@_DEFS)
59 # The tricky part about building slapd in NT is that it will export symbols
60 # like a DLL. The symbols that it exports should be representative of all
61 # of the static symbols that it knows about.
64 NT_IMPLIB = libslapd.a
67 # Add extra def targets here
70 # NT needs this if libltdl is built statically. You'll have to fix the path
71 # to point to where libltdl was built, then put ltdl.def in EXTRA_DEFS
72 ltdl.def: ../../../libtool/libltdl/*.o
73 dlltool --export-all-symbols --output-def $@ $^
75 DYNAMIC_DEFS = liblber.def libldap_r.def
77 STATIC_DEFS = libavl.def libldbm.def libldif.def liblutil.def slapd.def \
80 libavl.def: $(LDAP_LIBDIR)/libavl/*.o
81 dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
83 liblber.def: $(LDAP_LIBDIR)/liblber/*.o
84 dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
86 libldap_r.def: $(LDAP_LIBDIR)/libldap_r/*.o
87 dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
89 libldbm.def: $(LDAP_LIBDIR)/libldbm/*.o
90 dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
92 libldif.def: $(LDAP_LIBDIR)/libldif/*.o
93 dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
95 liblutil.def: $(LDAP_LIBDIR)/liblutil/*.o
96 dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
98 slapd.def: $(OBJS) version.o
99 dlltool --export-all-symbols --exclude-symbols main,ServiceMain@8 --output-def $@ `ls $^ | grep -v test`
101 # We don't want to include symbols from dynamic libraries.
102 all.def: $(STATIC_DEFS) $(DYNAMIC_DEFS)
103 cat $(STATIC_DEFS) | grep " @ " | sed -e 's/ @ [0-9]*//' > $@
104 if [ "@LIB_LINKAGE@" != "DYN" ] ; \
106 cat $(DYNAMIC_DEFS) | grep " @ " | sed -e 's/ @ [0-9]*//' >> $@; \
108 echo EXPORTS > tmp.def
111 dlltool --input-def tmp.def --output-def $@
114 DUMMYTMP = symdummytmp.c
116 symdummy.c: all.def $(ALL_DEFS)
118 echo "static void never_called() {" > $(DUMMYTMP)
119 cat $< | grep " @ " | while read line; \
124 echo "int $$2();" >> $@; \
125 echo "$$2();" >> $(DUMMYTMP); \
128 echo "extern int $$2;" >> $@; \
129 echo "$$2 = 0;" >> $(DUMMYTMP); \
134 echo "}" >> $(DUMMYTMP)
135 cat $(DUMMYTMP) >> $@
138 symdummy.o: symdummy.c
139 $(CC) $(CFLAGS) -c $<
141 SLAPD_OBJS = $(OBJS) version.o symdummy.o
143 slapd.exp: libbackends.a all.def $(SLAPD_OBJS)
144 $(LTLINK) -o slapd $(SLAPD_OBJS) $(LIBS) $(WRAP_LIBS) -Wl,--base-file,slapd.base
146 dlltool --dllname slapd.exe --input-def all.def --base-file slapd.base --output-exp $@
147 $(LTLINK) -o slapd $(SLAPD_OBJS) $(LIBS) $(WRAP_LIBS) $@ -Wl,--base-file,slapd.base
149 dlltool --dllname slapd.exe --input-def all.def --base-file slapd.base --output-exp $@
152 dlltool --dllname slapd.exe --input-def $< --output-lib $@
154 slapd: libbackends.a version.o $(@PLAT@_EXP) $(@PLAT@_DUMMY)
155 $(LTLINK) -o $@ $(@PLAT@_EXP) $(@PLAT@_DUMMY) $(OBJS) version.o $(LIBS) $(WRAP_LIBS)
156 (cd tools; $(MAKE) $(MFLAGS) all)
159 $(LTLINK) -static -o $@ $(OBJS) version.o $(LIBS) $(WRAP_LIBS)
161 .backend: $(@PLAT@_IMPLIB) FORCE
162 @for i in back-*; do \
163 if [ -d $$i ]; then \
164 echo " "; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
165 ( cd $$i; $(MAKE) $(MFLAGS) all ); \
170 libbackends.a: .backend
173 @-for i in back-*/*.a; do \
177 pre=`echo $$i | sed -e 's/\/.*$$//' -e 's/back-//'`; \
181 $(AR) ruv libbackends.a *.o 2>&1 | grep -v truncated; \
182 $(RM) *.o __.SYMDEF; \
183 echo "added backend library $$i"; \
186 @mv -f tmp/libbackends.a ./libbackends.a
188 @if [ ! -z "$(RANLIB)" ]; then \
189 $(RANLIB) libbackends.a; \
193 version.c: $(OBJS) $(SLAPD_LIBDEPEND)
195 $(MKVERSION) -s -n Versionstr slapd > $@
197 depend-local-srv: FORCE
198 @for i in back-* shell-backends tools; do \
199 if [ -d $$i ]; then \
200 echo; echo " cd $$i; $(MAKE) $(MFLAGS) depend"; \
201 ( cd $$i; $(MAKE) $(MFLAGS) depend ); \
207 rm -f *.exp *.def *.base *.a *.objs symdummy.c
209 clean-local-srv: FORCE
210 @for i in back-* shell-backends tools; do \
211 if [ -d $$i ]; then \
212 echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \
213 ( cd $$i; $(MAKE) $(MFLAGS) clean ); \
216 rm -f *.tmp all-cffiles
218 veryclean-local-srv: FORCE
219 @for i in back-* shell-backends tools; do \
220 if [ -d $$i ]; then \
221 echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \
222 ( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \
226 install-local-srv: install-slapd install-conf install-schema install-tools
229 -$(MKDIR) $(DESTDIR)$(libexecdir)
230 -$(MKDIR) $(DESTDIR)$(localstatedir)
231 $(LTINSTALL) $(INSTALLFLAGS) -m 755 slapd$(EXEEXT) \
232 $(DESTDIR)$(libexecdir)
233 @if [ ! -z "$(SLAPD_MODULES)" ]; then \
234 for i in back-* shell-backends tools; do \
235 if [ -d $$i ]; then \
236 echo; echo " cd $$i; $(MAKE) $(MFLAGS) install"; \
237 ( cd $$i; $(MAKE) $(MFLAGS) install ); \
243 CFFILES=slapd.conf slapd.at.conf slapd.oc.conf
246 @for i in $(CFFILES); do \
248 $(SED) -e 's;%SYSCONFDIR%;$(sysconfdir);' \
249 -e 's;%LOCALSTATEDIR%;$(localstatedir);' \
250 -e 's;%MODULEDIR%;$(moduledir);' \
251 $(srcdir)/$$i > $$tmpcf ; \
255 install-schema: FORCE
256 @-$(MKDIR) $(DESTDIR)$(sysconfdir)/schema
258 for i in schema/*.schema schema/*.conf ; do \
259 if test ! -f $(DESTDIR)$(sysconfdir)/$$i; then \
260 echo "installing $$i in $(sysconfdir)"; \
261 echo $(INSTALL) $(INSTALLFLAGS) $$i $(DESTDIR)$(sysconfdir)/$$i; \
262 $(INSTALL) $(INSTALLFLAGS) $$i $(DESTDIR)$(sysconfdir)/$$i; \
264 echo "PRESERVING EXISTING SCHEMA FILE $(DESTDIR)$(sysconfdir)/$$i"; \
266 $(INSTALL) $(INSTALLFLAGS) $$i $(DESTDIR)$(sysconfdir)/$$i.default ; \
270 @-$(MKDIR) $(DESTDIR)$(sysconfdir)
271 @-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-ldbm
272 @for i in $(CFFILES); do \
274 if test $$i = slapd.conf ; then \
279 if test ! -f $(DESTDIR)$(sysconfdir)/$$i; then \
280 echo "installing $$i in $(sysconfdir)"; \
281 echo "$(INSTALL) $(INSTALLFLAGS) -m $$mode $$tmpcf $(DESTDIR)$(sysconfdir)/$$i"; \
282 $(INSTALL) $(INSTALLFLAGS) -m $$mode $$tmpcf $(DESTDIR)$(sysconfdir)/$$i; \
284 echo "PRESERVING EXISTING CONFIGURATION FILE $(DESTDIR)$(sysconfdir)/$$i" ; \
286 $(INSTALL) $(INSTALLFLAGS) -m $$mode $$tmpcf $(DESTDIR)$(sysconfdir)/$$i.default ; \
290 @-$(MKDIR) $(DESTDIR)$(sbindir)
291 (cd tools; $(MAKE) $(MFLAGS) install)