r6790: Use config.h file for ldb and add test for stdint.h
[samba.git] / source / lib / ldb / Makefile.in
1 CC = @CC@
2 GCOV = @GCOV@
3 YODL2MAN = @YODL2MAN@
4 prefix = @prefix@
5 exec_prefix = @exec_prefix@
6 includedir = @includedir@
7 libdir = @libdir@
8 bindir = @bindir@
9 WITH_GCOV = @WITH_GCOV@
10 WITH_LDAP = @WITH_LDAP@
11
12 ifeq ($(WITH_LDAP),yes)
13 OPENLDAP_PREFIX=/usr
14 LDAP_LIBS=-L$(OPENLDAP_PREFIX)/lib -llber -lldap
15 LDAP_FLAGS=-DHAVE_LDAP=1
16 LDB_LDAP_OBJ=ldb_ldap/ldb_ldap.o
17 endif
18
19 TDBDIR=../tdb
20 TALLOCDIR=../talloc
21
22 CFLAGS1=-Wall -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith \
23        -Wcast-qual -Wcast-align -Wwrite-strings -g -Iinclude -I. -I.. \
24        -I$(TDBDIR)/include -I$(TALLOCDIR) -DUSE_MMAP=1 $(LDAP_FLAGS)
25
26 # enable the following two lines to build with gcov code coverage support
27 ifeq ($(WITH_GCOV),1)
28 GCOV_FLAGS = -ftest-coverage -fprofile-arcs 
29 GCOV_LIBS = -lgcov
30 endif
31
32 CFLAGS = $(CFLAGS1) $(GCOV_FLAGS) @CFLAGS@
33
34 LIB_FLAGS=-Llib -lldb $(LDAP_LIBS) $(GCOV_LIBS)
35
36 TDB_OBJ=$(TDBDIR)/common/tdb.o $(TDBDIR)/common/spinlock.o
37 TALLOC_OBJ=$(TALLOCDIR)/talloc.o
38
39 LDB_TDB_OBJ=ldb_tdb/ldb_match.o ldb_tdb/ldb_tdb.o \
40         ldb_tdb/ldb_pack.o ldb_tdb/ldb_search.o ldb_tdb/ldb_index.o \
41         ldb_tdb/ldb_cache.o
42
43
44 COMMON_OBJ=common/ldb.o common/ldb_ldif.o common/util.o \
45            common/ldb_parse.o common/ldb_msg.o common/ldb_utf8.o \
46            common/ldb_debug.o common/ldb_modules.o
47
48 MODULES_OBJ=modules/timestamps.o modules/schema.o
49
50 OBJS =  $(MODULES_OBJ) $(COMMON_OBJ) $(LDB_TDB_OBJ) $(TDB_OBJ) $(TALLOC_OBJ) $(LDB_LDAP_OBJ)
51
52 LDB_LIB = lib/libldb.a
53
54 BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest
55
56 LIBS = $(LDB_LIB)($(OBJS))
57
58 DIRS = lib bin
59
60 all: $(DIRS) $(BINS) $(LIBS) manpages
61
62 lib:
63         mkdir -p lib
64
65 bin:
66         mkdir -p bin
67
68 lib/libldb.a: $(OBJS)
69
70 bin/ldbadd: tools/ldbadd.o $(LIBS)
71         $(CC) -o bin/ldbadd tools/ldbadd.o $(LIB_FLAGS)
72
73 bin/ldbsearch: tools/ldbsearch.o $(LIBS)
74         $(CC) -o bin/ldbsearch tools/ldbsearch.o $(LIB_FLAGS)
75
76 bin/ldbdel: tools/ldbdel.o $(LIBS)
77         $(CC) -o bin/ldbdel tools/ldbdel.o $(LIB_FLAGS)
78
79 bin/ldbmodify: tools/ldbmodify.o $(LIBS)
80         $(CC) -o bin/ldbmodify tools/ldbmodify.o $(LIB_FLAGS)
81
82 bin/ldbedit: tools/ldbedit.o $(LIBS)
83         $(CC) -o bin/ldbedit tools/ldbedit.o $(LIB_FLAGS)
84
85 bin/ldbrename: tools/ldbrename.o $(LIBS)
86         $(CC) -o bin/ldbrename tools/ldbrename.o $(LIB_FLAGS)
87
88 bin/ldbtest: tools/ldbtest.o $(LIBS)
89         $(CC) -o bin/ldbtest tools/ldbtest.o $(LIB_FLAGS)
90
91 .SUFFIXES: .1 .2 .3 .yo
92
93 .yo.3: 
94         echo Creating $@ from $<
95         -$(YODL2MAN) -o $@ `dirname $<`/`basename $< .yo` || rm -f $@
96
97 manpages: $(patsubst %.yo,%.3,$(wildcard man/man3/*.yo))
98
99 clean:
100         rm -f */*.o *.gcov */*.gc?? *~ */*~ $(BINS) $(TDB_OBJ) $(TALLOC_OBJ) $(LDB_LIB) man/man?/*.[13]
101
102 etags:
103         etags */*.[ch]
104
105 test-tdb:
106         @echo "STARTING TDB BACKEND TEST"
107         tests/test-tdb.sh
108
109 test-ldap:
110         @echo "STARTING LDAP BACKEND TEST"
111         tests/test-ldap.sh
112
113 test-schema:
114         @echo "STARTING SCHEMA MODULE TEST"
115         tests/test-schema.sh
116
117 test: test-tdb test-ldap test-schema
118
119 install: all
120         cp include/ldb.h $(includedir)
121         cp $(LDB_LIB) $(libdir)
122         cp $(BINS) $(bindir)
123         cp ldb.pc $(libdir)/pkgconfig
124
125 gcov:
126         $(GCOV) -po ldb_ldap ldb_ldap/*.c 2| tee ldb_ldap.report.gcov
127         $(GCOV) -po ldb_tdb ldb_tdb/*.c 2| tee ldb_tdb.report.gcov
128         $(GCOV) -po common common/*.c 2| tee common.report.gcov
129         $(GCOV) -po modules modules/*.c 2| tee modules.report.gcov
130         $(GCOV) -po tools tools/*.c 2| tee tools.report.gcov