69c1bf6ad90cc7a99e56eb60984388ccaf6049e6
[samba.git] / source4 / lib / ldb / ldb.mk
1 LDB_LIB = $(STATICLIB)
2
3 LIB_FLAGS=$(LDFLAGS) -Llib $(LDB_LIB) $(LIBS) $(POPT_LIBS) $(TALLOC_LIBS) \
4                   $(TDB_LIBS) $(LDAP_LIBS) $(LIBDL)
5
6 LDB_TDB_DIR=ldb_tdb
7 LDB_TDB_OBJ=$(LDB_TDB_DIR)/ldb_tdb.o \
8         $(LDB_TDB_DIR)/ldb_pack.o $(LDB_TDB_DIR)/ldb_search.o $(LDB_TDB_DIR)/ldb_index.o \
9         $(LDB_TDB_DIR)/ldb_cache.o $(LDB_TDB_DIR)/ldb_tdb_wrap.o
10
11 LDB_MAP_DIR=ldb_map
12 LDB_MAP_OBJ=$(LDB_MAP_DIR)/ldb_map.o $(LDB_MAP_DIR)/ldb_map_inbound.o \
13             $(LDB_MAP_DIR)/ldb_map_outbound.o
14
15 COMDIR=common
16 COMMON_OBJ=$(COMDIR)/ldb.o $(COMDIR)/ldb_ldif.o \
17            $(COMDIR)/ldb_parse.o $(COMDIR)/ldb_msg.o $(COMDIR)/ldb_utf8.o \
18            $(COMDIR)/ldb_debug.o $(COMDIR)/ldb_modules.o \
19            $(COMDIR)/ldb_dn.o $(COMDIR)/ldb_match.o $(COMDIR)/ldb_attributes.o \
20            $(COMDIR)/attrib_handlers.o $(COMDIR)/ldb_controls.o $(COMDIR)/qsort.o
21
22 MODDIR=modules
23 MODULES_OBJ=$(MODDIR)/operational.o $(MODDIR)/rdn_name.o \
24            $(MODDIR)/paged_results.o $(MODDIR)/sort.o $(MODDIR)/asq.o
25
26 NSSDIR=nssldb
27 NSS_OBJ= $(NSSDIR)/ldb-nss.o $(NSSDIR)/ldb-pwd.o $(NSSDIR)/ldb-grp.o
28 NSS_LIB = lib/libnss_ldb.$(SHLIBEXT).2
29
30 lib/libldb.a: $(OBJS)
31         ar -rv $@ $(OBJS)
32         @-ranlib $@
33
34 sample_module.$(SHLIBEXT): tests/sample_module.o
35         $(MDLD) $(MDLD_FLAGS) -o $@ tests/sample_module.o
36
37 bin/ldbadd: tools/ldbadd.o tools/cmdline.o $(LIBS)
38         $(CC) -o bin/ldbadd tools/ldbadd.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
39
40 bin/ldbsearch: tools/ldbsearch.o tools/cmdline.o $(LIBS)
41         $(CC) -o bin/ldbsearch tools/ldbsearch.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
42
43 bin/ldbdel: tools/ldbdel.o tools/cmdline.o $(LIBS)
44         $(CC) -o bin/ldbdel tools/ldbdel.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
45
46 bin/ldbmodify: tools/ldbmodify.o tools/cmdline.o $(LIBS)
47         $(CC) -o bin/ldbmodify tools/ldbmodify.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
48
49 bin/ldbedit: tools/ldbedit.o tools/cmdline.o $(LIBS)
50         $(CC) -o bin/ldbedit tools/ldbedit.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
51
52 bin/ldbrename: tools/ldbrename.o tools/cmdline.o $(LIBS)
53         $(CC) -o bin/ldbrename tools/ldbrename.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
54
55 bin/ldbtest: tools/ldbtest.o tools/cmdline.o $(LIBS)
56         $(CC) -o bin/ldbtest tools/ldbtest.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
57
58 bin/oLschema2ldif: tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIBS)
59         $(CC) -o bin/oLschema2ldif tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIB_FLAGS)
60
61 examples/ldbreader: examples/ldbreader.o $(LIBS)
62         $(CC) -o examples/ldbreader examples/ldbreader.o $(LIB_FLAGS)
63
64 examples/ldifreader: examples/ldifreader.o $(LIBS)
65         $(CC) -o examples/ldifreader examples/ldifreader.o $(LIB_FLAGS)
66
67 # Python bindings
68 build-python:: _ldb.$(SHLIBEXT)
69
70 ldb_wrap.o: $(ldbdir)/ldb_wrap.c
71         $(CC) -c $(ldbdir)/ldb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
72         
73 _ldb.$(SHLIBEXT): $(LIBS) ldb_wrap.o
74         $(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS)
75
76 install-python:: build-python
77         $(ldbdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
78
79 install-swig::
80         cp ldb.i `$(SWIG) -swiglib`
81
82 check-python:: build-python
83         LD_LIBRARY_PATH=lib PYTHONPATH=.:$(ldbdir) trial $(ldbdir)/tests/python/api.py
84
85 clean::
86         rm -f _ldb.$(SHLIBEXT)