2006-08-31 09:38:48 +00:00
#!gmake
#
2005-04-23 04:30:58 +00:00
CC = @CC@
GCOV = @GCOV@
2005-05-30 15:59:08 +00:00
XSLTPROC = @XSLTPROC@
2006-01-11 16:31:57 +00:00
DOXYGEN = @DOXYGEN@
2005-04-26 10:58:54 +00:00
prefix = @prefix@
exec_prefix = @exec_prefix@
2006-09-04 12:21:42 +00:00
datarootdir = @datarootdir@
2005-04-26 10:58:54 +00:00
includedir = @includedir@
libdir = @libdir@
bindir = @bindir@
2006-02-23 09:55:50 +00:00
mandir = @mandir@
2006-09-05 23:32:35 +00:00
VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@:@poptdir@
2006-08-22 01:32:29 +00:00
srcdir = @srcdir@
builddir = @builddir@
2006-08-22 04:19:40 +00:00
SLAPD = @SLAPD@
2006-08-22 10:46:23 +00:00
EXTRA_OBJ = @EXTRA_OBJ@
TESTS = test-tdb.sh @TESTS@
2004-04-11 01:26:22 +00:00
2007-04-30 08:53:56 +00:00
TALLOC_LIBS = @TALLOC_LIBS@
TALLOC_CFLAGS = @TALLOC_CFLAGS@
2007-04-30 10:49:42 +00:00
TALLOC_OBJ = @TALLOC_OBJ@
2007-04-30 08:53:56 +00:00
TDB_LIBS = @TDB_LIBS@
TDB_CFLAGS = @TDB_CFLAGS@
2007-04-30 10:49:42 +00:00
TDB_OBJ = @TDB_OBJ@
2007-04-30 08:53:56 +00:00
POPT_LIBS = @POPT_LIBS@
POPT_CFLAGS = @POPT_CFLAGS@
2007-04-30 10:49:42 +00:00
POPT_OBJ = @POPT_OBJ@
2007-04-30 08:53:56 +00:00
2006-10-22 21:18:43 +00:00
CFLAGS = -g -I$( srcdir) /include -Iinclude -I$( srcdir) -I$( srcdir) /.. \
2007-04-30 09:38:25 +00:00
$( POPT_CFLAGS) $( TALLOC_CFLAGS) $( TDB_CFLAGS) \
2006-08-22 22:27:57 +00:00
-DLIBDIR= \" $( libdir) \" -DSHLIBEXT= \" @SHLIBEXT@\" -DUSE_MMAP= 1 @CFLAGS@
2004-04-11 01:26:22 +00:00
2007-04-30 10:49:42 +00:00
LIB_FLAGS = @LDFLAGS@ -Llib -lldb @LIBS@ $( POPT_LIBS) $( TALLOC_LIBS) $( TDB_LIBS)
2004-03-31 06:45:39 +00:00
2006-08-22 01:32:29 +00:00
LDB_TDB_DIR = ldb_tdb
LDB_TDB_OBJ = $( LDB_TDB_DIR) /ldb_tdb.o \
$( LDB_TDB_DIR) /ldb_pack.o $( LDB_TDB_DIR) /ldb_search.o $( LDB_TDB_DIR) /ldb_index.o \
$( LDB_TDB_DIR) /ldb_cache.o $( LDB_TDB_DIR) /ldb_tdb_wrap.o
2004-03-31 06:45:39 +00:00
2007-05-08 21:17:58 +00:00
LDB_MAP_DIR = ldb_map
LDB_MAP_OBJ = $( LDB_MAP_DIR) /ldb_map.o $( LDB_MAP_DIR) /ldb_map_inbound.o \
$( LDB_MAP_DIR) /ldb_map_outbound.o
2006-08-22 01:32:29 +00:00
COMDIR = common
COMMON_OBJ = $( COMDIR) /ldb.o $( COMDIR) /ldb_ldif.o \
$( COMDIR) /ldb_parse.o $( COMDIR) /ldb_msg.o $( COMDIR) /ldb_utf8.o \
$( COMDIR) /ldb_debug.o $( COMDIR) /ldb_modules.o \
$( COMDIR) /ldb_dn.o $( COMDIR) /ldb_match.o $( COMDIR) /ldb_attributes.o \
$( COMDIR) /attrib_handlers.o $( COMDIR) /ldb_controls.o $( COMDIR) /qsort.o
2004-03-31 06:45:39 +00:00
2006-08-22 01:32:29 +00:00
MODDIR = modules
2006-11-16 11:15:02 +00:00
MODULES_OBJ = $( MODDIR) /operational.o $( MODDIR) /rdn_name.o \
2006-08-22 01:32:29 +00:00
$( MODDIR) /objectclass.o \
$( MODDIR) /paged_results.o $( MODDIR) /sort.o $( MODDIR) /asq.o
2004-11-15 11:40:27 +00:00
2006-10-22 21:18:43 +00:00
NSSDIR = nssldb
NSS_OBJ = $( NSSDIR) /ldb-nss.o $( NSSDIR) /ldb-pwd.o $( NSSDIR) /ldb-grp.o
NSS_LIB = lib/libnss_ldb.so.2
2007-05-08 21:17:58 +00:00
OBJS = $( MODULES_OBJ) $( COMMON_OBJ) $( LDB_TDB_OBJ) $( TDB_OBJ) $( TALLOC_OBJ) $( POPT_OBJ) $( LDB_MAP_OBJ) @LIBREPLACEOBJ@ $( EXTRA_OBJ)
2004-03-31 06:45:39 +00:00
LDB_LIB = lib/libldb.a
2005-08-21 14:26:03 +00:00
BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest bin/oLschema2ldif
2004-03-31 06:45:39 +00:00
2006-08-23 11:21:44 +00:00
LIBS = $( LDB_LIB)
2004-03-31 06:45:39 +00:00
2006-01-11 16:20:16 +00:00
EXAMPLES = examples/ldbreader examples/ldifreader
2006-09-06 09:44:12 +00:00
DIRS = lib bin common ldb_tdb ldb_ldap ldb_sqlite3 modules tools examples
2006-08-22 01:32:29 +00:00
2006-11-15 14:31:47 +00:00
default : all
nss : nssdir all $( NSS_LIB )
2006-10-22 22:06:08 +00:00
nssdir :
@mkdir -p $( NSSDIR)
all : showflags dirs $( OBJS ) $( LDB_LIB ) $( BINS ) $( EXAMPLES ) manpages
2006-09-06 07:11:09 +00:00
showflags :
@echo 'ldb will be compiled with flags:'
@echo ' CFLAGS = $(CFLAGS)'
@echo ' LIBS = $(LIBS)'
2004-03-31 06:51:44 +00:00
2005-06-13 12:37:37 +00:00
.c.o :
@echo Compiling $* .c
2006-08-22 01:32:29 +00:00
@mkdir -p ` dirname $@ `
2005-06-13 12:37:37 +00:00
@$( CC) $( CFLAGS) -c $< -o $@
2006-08-22 03:47:32 +00:00
dirs :
@mkdir -p $( DIRS)
2004-03-31 06:45:39 +00:00
lib/libldb.a : $( OBJS )
2006-08-23 11:21:44 +00:00
ar -rv $@ $( OBJS)
@-ranlib $@
2004-03-31 06:45:39 +00:00
2007-04-30 10:49:42 +00:00
lib/libnss_ldb.so.2 : $( NSS_OBJ ) $( LIBS ) bin /libldb .a
2006-10-22 21:18:43 +00:00
$( CC) -shared -Wl,-soname,libnss_ldb.so.2 -o lib/libnss_ldb.so.2 $( NSS_OBJ) $( OBJS) $( LIB_FLAGS)
2005-06-18 07:42:21 +00:00
bin/ldbadd : tools /ldbadd .o tools /cmdline .o $( LIBS )
$( CC) -o bin/ldbadd tools/ldbadd.o tools/cmdline.o $( LIB_FLAGS)
2004-03-31 06:45:39 +00:00
2005-06-18 07:42:21 +00:00
bin/ldbsearch : tools /ldbsearch .o tools /cmdline .o $( LIBS )
$( CC) -o bin/ldbsearch tools/ldbsearch.o tools/cmdline.o $( LIB_FLAGS)
2004-03-31 06:45:39 +00:00
2005-06-18 07:42:21 +00:00
bin/ldbdel : tools /ldbdel .o tools /cmdline .o $( LIBS )
$( CC) -o bin/ldbdel tools/ldbdel.o tools/cmdline.o $( LIB_FLAGS)
2004-03-31 06:45:39 +00:00
2005-06-18 07:42:21 +00:00
bin/ldbmodify : tools /ldbmodify .o tools /cmdline .o $( LIBS )
$( CC) -o bin/ldbmodify tools/ldbmodify.o tools/cmdline.o $( LIB_FLAGS)
2004-04-03 12:29:21 +00:00
2005-06-18 07:42:21 +00:00
bin/ldbedit : tools /ldbedit .o tools /cmdline .o $( LIBS )
$( CC) -o bin/ldbedit tools/ldbedit.o tools/cmdline.o $( LIB_FLAGS)
2004-04-10 20:18:22 +00:00
2005-06-18 07:42:21 +00:00
bin/ldbrename : tools /ldbrename .o tools /cmdline .o $( LIBS )
$( CC) -o bin/ldbrename tools/ldbrename.o tools/cmdline.o $( LIB_FLAGS)
2004-10-20 19:28:02 +00:00
2005-06-18 07:42:21 +00:00
bin/ldbtest : tools /ldbtest .o tools /cmdline .o $( LIBS )
$( CC) -o bin/ldbtest tools/ldbtest.o tools/cmdline.o $( LIB_FLAGS)
2004-05-02 10:06:45 +00:00
2006-08-17 08:55:09 +00:00
bin/oLschema2ldif : tools /oLschema 2ldif .o tools /cmdline .o tools /convert .o $( LIBS )
2006-08-17 08:31:19 +00:00
$( CC) -o bin/oLschema2ldif tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $( LIB_FLAGS)
2005-08-21 14:26:03 +00:00
2006-01-11 16:20:16 +00:00
examples/ldbreader : examples /ldbreader .o $( LIBS )
$( CC) -o examples/ldbreader examples/ldbreader.o $( LIB_FLAGS)
2006-08-22 04:19:40 +00:00
2006-01-11 16:20:16 +00:00
examples/ldifreader : examples /ldifreader .o $( LIBS )
$( CC) -o examples/ldifreader examples/ldifreader.o $( LIB_FLAGS)
2006-01-11 16:04:28 +00:00
.SUFFIXES : .1 .1.xml .3 .3.xml .xml .html
2005-04-23 04:30:58 +00:00
2006-08-23 00:42:33 +00:00
manpages :
2006-08-23 04:53:47 +00:00
@$( srcdir) /docs/builddocs.sh " $( XSLTPROC) " " $( srcdir) "
2005-05-30 15:59:08 +00:00
2006-01-11 16:31:57 +00:00
doxygen :
2006-08-22 06:49:16 +00:00
test -z " $( DOXYGEN) " || ( cd $( srcdir) && " $( DOXYGEN) " )
2006-01-11 16:31:57 +00:00
2004-03-31 06:45:39 +00:00
clean :
2006-09-06 09:44:12 +00:00
rm -f *.o */*.o *.gcov */*.gc?? tdbtest.ldb*
2006-10-22 21:18:43 +00:00
rm -f $( BINS) $( TDB_OBJ) $( TALLOC_OBJ) $( LDB_LIB) $( NSS_LIB)
2006-08-23 00:42:33 +00:00
rm -f man/*.1 man/*.3 man/*.html
2006-01-11 16:20:16 +00:00
rm -f $( EXAMPLES)
2006-01-11 16:31:57 +00:00
rm -rf apidocs/
2006-09-06 09:44:12 +00:00
rm -rf tests/schema/
2004-03-31 06:45:39 +00:00
2006-01-11 16:04:28 +00:00
distclean : clean
rm -f *~ */*~
2006-09-06 09:44:12 +00:00
rm -rf bin lib
2006-09-14 20:08:21 +00:00
rm -f config.log config.status config.cache include/config.h
2006-01-11 16:04:28 +00:00
rm -f ldb.pc
2005-06-09 17:33:30 +00:00
rm -f Makefile
2006-09-06 09:44:12 +00:00
realdistclean : distclean
rm -f configure.in include/config.h.in
2006-08-23 11:27:40 +00:00
test : all
2006-08-22 10:46:23 +00:00
for t in $( TESTS) ; do echo STARTING $$ { t} ; $( srcdir) /tests/$$ { t} || exit 1; done
2006-08-22 04:34:06 +00:00
2006-09-13 00:11:07 +00:00
valgrindtest : all
for t in $( TESTS) ; do echo STARTING $$ { t} ; VALGRIND = "valgrind -q --db-attach=yes --num-callers=30" $( srcdir) /tests/$$ { t} || exit 1; done
2006-08-23 11:27:40 +00:00
installcheck : install test
2005-01-02 07:49:29 +00:00
2005-04-26 10:58:54 +00:00
install : all
2007-05-05 20:41:21 +00:00
mkdir -p $( DESTDIR) $( includedir) $( DESTDIR) $( libdir) /pkgconfig $( DESTDIR) $( libdir) $( bindir)
cp $( srcdir) /include/ldb.h $( srcdir) /include/ldb_errors.h $( DESTDIR) $( includedir)
cp $( LDB_LIB) $( DESTDIR) $( libdir)
cp $( BINS) $( DESTDIR) $( bindir)
cp ldb.pc $( DESTDIR) $( libdir) /pkgconfig
$( srcdir) /docs/installdocs.sh $( DESTDIR) $( mandir)
2005-04-26 10:58:54 +00:00
2005-01-02 07:49:29 +00:00
gcov :
2006-08-22 01:32:29 +00:00
$( GCOV) -po ldb_sqlite3 $( srcdir) /ldb_sqlite3/*.c 2| tee ldb_sqlite3.report.gcov
$( GCOV) -po ldb_ldap $( srcdir) /ldb_ldap/*.c 2| tee ldb_ldap.report.gcov
$( GCOV) -po ldb_tdb $( srcdir) /ldb_tdb/*.c 2| tee ldb_tdb.report.gcov
$( GCOV) -po common $( srcdir) /common/*.c 2| tee common.report.gcov
$( GCOV) -po modules $( srcdir) /modules/*.c 2| tee modules.report.gcov
$( GCOV) -po tools $( srcdir) /tools/*.c 2| tee tools.report.gcov
2006-01-22 08:33:32 +00:00
2006-08-23 00:42:33 +00:00
etags :
etags ` find $( srcdir) -name "*.[ch]" `
2006-01-22 08:33:32 +00:00
ctags :
ctags ` find $( srcdir) -name "*.[ch]" `