r18539: 'make distclean' should delete config.cache
[jelmer/samba4-debian.git] / source / lib / ldb / Makefile.in
1 #!gmake
2 #
3 CC = @CC@
4 GCOV = @GCOV@
5 XSLTPROC = @XSLTPROC@
6 DOXYGEN = @DOXYGEN@
7 prefix = @prefix@
8 exec_prefix = @exec_prefix@
9 datarootdir = @datarootdir@
10 includedir = @includedir@
11 libdir = @libdir@
12 bindir = @bindir@
13 mandir = @mandir@
14 VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@:@poptdir@
15 srcdir = @srcdir@
16 builddir = @builddir@
17 SLAPD = @SLAPD@
18 EXTRA_OBJ=@EXTRA_OBJ@
19 TESTS=test-tdb.sh @TESTS@
20
21 CFLAGS=-I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \
22        @POPT_CFLAGS@ -I@tallocdir@ -I@tdbdir@/include -I@libreplacedir@ \
23         -DLIBDIR=\"$(libdir)\" -DSHLIBEXT=\"@SHLIBEXT@\" -DUSE_MMAP=1 @CFLAGS@
24
25 LIB_FLAGS=-Llib -lldb @LIBS@ @POPT_LIBS@
26
27 LDB_TDB_DIR=ldb_tdb
28 LDB_TDB_OBJ=$(LDB_TDB_DIR)/ldb_tdb.o \
29         $(LDB_TDB_DIR)/ldb_pack.o $(LDB_TDB_DIR)/ldb_search.o $(LDB_TDB_DIR)/ldb_index.o \
30         $(LDB_TDB_DIR)/ldb_cache.o $(LDB_TDB_DIR)/ldb_tdb_wrap.o
31
32 COMDIR=common
33 COMMON_OBJ=$(COMDIR)/ldb.o $(COMDIR)/ldb_ldif.o \
34            $(COMDIR)/ldb_parse.o $(COMDIR)/ldb_msg.o $(COMDIR)/ldb_utf8.o \
35            $(COMDIR)/ldb_debug.o $(COMDIR)/ldb_modules.o \
36            $(COMDIR)/ldb_dn.o $(COMDIR)/ldb_match.o $(COMDIR)/ldb_attributes.o \
37            $(COMDIR)/attrib_handlers.o $(COMDIR)/ldb_controls.o $(COMDIR)/qsort.o
38
39 MODDIR=modules
40 MODULES_OBJ=$(MODDIR)/operational.o $(MODDIR)/schema.o $(MODDIR)/rdn_name.o \
41            $(MODDIR)/objectclass.o \
42            $(MODDIR)/paged_results.o $(MODDIR)/sort.o $(MODDIR)/asq.o
43
44 OBJS = $(MODULES_OBJ) $(COMMON_OBJ) $(LDB_TDB_OBJ) @TDBOBJ@ @TALLOCOBJ@ @POPTOBJ@ @LIBREPLACEOBJ@ $(EXTRA_OBJ) 
45
46 LDB_LIB = lib/libldb.a
47
48 BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest bin/oLschema2ldif
49
50 LIBS = $(LDB_LIB)
51
52 EXAMPLES = examples/ldbreader examples/ldifreader
53
54 DIRS = lib bin common ldb_tdb ldb_ldap ldb_sqlite3 modules tools examples
55
56 all: showflags dirs $(OBJS) $(LDB_LIB) $(BINS) $(EXAMPLES) manpages
57
58 showflags:
59         @echo 'ldb will be compiled with flags:'
60         @echo '  CFLAGS = $(CFLAGS)'
61         @echo '  LIBS = $(LIBS)'
62
63 .c.o:
64         @echo Compiling $*.c
65         @mkdir -p `dirname $@`
66         @$(CC) $(CFLAGS) -c $< -o $@
67
68 dirs:
69         @mkdir -p $(DIRS)
70
71 lib/libldb.a: $(OBJS)
72         ar -rv $@ $(OBJS)
73         @-ranlib $@
74
75 bin/ldbadd: tools/ldbadd.o tools/cmdline.o $(LIBS)
76         $(CC) -o bin/ldbadd tools/ldbadd.o tools/cmdline.o $(LIB_FLAGS)
77
78 bin/ldbsearch: tools/ldbsearch.o tools/cmdline.o $(LIBS)
79         $(CC) -o bin/ldbsearch tools/ldbsearch.o tools/cmdline.o $(LIB_FLAGS)
80
81 bin/ldbdel: tools/ldbdel.o tools/cmdline.o $(LIBS)
82         $(CC) -o bin/ldbdel tools/ldbdel.o tools/cmdline.o $(LIB_FLAGS)
83
84 bin/ldbmodify: tools/ldbmodify.o tools/cmdline.o $(LIBS)
85         $(CC) -o bin/ldbmodify tools/ldbmodify.o tools/cmdline.o $(LIB_FLAGS)
86
87 bin/ldbedit: tools/ldbedit.o tools/cmdline.o $(LIBS)
88         $(CC) -o bin/ldbedit tools/ldbedit.o tools/cmdline.o $(LIB_FLAGS)
89
90 bin/ldbrename: tools/ldbrename.o tools/cmdline.o $(LIBS)
91         $(CC) -o bin/ldbrename tools/ldbrename.o tools/cmdline.o $(LIB_FLAGS)
92
93 bin/ldbtest: tools/ldbtest.o tools/cmdline.o $(LIBS)
94         $(CC) -o bin/ldbtest tools/ldbtest.o tools/cmdline.o $(LIB_FLAGS)
95
96 bin/oLschema2ldif: tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIBS)
97         $(CC) -o bin/oLschema2ldif tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIB_FLAGS)
98
99 examples/ldbreader: examples/ldbreader.o $(LIBS)
100         $(CC) -o examples/ldbreader examples/ldbreader.o $(LIB_FLAGS)
101
102 examples/ldifreader: examples/ldifreader.o $(LIBS)
103         $(CC) -o examples/ldifreader examples/ldifreader.o $(LIB_FLAGS)
104
105 .SUFFIXES: .1 .1.xml .3 .3.xml .xml .html
106
107 manpages:
108         @$(srcdir)/docs/builddocs.sh "$(XSLTPROC)" "$(srcdir)"
109
110 doxygen:
111         test -z "$(DOXYGEN)" || (cd $(srcdir) && "$(DOXYGEN)")
112
113 clean:
114         rm -f *.o */*.o *.gcov */*.gc?? tdbtest.ldb*
115         rm -f $(BINS) $(TDB_OBJ) $(TALLOC_OBJ) $(LDB_LIB)
116         rm -f man/*.1 man/*.3 man/*.html
117         rm -f $(EXAMPLES)
118         rm -rf apidocs/
119         rm -rf tests/schema/
120
121 distclean: clean
122         rm -f *~ */*~
123         rm -rf bin lib
124         rm -f config.log config.status config.cache include/config.h
125         rm -f ldb.pc
126         rm -f Makefile
127
128 realdistclean: distclean
129         rm -f configure.in include/config.h.in
130
131 test: all
132         for t in $(TESTS); do echo STARTING $${t}; $(srcdir)/tests/$${t} || exit 1; done
133
134 valgrindtest: all
135         for t in $(TESTS); do echo STARTING $${t}; VALGRIND="valgrind -q --db-attach=yes --num-callers=30" $(srcdir)/tests/$${t} || exit 1; done
136
137 installcheck: install test
138
139 install: all
140         mkdir -p $(includedir) $(libdir)/pkgconfig $(libdir) $(bindir)
141         cp $(srcdir)/include/ldb.h $(srcdir)/include/ldb_errors.h $(includedir)
142         cp $(LDB_LIB) $(libdir)
143         cp $(BINS) $(bindir)
144         cp ldb.pc $(libdir)/pkgconfig
145         $(srcdir)/docs/installdocs.sh $(mandir)
146
147 gcov:
148         $(GCOV) -po ldb_sqlite3 $(srcdir)/ldb_sqlite3/*.c 2| tee ldb_sqlite3.report.gcov
149         $(GCOV) -po ldb_ldap $(srcdir)/ldb_ldap/*.c 2| tee ldb_ldap.report.gcov
150         $(GCOV) -po ldb_tdb $(srcdir)/ldb_tdb/*.c 2| tee ldb_tdb.report.gcov
151         $(GCOV) -po common $(srcdir)/common/*.c 2| tee common.report.gcov
152         $(GCOV) -po modules $(srcdir)/modules/*.c 2| tee modules.report.gcov
153         $(GCOV) -po tools $(srcdir)/tools/*.c 2| tee tools.report.gcov
154
155 etags:
156         etags `find $(srcdir) -name "*.[ch]"`
157
158 ctags:
159         ctags `find $(srcdir) -name "*.[ch]"`