r26218: Remove libtdb.so as well.
[jelmer/samba4-debian.git] / source / lib / tdb / Makefile.in
index 3969995db32f3e63842f70638bea8ccc35eb36d2..7ca78e53177eb0cf9742b622522fd98374a86280 100644 (file)
@@ -9,56 +9,121 @@ exec_prefix = @exec_prefix@
 bindir = @bindir@
 includedir = @includedir@
 libdir = @libdir@
-VPATH = @srcdir@
+VPATH = @srcdir@:@libreplacedir@
 srcdir = @srcdir@
 builddir = @builddir@
-CFLAGS = -I$(srcdir)/include -Iinclude @CFLAGS@
+CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -Iinclude 
+CFLAGS = $(CPPFLAGS) @CFLAGS@
+LDFLAGS = @LDFLAGS@
+EXEEXT = @EXEEXT@
+SHLD = @SHLD@
+SHLD_FLAGS = @SHLD_FLAGS@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PICFLAG = @PICFLAG@
+SHLIBEXT = @SHLIBEXT@
+SWIG = @SWIG@
 
-PROGS = bin/tdbtool bin/tdbtorture
-TDB_OBJ = common/tdb.o common/dump.o common/io.o common/lock.o \
-       common/open.o common/traverse.o common/freelist.o common/error.o \
-       common/transaction.o
+.PHONY: test
 
-DIRS = lib bin common tools examples
+PROGS = bin/tdbtool$(EXEEXT) bin/tdbdump$(EXEEXT) bin/tdbbackup$(EXEEXT)
+PROGS_NOINSTALL = bin/tdbtest$(EXEEXT) bin/tdbtorture$(EXEEXT)
+ALL_PROGS = $(PROGS) $(PROGS_NOINSTALL)
 
-all: dirs $(PROGS)
+TDB_OBJ = @TDB_OBJ@ @LIBREPLACEOBJ@
+
+DIRS = bin common tools
+
+SONAME = libtdb.$(SHLIBEXT).1
+SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION)
+
+all: showflags dirs $(PROGS) $(SOLIB) libtdb.a
+
+showflags:
+       @echo 'tdb will be compiled with flags:'
+       @echo '  CFLAGS = $(CFLAGS)'
+       @echo '  CPPFLAGS = $(CPPFLAGS)'
+       @echo '  LDFLAGS = $(LDFLAGS)'
+       @echo '  LIBS = $(LIBS)'
+
+.SUFFIXES: .c .o
 
 .c.o:
        @echo Compiling $*.c
        @mkdir -p `dirname $@`
-       $(CC) $(CFLAGS) -c $< -o $@
+       @$(CC) $(PICFLAG) $(CFLAGS) -c $< -o $@
 
 dirs:
        @mkdir -p $(DIRS)
 
 install: all
-       mkdir -p $(bindir)
-       mkdir -p $(includedir)
-       mkdir -p $(libdir) 
-       mkdir -p $(libdir)/pkgconfig
-       cp $(PROGS) $(bindir)
-       cp $(srcdir)/include/tdb.h $(includedir)
-       cp tdb.pc $(libdir)/pkgconfig
+       mkdir -p $(DESTDIR)$(bindir)
+       mkdir -p $(DESTDIR)$(includedir)
+       mkdir -p $(DESTDIR)$(libdir) 
+       mkdir -p $(DESTDIR)$(libdir)/pkgconfig
+       cp $(PROGS) $(DESTDIR)$(bindir)
+       cp $(srcdir)/include/tdb.h $(DESTDIR)$(includedir)
+       cp tdb.pc $(DESTDIR)$(libdir)/pkgconfig
+       cp libtdb.a $(SOLIB) $(DESTDIR)$(libdir)
+
+libtdb.a: $(TDB_OBJ)
+       ar -rv libtdb.a $(TDB_OBJ)
+
+libtdb.$(SHLIBEXT): $(SOLIB)
+       ln -fs $< $@
+
+$(SONAME): $(SOLIB)
+       ln -fs $< $@
+
+$(SOLIB): $(TDB_OBJ)
+       $(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(SONAME)
 
-bin/tdbtest: tools/tdbtest.o $(TDB_OBJ)
-       $(CC) $(CFLAGS) -o bin/tdbtest tools/tdbtest.o $(TDB_OBJ) -lgdbm
+TDB_LIB = libtdb.a
 
-bin/tdbtool: tools/tdbtool.o $(TDB_OBJ)
-       $(CC) $(CFLAGS) -o bin/tdbtool tools/tdbtool.o $(TDB_OBJ)
+bin/tdbtest$(EXEEXT): tools/tdbtest.o $(TDB_LIB)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtest tools/tdbtest.o -L. -ltdb -lgdbm
 
-bin/tdbtorture: tools/tdbtorture.o $(TDB_OBJ)
-       $(CC) $(CFLAGS) -o bin/tdbtorture tools/tdbtorture.o $(TDB_OBJ)
+bin/tdbtool$(EXEEXT): tools/tdbtool.o $(TDB_LIB)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtool tools/tdbtool.o -L. -ltdb
 
-bin/tdbdump: tools/tdbdump.o $(TDB_OBJ)
-       $(CC) $(CFLAGS) -o bin/tdbdump tools/tdbdump.o $(TDB_OBJ)
+bin/tdbtorture$(EXEEXT): tools/tdbtorture.o $(TDB_LIB)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtorture tools/tdbtorture.o -L. -ltdb
 
-bin/tdbbackup: tools/tdbbackup.o $(TDB_OBJ)
-       $(CC) $(CFLAGS) -o bin/tdbbackup tools/tdbbackup.o $(TDB_OBJ)
+bin/tdbdump$(EXEEXT): tools/tdbdump.o $(TDB_LIB)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbdump tools/tdbdump.o -L. -ltdb
+
+bin/tdbbackup$(EXEEXT): tools/tdbbackup.o $(TDB_LIB)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbbackup tools/tdbbackup.o -L. -ltdb
+
+test: bin/tdbtorture$(EXEEXT)
+       bin/tdbtorture$(EXEEXT)
+
+installcheck: test install
 
 clean:
-       rm -f $(PROGS) common/*.o tools/*.o *~ *.bak */*~ */*.bak *% core test.db test.tdb test.gdbm
+       rm -f $(ALL_PROGS) *.o *.a common/*.o tools/*.o tdb.pc
+       rm -f test.db test.tdb torture.tdb test.gdbm
+       rm -f $(SONAME) $(SOLIB) libtdb.a libtdb.$(SHLIBEXT)
+
+distclean: clean
+       rm -f *~ */*~
+       rm -f config.log config.status include/config.h config.cache
+       rm -f Makefile
+
+realdistclean: distclean
+       rm -f configure include/config.h.in
+
+tdb_wrap.c tdb.py: tdb.i
+       $(SWIG) -python -keyword tdb.i
+
+build-python: libtdb.$(SHLIBEXT) tdb_wrap.c tdb.py
+       ./setup.py build
+
+install-python:
+       ./setup.py install --prefix=$(prefix)
 
-installcheck: install
-       $(bindir)/tdbtorture
+check-python: build-python
+       # FIXME: Should be more portable:
+       LD_LIBRARY_PATH=. PYTHONPATH=.:build/lib.linux-i686-2.4 trial python/tests/simple.py
 
-test: installcheck
+clean-python:
+       ./setup.py clean