Makefile.in 3.39 KB
Newer Older
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
##
## Makefile.in for slapd
##
PROGRAMS=slapd
XPROGRAMS=libbackends.a .backend
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 \
		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 \
		detach.c strdup.c tempnam.c repl.c lock.c \
		schema.c schemaparse.c monitor.c configinfo.c
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 \
		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 \
		detach.o strdup.o tempnam.o repl.o lock.o \
		schema.o schemaparse.o monitor.o configinfo.o

Kurt Zeilenga's avatar
Kurt Zeilenga committed
21
22
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
23

Kurt Zeilenga's avatar
Kurt Zeilenga committed
24
25
26
BUILD_OPT = "--enable-slapd"
BUILD_SRV = @BUILD_SLAPD@

27
all-local: FORCE
Kurt Zeilenga's avatar
Kurt Zeilenga committed
28
29
30
31
	$(MAKE) $(MFLAGS) backendslib
	$(MAKE) $(MFLAGS) slapd
	(cd tools; $(MAKE) $(MFLAGS) all)

32
XDEFS = @SLAPD_DEFS@ @LDBM_DEFS@ @LTHREAD_DEFS@ @LUTIL_DEFS@
Kurt Zeilenga's avatar
Kurt Zeilenga committed
33
XLIBS = @SLAPD_LIBS@ libbackends.a \
34
	-lavl -llutil -lldbm @LDBM_LIBS@ -llthread @LTHREAD_LIBS@ @LUTIL_LIBS@
Kurt Zeilenga's avatar
Kurt Zeilenga committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

slapd: version.o
	$(CC) $(LDFLGS) -o $@ $(OBJS) version.o $(LIBS)

backendslib:	FORCE
	@for i in back-*; do \
		if [ -d $$i ]; then \
			echo " "; echo "  cd $$i; $(MAKE) $(MFLAGS) all"; \
			( cd $$i; $(MAKE) $(MFLAGS) all ); \
		fi; \
	done; \
	echo " "; \
	$(MAKE) $(MFLAGS) libbackends.a

libbackends.a: .backend
	@$(RM) -r tmp
	@$(MKDIR) tmp
	@-for i in back-*/*.a; do \
		( \
		  cd tmp; \
		  $(AR) x ../$$i; \
		  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; \
		  echo "added backend library $$i"; \
		); \
	done
	@mv -f tmp/libbackends.a ./libbackends.a
	@$(RM) -r tmp
	@if [ ! -z "$(RANLIB)" ]; then \
		$(RANLIB) libbackends.a; \
	fi
	@ls -l libbackends.a

Kurt Zeilenga's avatar
Kurt Zeilenga committed
72
version.c: libbackends.a $(OBJS) $(LDAP_LIBDEPEND) \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
73
74
75
76
		$(LDAP_LIBDIR)/libldbm.a \
		$(LDAP_LIBDIR)/libavl.a \
		$(LDAP_LIBDIR)/libldif.a \
		$(LDAP_LIBDIR)/liblutil.a \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
77
78
79
80
81
82
		$(LDAP_LIBDIR)/liblthread.a 
	$(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}|" \
83
	< $(srcdir)/Version.c > $@)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
84

85
clean-local: FORCE
Kurt Zeilenga's avatar
Kurt Zeilenga committed
86
87
88
89
90
91
92
	@for i in back-* tools; do \
		if [ -d $$i ] ; then \
			echo; echo "  cd $$i; $(MAKE) $(MFLAGS) clean"; \
			( cd $$i; $(MAKE) $(MFLAGS) clean ); \
		fi; \
	done

93
install-local: install-slapd install-conf install-tools
Kurt Zeilenga's avatar
Kurt Zeilenga committed
94
95
96
97
98
99
100

install-slapd: FORCE
	@-$(MKDIR) $(libexecdir)
	$(INSTALL) $(INSTALLFLAGS) -m 755 slapd $(libexecdir)

install-conf: FORCE
	@-$(MKDIR) -p $(sysconfdir)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
101
	$(SED) -e 's;%SYSCONFDIR%;$(sysconfdir);' slapd.conf > /tmp/slapd.$$
Kurt Zeilenga's avatar
Kurt Zeilenga committed
102
103
104
105
106
107
108
109
110
111
112
113
	-$(MV) $(sysconfdir)/slapd.conf $(sysconfdir)/slapd.conf-
	$(INSTALL) $(INSTALLFLAGS) -m 644 /tmp/slapd.$$ $(sysconfdir)/slapd.conf
	$(RM) -f /tmp/slapd.$$
	-$(MV) $(sysconfdir)/slapd.at.conf $(sysconfdir)/slapd.at.conf-
	$(INSTALL) $(INSTALLFLAGS) -m 644 slapd.at.conf $(sysconfdir)
	-$(MV) $(sysconfdir)/slapd.oc.conf $(sysconfdir)/slapd.oc.conf-
	$(INSTALL) $(INSTALLFLAGS) -m 644 slapd.oc.conf $(sysconfdir)

install-tools: FORCE
	@-$(MKDIR) $(sbindir)
	(cd tools; $(MAKE) $(MFLAGS) install)