75c298241d289fa043aeb2ca0169cfe867b7bc71
[samba.git] / source4 / lib / ldb / Makefile.ldb
1
2 # ldap support is optional edit WITH_LDAP to suit
3 WITH_LDAP=1
4
5 ifeq ($(WITH_LDAP),1)
6 OPENLDAP_PREFIX=/usr
7 LDAP_LIBS=-L$(OPENLDAP_PREFIX)/lib -llber -lldap
8 LDAP_FLAGS=-DHAVE_LDAP=1
9 LDB_LDAP_OBJ=ldb_ldap/ldb_ldap.o
10 endif
11
12 TDBDIR=../tdb
13 TALLOCDIR=../talloc
14
15 CFLAGS1=-Wall -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith \
16        -Wcast-qual -Wcast-align -Wwrite-strings -g -Iinclude -I. -I.. \
17        -I$(TDBDIR)/include -I$(TALLOCDIR) -DUSE_MMAP=1 $(LDAP_FLAGS)
18
19 # enable the following two lines to build with gcov code coverage support
20 #GCOV_FLAGS = -ftest-coverage -fprofile-arcs 
21 #GCOV_LIBS = -lgcov
22
23 CFLAGS = $(CFLAGS1) $(GCOV_FLAGS)
24
25 LIB_FLAGS=-Llib -lldb $(LDAP_LIBS) $(GCOV_LIBS)
26
27 TDB_OBJ=$(TDBDIR)/common/tdb.o $(TDBDIR)/common/spinlock.o
28 TALLOC_OBJ=$(TALLOCDIR)/talloc.o
29
30 LDB_TDB_OBJ=ldb_tdb/ldb_match.o ldb_tdb/ldb_tdb.o \
31         ldb_tdb/ldb_pack.o ldb_tdb/ldb_search.o ldb_tdb/ldb_index.o \
32         ldb_tdb/ldb_cache.o
33
34
35 COMMON_OBJ=common/ldb.o common/ldb_ldif.o common/util.o \
36            common/ldb_parse.o common/ldb_msg.o common/ldb_utf8.o \
37            common/ldb_debug.o common/ldb_modules.o
38
39 MODULES_OBJ=modules/timestamps.o
40
41 OBJS =  $(MODULES_OBJ) $(COMMON_OBJ) $(LDB_TDB_OBJ) $(TDB_OBJ) $(TALLOC_OBJ) $(LDB_LDAP_OBJ)
42
43 LDB_LIB = lib/libldb.a
44
45 BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest
46
47 LIBS = $(LDB_LIB)($(OBJS))
48
49 DIRS = lib bin
50
51 all: $(DIRS) $(BINS) $(LIBS) manpages
52
53 lib:
54         mkdir -p lib
55
56 bin:
57         mkdir -p bin
58
59 lib/libldb.a: $(OBJS)
60
61 bin/ldbadd: tools/ldbadd.o $(LIBS)
62         $(CC) -o bin/ldbadd tools/ldbadd.o $(LIB_FLAGS)
63
64 bin/ldbsearch: tools/ldbsearch.o $(LIBS)
65         $(CC) -o bin/ldbsearch tools/ldbsearch.o $(LIB_FLAGS)
66
67 bin/ldbdel: tools/ldbdel.o $(LIBS)
68         $(CC) -o bin/ldbdel tools/ldbdel.o $(LIB_FLAGS)
69
70 bin/ldbmodify: tools/ldbmodify.o $(LIBS)
71         $(CC) -o bin/ldbmodify tools/ldbmodify.o $(LIB_FLAGS)
72
73 bin/ldbedit: tools/ldbedit.o $(LIBS)
74         $(CC) -o bin/ldbedit tools/ldbedit.o $(LIB_FLAGS)
75
76 bin/ldbrename: tools/ldbrename.o $(LIBS)
77         $(CC) -o bin/ldbrename tools/ldbrename.o $(LIB_FLAGS)
78
79 bin/ldbtest: tools/ldbtest.o $(LIBS)
80         $(CC) -o bin/ldbtest tools/ldbtest.o $(LIB_FLAGS)
81
82 manpages:
83         -man/build_manpages.sh
84
85 clean:
86         rm -f */*.o *.gcov */*.gc?? *~ */*~ $(BINS) $(TDB_OBJ) $(TALLOC_OBJ) $(LDB_LIB) man/man?/*.[13]
87
88 etags:
89         etags */*.[ch]
90
91 test-tdb:
92         @echo "STARTING TDB BACKEND TEST"
93         tests/test-tdb.sh
94
95 test-ldap:
96         @echo "STARTING LDAP BACKEND TEST"
97         tests/test-ldap.sh
98
99 test: test-tdb test-ldap
100
101 gcov:
102         gcov -po ldb_ldap ldb_ldap/*.c 2| tee ldb_ldap.report.gcov
103         gcov -po ldb_tdb ldb_tdb/*.c 2| tee ldb_tdb.report.gcov
104         gcov -po common common/*.c 2| tee common.report.gcov
105         gcov -po modules modules/*.c 2| tee modules.report.gcov
106         gcov -po tools tools/*.c 2| tee tools.report.gcov