r4466: rather than defining "STANDALONE" for building tdb, ldb and talloc
[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
14 CFLAGS=-Wall -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -g -Iinclude -I. -I.. -I$(TDBDIR)/include -DUSE_MMAP=1 $(LDAP_FLAGS)
15 LIB_FLAGS=-Llib -lldb $(LDAP_LIBS)
16
17 TDB_OBJ=$(TDBDIR)/common/tdb.o $(TDBDIR)/common/spinlock.o
18
19 LDB_TDB_OBJ=ldb_tdb/ldb_match.o ldb_tdb/ldb_tdb.o \
20         ldb_tdb/ldb_pack.o ldb_tdb/ldb_search.o ldb_tdb/ldb_index.o \
21         ldb_tdb/ldb_cache.o
22
23
24 COMMON_OBJ=common/ldb.o common/ldb_ldif.o common/util.o  common/talloc.o \
25            common/ldb_parse.o common/ldb_msg.o common/ldb_utf8.o \
26            common/ldb_alloc.o common/ldb_debug.o common/ldb_modules.o
27
28 MODULES_OBJ=modules/timestamps.o
29
30 OBJS =  $(MODULES_OBJ) $(COMMON_OBJ) $(LDB_TDB_OBJ) $(TDB_OBJ) $(LDB_LDAP_OBJ)
31
32 LDB_LIB = lib/libldb.a
33
34 BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest
35
36 LIBS = $(LDB_LIB)($(OBJS))
37
38 DIRS = lib bin
39
40 all: $(DIRS) $(BINS) $(LIBS) manpages
41
42 lib:
43         mkdir -p lib
44
45 bin:
46         mkdir -p bin
47
48 lib/libldb.a: $(OBJS)
49
50 bin/ldbadd: tools/ldbadd.o $(LIBS)
51         $(CC) -o bin/ldbadd tools/ldbadd.o $(LIB_FLAGS)
52
53 bin/ldbsearch: tools/ldbsearch.o $(LIBS)
54         $(CC) -o bin/ldbsearch tools/ldbsearch.o $(LIB_FLAGS)
55
56 bin/ldbdel: tools/ldbdel.o $(LIBS)
57         $(CC) -o bin/ldbdel tools/ldbdel.o $(LIB_FLAGS)
58
59 bin/ldbmodify: tools/ldbmodify.o $(LIBS)
60         $(CC) -o bin/ldbmodify tools/ldbmodify.o $(LIB_FLAGS)
61
62 bin/ldbedit: tools/ldbedit.o $(LIBS)
63         $(CC) -o bin/ldbedit tools/ldbedit.o $(LIB_FLAGS)
64
65 bin/ldbrename: tools/ldbrename.o $(LIBS)
66         $(CC) -o bin/ldbrename tools/ldbrename.o $(LIB_FLAGS)
67
68 bin/ldbtest: tools/ldbtest.o $(LIBS)
69         $(CC) -o bin/ldbtest tools/ldbtest.o $(LIB_FLAGS)
70
71 manpages:
72         -man/build_manpages.sh
73
74 clean:
75         rm -f */*.o *~ */*~ $(BINS) $(LDB_LIB) man/man?/*.[13]
76
77 etags:
78         etags */*.[ch]
79
80 test-tdb:
81         @echo "STARTING TDB BACKEND TEST"
82         tests/test-tdb.sh
83
84 test-ldap:
85         @echo "STARTING LDAP BACKEND TEST"
86         tests/test-ldap.sh
87
88 test: test-tdb test-ldap