r7133: work in progress, including a HIGHLY revised and simplified schema
[kai/samba.git] / source4 / lib / ldb / Makefile.in
1 CC = @CC@
2 GCOV = @GCOV@
3 XSLTPROC = @XSLTPROC@
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 %.3: %.3.xml
94         test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
95
96 %.1: %.1.xml
97         test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
98
99 %.html: %.xml
100         test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $<
101
102 manpages: $(patsubst %.xml,%,$(wildcard man/*/*.xml))
103
104 clean:
105         rm -f */*.o *.gcov */*.gc?? *~ */*~ $(BINS) $(TDB_OBJ) $(TALLOC_OBJ) $(LDB_LIB) man/man?/*.[13]
106
107 etags:
108         etags */*.[ch]
109
110 test-tdb:
111         @echo "STARTING TDB BACKEND TEST"
112         tests/test-tdb.sh
113
114 test-ldap:
115         @echo "STARTING LDAP BACKEND TEST"
116         tests/test-ldap.sh
117
118 test-schema:
119         @echo "STARTING SCHEMA MODULE TEST"
120         tests/test-schema.sh
121
122 test: test-tdb test-ldap test-schema
123
124 install: all
125         cp include/ldb.h $(includedir)
126         cp $(LDB_LIB) $(libdir)
127         cp $(BINS) $(bindir)
128         cp ldb.pc $(libdir)/pkgconfig
129
130 gcov:
131         $(GCOV) -po ldb_ldap ldb_ldap/*.c 2| tee ldb_ldap.report.gcov
132         $(GCOV) -po ldb_tdb ldb_tdb/*.c 2| tee ldb_tdb.report.gcov
133         $(GCOV) -po common common/*.c 2| tee common.report.gcov
134         $(GCOV) -po modules modules/*.c 2| tee modules.report.gcov
135         $(GCOV) -po tools tools/*.c 2| tee tools.report.gcov