Makefile.in 16.1 KB
Newer Older
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1
## Makefile.in for slapd
Kurt Zeilenga's avatar
Kurt Zeilenga committed
2
# $OpenLDAP$
Kurt Zeilenga's avatar
Kurt Zeilenga committed
3
4
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
Quanah Gibson-Mount's avatar
Quanah Gibson-Mount committed
5
## Copyright 1998-2021 The OpenLDAP Foundation.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
6
## All rights reserved.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
7
##
Kurt Zeilenga's avatar
Kurt Zeilenga committed
8
9
10
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
11
##
Kurt Zeilenga's avatar
Kurt Zeilenga committed
12
13
14
15
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.

16
SLAPTOOLS=slapadd slapcat slapdn slapindex slapmodify slappasswd slaptest slapauth slapacl slapschema
17
PROGRAMS=slapd $(SLAPTOOLS)
18
XPROGRAMS=sslapd libbackends.a .backend liboverlays.a
19
XSRCS=version.c
20

21
SUBDIRS=back-* shell-backends slapi overlays
Howard Chu's avatar
Howard Chu committed
22

23
24
25
NT_SRCS = nt_svc.c
NT_OBJS = nt_svc.o ../../libraries/liblutil/slapdmsg.res

Howard Chu's avatar
Howard Chu committed
26
SRCS	= main.c globals.c bconfig.c config.c daemon.c \
27
28
		connection.c search.c filter.c add.c cr.c \
		attr.c entry.c backend.c result.c operation.c \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
29
30
		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 \
31
		phonetic.c acl.c str2filter.c aclparse.c init.c user.c \
32
		lock.c controls.c extended.c passwd.c proxyp.c \
33
		schema.c schema_check.c schema_init.c schema_prep.c \
34
		schemaparse.c ad.c at.c mr.c syntax.c oc.c saslauthz.c \
35
		oidm.c starttls.c index.c sets.c referral.c root_dse.c \
Jong Hyuk Choi's avatar
Jong Hyuk Choi committed
36
		sasl.c module.c mra.c mods.c sl_malloc.c zn_malloc.c limits.c \
37
		operational.c matchedValues.c cancel.c syncrepl.c \
38
		backglue.c backover.c ctxcsn.c ldapsync.c frontend.c \
39
		slapadd.c slapcat.c slapcommon.c slapdn.c slapindex.c \
Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
40
		slappasswd.c slaptest.c slapauth.c slapacl.c component.c \
41
		aci.c txn.c slapschema.c slapmodify.c \
Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
42
		$(@PLAT@_SRCS)
43

Howard Chu's avatar
Howard Chu committed
44
OBJS	= main.o globals.o bconfig.o config.o daemon.o \
45
		connection.o search.o filter.o add.o cr.o \
Howard Chu's avatar
Howard Chu committed
46
		attr.o entry.o backend.o backends.o result.o operation.o \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
47
48
		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 \
49
		phonetic.o acl.o str2filter.o aclparse.o init.o user.o \
50
		lock.o controls.o extended.o passwd.o proxyp.o \
51
		schema.o schema_check.o schema_init.o schema_prep.o \
52
		schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o \
53
		oidm.o starttls.o index.o sets.o referral.o root_dse.o \
Jong Hyuk Choi's avatar
Jong Hyuk Choi committed
54
		sasl.o module.o mra.o mods.o sl_malloc.o zn_malloc.o limits.o \
55
		operational.o matchedValues.o cancel.o syncrepl.o \
56
		backglue.o backover.o ctxcsn.o ldapsync.o frontend.o \
57
		slapadd.o slapcat.o slapcommon.o slapdn.o slapindex.o \
Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
58
		slappasswd.o slaptest.o slapauth.o slapacl.o component.o \
59
		aci.o txn.o slapschema.o slapmodify.o \
Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
60
		$(@PLAT@_OBJS)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
61

Kurt Zeilenga's avatar
Kurt Zeilenga committed
62
LDAP_INCDIR= ../../include -I$(srcdir) -I$(srcdir)/slapi -I.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
63
64
LDAP_LIBDIR= ../../libraries

65
SLAP_DIR=
66
SLAPD_STATIC_DEPENDS=@SLAPD_NO_STATIC@ libbackends.a liboverlays.a
67
68
SLAPD_STATIC_BACKENDS=@SLAPD_STATIC_BACKENDS@
SLAPD_DYNAMIC_BACKENDS=@SLAPD_DYNAMIC_BACKENDS@
69

Howard Chu's avatar
Howard Chu committed
70
71
SLAPI_LIBS=@LIBSLAPI@ @SLAPI_LIBS@

72
XDEFS = $(MODULES_CPPFLAGS)
73
XLDFLAGS = $(MODULES_LDFLAGS)
74

75
XLIBS = $(SLAPD_STATIC_DEPENDS) $(SLAPD_L) $(MODULES_LIBS)
Howard Chu's avatar
Howard Chu committed
76
XXLIBS = $(SLAPD_LIBS) $(SECURITY_LIBS) $(LUTIL_LIBS)
77
XXXLIBS = $(LTHREAD_LIBS) $(SLAPI_LIBS)
78

Kurt Zeilenga's avatar
Kurt Zeilenga committed
79
80
81
BUILD_OPT = "--enable-slapd"
BUILD_SRV = @BUILD_SLAPD@

82
all-local-srv: all-cffiles
Kurt Zeilenga's avatar
Kurt Zeilenga committed
83

Howard Chu's avatar
Howard Chu committed
84
NT_SLAPD_DEPENDS = slapd.exp
Howard Chu's avatar
Howard Chu committed
85
NT_SLAPD_OBJECTS = slapd.exp symdummy.o $(OBJS) version.o
Howard Chu's avatar
Howard Chu committed
86

Howard Chu's avatar
Howard Chu committed
87
88
UNIX_SLAPD_DEPENDS = $(SLAPD_STATIC_DEPENDS) version.o $(SLAPD_L)
UNIX_SLAPD_OBJECTS = $(OBJS) version.o
Howard Chu's avatar
Howard Chu committed
89

90
SLAPD_DEPENDS = $(@PLAT@_SLAPD_DEPENDS)
Howard Chu's avatar
Howard Chu committed
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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
Kurt Zeilenga's avatar
Kurt Zeilenga committed
106
# linked with, e.g. avl, lunicode, lutil, etc. This list
107
# will also include liblber and libldap if they were built as static
Howard Chu's avatar
Howard Chu committed
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# 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,
141
# including symbols that slapd.exe never actually referenced. The file
Howard Chu's avatar
Howard Chu committed
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# 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.
#
Howard Chu's avatar
Howard Chu committed
157
slapd.def: libbackends.a liboverlays.a version.o
158
	@for i in XX $(LDFLAGS) ; do \
Howard Chu's avatar
Howard Chu committed
159
160
161
162
163
164
	    path=`expr "$$i" : "-L\(.*\)"`; \
	    if test $$? != 0; then continue; fi; \
	    paths="$$paths $$path"; \
	done; \
	objs=""; \
	for i in $(OBJS) version.o $(LIBS) ; do \
165
	    obj="" ; \
Howard Chu's avatar
Howard Chu committed
166
167
168
169
	    case $$i in \
		-l*) \
		    done="" ;\
		    base=`expr "$$i" : "-l\(.*\)"`; \
170
		    for p in . $$paths ; do \
Howard Chu's avatar
Howard Chu committed
171
			for ext in la dll dll.a a ; do \
Howard Chu's avatar
Howard Chu committed
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
			    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; \
		    ;; \
Howard Chu's avatar
Howard Chu committed
194
		*.la) \
Howard Chu's avatar
Howard Chu committed
195
		    if test -n "$(LTSTATIC)"; then \
Howard Chu's avatar
Howard Chu committed
196
197
198
199
200
			    base=`expr "$$i" : ".*/\(.*\).la"`; \
			    path=`expr "$$i" : "\(.*/\).*"`; \
			    obj=$$path.libs/$$base.a; \
		    fi; \
		    ;; \
Howard Chu's avatar
Howard Chu committed
201
202
		*.dll.a) \
		    ;; \
Howard Chu's avatar
Howard Chu committed
203
204
205
206
207
208
209
210
211
212
		*.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 > $@
213
	$(SED) -e 1,2d -e 's/ @ [0-9][0-9]*//' -e '/\.refptr\./d' $@.tmp | sort >> $@
Howard Chu's avatar
Howard Chu committed
214
215
216
217
218
219
220
	$(RM) $@.tmp

symdummy.c: slapd.def
	$(RM) $@
	@echo "generating $@..."; \
	echo "static void never_called() {" > $@.tmp; \
	cat $< | while read line; \
Howard Chu's avatar
Howard Chu committed
221
222
223
	do \
	    set dummy $$line; \
	    case $$# in \
Howard Chu's avatar
Howard Chu committed
224
		3) \
Howard Chu's avatar
Howard Chu committed
225
		    echo "int $$2();" >> $@; \
Howard Chu's avatar
Howard Chu committed
226
		    echo "$$2();" >> $@.tmp; \
Howard Chu's avatar
Howard Chu committed
227
		    ;; \
Howard Chu's avatar
Howard Chu committed
228
		4) \
Howard Chu's avatar
Howard Chu committed
229
		    echo "extern int $$2;" >> $@; \
Howard Chu's avatar
Howard Chu committed
230
		    echo "$$2 = 0;" >> $@.tmp; \
Howard Chu's avatar
Howard Chu committed
231
232
		    ;; \
	    esac; \
Howard Chu's avatar
Howard Chu committed
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
	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 $@

Howard Chu's avatar
Howard Chu committed
262
slapi/libslapi.la: FORCE
263
	cd slapi && $(MAKE) $(MFLAGS) all
264

Pierangelo Masarati's avatar
Pierangelo Masarati committed
265
slapd: $(SLAPD_DEPENDS) @LIBSLAPI@
266
267
	$(LTLINK) -o $@ $(SLAPD_OBJECTS) $(LIBS) \
		$(WRAP_LIBS)
268
	$(RM) $(SLAPTOOLS)
269
	for i in $(SLAPTOOLS); do \
Howard Chu's avatar
Howard Chu committed
270
		$(LN_S) slapd$(EXEEXT) $$i$(EXEEXT); done
271

272

Howard Chu's avatar
Howard Chu committed
273
274
sslapd: version.o
	$(LTLINK) -static -o $@ $(OBJS) version.o $(LIBS) $(WRAP_LIBS)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
275

276
dummy $(SLAPD_DYNAMIC_BACKENDS): slapd
277
	cd $@ && $(MAKE) $(MFLAGS) all
278
	@touch $@
279

280
dynamic_overlays: slapd
281
	cd overlays && $(MAKE) $(MFLAGS) dynamic
282

Howard Chu's avatar
Howard Chu committed
283
284
285
286
287
#
# 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
288
289
290
291
	@if test -n "$(SLAPD_STATIC_BACKENDS)"; then \
	    echo "building static backends..."; \
	    for i in XX $(SLAPD_STATIC_BACKENDS); do \
	    	if test $$i != XX; then \
292
293
		    echo " "; echo "  cd $$i && $(MAKE) $(MFLAGS) all"; \
		    ( cd $$i && $(MAKE) $(MFLAGS) all ); \
294
		    if test $$? != 0; then exit 1; fi; \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
295
		fi; \
296
297
298
	    done; \
	    echo " "; \
	fi
299
300

libbackends.a: .backend
Kurt Zeilenga's avatar
Kurt Zeilenga committed
301
302
303
304
305
306
	@$(RM) -r tmp
	@$(MKDIR) tmp
	@-for i in back-*/*.a; do \
		( \
		  cd tmp; \
		  $(AR) x ../$$i; \
Howard Chu's avatar
Howard Chu committed
307
		  pre=`echo $$i | $(SED) -e 's/\/.*$$//' -e 's/back-//'`; \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
308
309
310
311
		  for j in *.o; do \
			mv $$j $${pre}$$j; \
		  done; \
		  $(AR) ruv libbackends.a *.o 2>&1 | grep -v truncated; \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
312
		  $(RM) *.o __.SYMDEF  ________64ELEL_ ; \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
313
		  echo "added backend library $$i"; \
Howard Chu's avatar
Howard Chu committed
314
		  echo ""; \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
315
316
317
318
		); \
	done
	@mv -f tmp/libbackends.a ./libbackends.a
	@$(RM) -r tmp
319
	@if test ! -z "$(RANLIB)" ; then \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
320
321
		$(RANLIB) libbackends.a; \
	fi
Howard Chu's avatar
Howard Chu committed
322
	@ls -l libbackends.a; echo ""
Kurt Zeilenga's avatar
Kurt Zeilenga committed
323

324
liboverlays.a: FORCE
325
	cd overlays && $(MAKE) $(MFLAGS) static
326

Howard Chu's avatar
Howard Chu committed
327
version.c: Makefile
328
	@-$(RM) $@
Kurt Zeilenga's avatar
Kurt Zeilenga committed
329
	$(MKVERSION) -s -n Versionstr slapd > $@
330

Howard Chu's avatar
Howard Chu committed
331
332
version.o: version.c $(OBJS) $(SLAPD_LIBDEPEND) 

333
334
backends.o: backends.c $(srcdir)/slap.h

335
depend-local-srv: FORCE
Howard Chu's avatar
Howard Chu committed
336
	@for i in $(SUBDIRS); do \
337
		if test -d $$i && test -f $$i/Makefile ; then \
338
339
			echo; echo "  cd $$i && $(MAKE) $(MFLAGS) depend"; \
			( cd $$i && $(MAKE) $(MFLAGS) depend ); \
340
			if test $$? != 0 ; then exit 1; fi ; \
341
342
		fi; \
	done
343
344
345
	@echo ""

clean-local:
346
	$(RM) *.exp *.def *.base *.a *.objs symdummy.c
347

348
349
350
veryclean-local:
	$(RM) backends.c

351
clean-local-srv: FORCE
Howard Chu's avatar
Howard Chu committed
352
	@for i in $(SUBDIRS); do \
353
		if test -d $$i && test -f $$i/Makefile ; then \
354
355
			echo; echo "  cd $$i && $(MAKE) $(MFLAGS) clean"; \
			( cd $$i && $(MAKE) $(MFLAGS) clean ); \
356
			if test $$? != 0 ; then exit 1; fi ; \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
357
358
		fi; \
	done
359
	$(RM) *.tmp all-cffiles
Kurt Zeilenga's avatar
Kurt Zeilenga committed
360

361
veryclean-local-srv: FORCE
Howard Chu's avatar
Howard Chu committed
362
	@for i in $(SUBDIRS); do \
363
		if test -d $$i && test -f $$i/Makefile ; then \
364
365
			echo; echo "  cd $$i && $(MAKE) $(MFLAGS) clean"; \
			( cd $$i && $(MAKE) $(MFLAGS) veryclean ); \
366
367
368
		fi; \
	done

Kurt Zeilenga's avatar
Kurt Zeilenga committed
369
install-local-srv: install-slapd install-tools \
370
	install-conf install-schema install-tools
Kurt Zeilenga's avatar
Kurt Zeilenga committed
371
372

install-slapd: FORCE
373
	-$(MKDIR) $(DESTDIR)$(libexecdir)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
374
	-$(MKDIR) $(DESTDIR)$(localstatedir)/run
375
	$(LTINSTALL) $(INSTALLFLAGS) $(STRIP_OPTS) -m 755 \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
376
		slapd$(EXEEXT) $(DESTDIR)$(libexecdir)
Howard Chu's avatar
Howard Chu committed
377
	@for i in $(SUBDIRS); do \
378
	    if test -d $$i && test -f $$i/Makefile ; then \
379
380
		echo; echo "  cd $$i && $(MAKE) $(MFLAGS) install"; \
		( cd $$i && $(MAKE) $(MFLAGS) install ); \
Howard Chu's avatar
Howard Chu committed
381
382
383
		if test $$? != 0 ; then exit 1; fi ; \
	    fi; \
	done
384

385
all-cffiles: slapd $(SLAPD_DYNAMIC_BACKENDS) dynamic_overlays
Howard Chu's avatar
Howard Chu committed
386
387
	@if test $(PLAT) = NT; then \
	    sysconfdir=`cygpath -w $(sysconfdir) | \
388
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
Howard Chu's avatar
Howard Chu committed
389
	    localstatedir=`cygpath -w $(localstatedir) | \
390
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
Howard Chu's avatar
Howard Chu committed
391
	    moduledir=`cygpath -w $(moduledir) | \
392
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
Howard Chu's avatar
Howard Chu committed
393
394
395
396
397
398
399
400
	else \
	    sysconfdir=$(sysconfdir); \
	    localstatedir=$(localstatedir); \
	    moduledir=$(moduledir); \
	fi; \
	$(SED) -e "s;%SYSCONFDIR%;$$sysconfdir;" \
		-e "s;%LOCALSTATEDIR%;$$localstatedir;" \
		-e "s;%MODULEDIR%;$$moduledir;" \
401
		$(srcdir)/slapd.conf > slapd.conf.tmp ; \
402
403
404
405
	$(SED) -e "s;%SYSCONFDIR%;$$sysconfdir;" \
		-e "s;%LOCALSTATEDIR%;$$localstatedir;" \
		-e "s;%MODULEDIR%;$$moduledir;" \
		$(srcdir)/slapd.ldif > slapd.ldif.tmp ; \
406
407
	touch all-cffiles

Kurt Zeilenga's avatar
Kurt Zeilenga committed
408
install-schema: FORCE
409
	@if test -d $(DESTDIR)$(schemadir) ; then \
410
411
412
413
414
		echo "MOVING EXISTING SCHEMA DIR to $(DESTDIR)$(schemadir).$$$$" ; \
		mv $(DESTDIR)$(schemadir) $(DESTDIR)$(schemadir).$$$$ ; \
	fi
	$(MKDIR) $(DESTDIR)$(schemadir)
	@SD=$(DESTDIR)$(schemadir) ; \
Howard Chu's avatar
Howard Chu committed
415
	files=`cd $(srcdir)/schema ; echo README *.ldif *.schema` ; \
416
417
418
	for i in $$files ; do \
		echo $(INSTALL) $(INSTALLFLAGS) -m 444 schema/$$i $$SD/$$i ; \
		$(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i $$SD/$$i ; \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
419
420
	done

Kurt Zeilenga's avatar
Kurt Zeilenga committed
421
install-conf: FORCE
422
	@-$(MKDIR) $(DESTDIR)$(sysconfdir)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
423
	$(INSTALL) $(INSTALLFLAGS) -m 600 slapd.conf.tmp $(DESTDIR)$(sysconfdir)/slapd.conf.default
424
425
	if test ! -f $(DESTDIR)$(sysconfdir)/slapd.conf; then \
		echo "installing slapd.conf in $(sysconfdir)"; \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
426
427
		echo "$(INSTALL) $(INSTALLFLAGS) -m 600 slapd.conf.tmp $(DESTDIR)$(sysconfdir)/slapd.conf"; \
		$(INSTALL) $(INSTALLFLAGS) -m 600 slapd.conf.tmp $(DESTDIR)$(sysconfdir)/slapd.conf; \
428
	else \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
429
430
		echo "PRESERVING EXISTING CONFIGURATION FILE $(DESTDIR)$(sysconfdir)/slapd.conf" ; \
	fi
431
432
433
434
435
436
437
438
	$(INSTALL) $(INSTALLFLAGS) -m 600 slapd.ldif.tmp $(DESTDIR)$(sysconfdir)/slapd.ldif.default
	if test ! -f $(DESTDIR)$(sysconfdir)/slapd.ldif; then \
		echo "installing slapd.ldif in $(sysconfdir)"; \
		echo "$(INSTALL) $(INSTALLFLAGS) -m 600 slapd.ldif.tmp $(DESTDIR)$(sysconfdir)/slapd.ldif"; \
		$(INSTALL) $(INSTALLFLAGS) -m 600 slapd.ldif.tmp $(DESTDIR)$(sysconfdir)/slapd.ldif; \
	else \
		echo "PRESERVING EXISTING CONFIGURATION FILE $(DESTDIR)$(sysconfdir)/slapd.ldif" ; \
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
439

Kurt Zeilenga's avatar
Kurt Zeilenga committed
440
441
442
install-db-config: FORCE
	@-$(MKDIR) $(DESTDIR)$(localstatedir) $(DESTDIR)$(sysconfdir)
	@-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-data
443
	$(INSTALL) $(INSTALLFLAGS) -m 600 $(srcdir)/DB_CONFIG \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
444
		$(DESTDIR)$(localstatedir)/openldap-data/DB_CONFIG.example
445
	$(INSTALL) $(INSTALLFLAGS) -m 600 $(srcdir)/DB_CONFIG \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
446
447
		$(DESTDIR)$(sysconfdir)/DB_CONFIG.example

Kurt Zeilenga's avatar
Kurt Zeilenga committed
448
install-tools: FORCE
449
450
	-$(MKDIR) $(DESTDIR)$(sbindir)
	for i in $(SLAPTOOLS); do \
451
452
		$(RM) $(DESTDIR)$(sbindir)/$$i$(EXEEXT); \
		$(LN_S) -f $(DESTDIR)$(libexecdir)/slapd$(EXEEXT) $(DESTDIR)$(sbindir)/$$i$(EXEEXT); \
453
	done
Kurt Zeilenga's avatar
Kurt Zeilenga committed
454