From 831d7383741baebe90312833a4319c06831fc01f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 6 Nov 2007 18:58:19 +0100 Subject: r25881: Add ability to build .so of tdb. (This used to be commit 03bc4896e6c83d4d01b366cd5ce9e49547ee206c) --- .bzrignore | 1 + source4/lib/tdb/Makefile.in | 31 ++++++++++++++++++++++++------- source4/lib/tdb/configure.ac | 4 ++++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.bzrignore b/.bzrignore index f11092e899..a4d1abe14e 100644 --- a/.bzrignore +++ b/.bzrignore @@ -205,3 +205,4 @@ source/torture/winbind/proto.h source/lib/ldb/tdbtest.ldb source/lib/ldb/tdbtest.ldb *.po +libtdb.so.* diff --git a/source4/lib/tdb/Makefile.in b/source4/lib/tdb/Makefile.in index ba98564506..fea76cfaef 100644 --- a/source4/lib/tdb/Makefile.in +++ b/source4/lib/tdb/Makefile.in @@ -16,6 +16,11 @@ CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -Iinclude CFLAGS = $(CPPFLAGS) @CFLAGS@ LDFLAGS = @LDFLAGS@ EXEEXT = @EXEEXT@ +SHLD_FLAGS = @SHLD_FLAGS@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PICFLAG = @PICFLAG@ +SONAMEFLAG = @SONAMEFLAG@ +SHLIBEXT = @SHLIBEXT@ .PHONY: test @@ -27,7 +32,10 @@ TDB_OBJ = @TDB_OBJ@ @LIBREPLACEOBJ@ DIRS = bin common tools -all: showflags dirs $(PROGS) +SONAME = libtdb.$(SHLIBEXT).1 +SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION) + +all: showflags dirs $(PROGS) $(SOLIB) libtdb.a showflags: @echo 'tdb will be compiled with flags:' @@ -36,10 +44,12 @@ showflags: @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) @@ -52,23 +62,30 @@ install: all 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) -bin/tdbtest$(EXEEXT): tools/tdbtest.o libtdb.a +libtdb.(SHLIBEXT): $(SOLIB) + ln -s $< $@ + +$(SOLIB): $(TDB_OBJ) + $(CC) $(SONAMEFLAG)$(SONAME) $(SHLD_FLAGS) -o $@ $^ + +bin/tdbtest$(EXEEXT): tools/tdbtest.o libtdb.$(SHLIBEXT) $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtest tools/tdbtest.o -L. -ltdb -lgdbm -bin/tdbtool$(EXEEXT): tools/tdbtool.o libtdb.a +bin/tdbtool$(EXEEXT): tools/tdbtool.o libtdb.$(SHLIBEXT) $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtool tools/tdbtool.o -L. -ltdb -bin/tdbtorture$(EXEEXT): tools/tdbtorture.o libtdb.a +bin/tdbtorture$(EXEEXT): tools/tdbtorture.o libtdb.$(SHLIBEXT) $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtorture tools/tdbtorture.o -L. -ltdb -bin/tdbdump$(EXEEXT): tools/tdbdump.o libtdb.a +bin/tdbdump$(EXEEXT): tools/tdbdump.o libtdb.$(SHLIBEXT) $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbdump tools/tdbdump.o -L. -ltdb -bin/tdbbackup$(EXEEXT): tools/tdbbackup.o libtdb.a +bin/tdbbackup$(EXEEXT): tools/tdbbackup.o libtdb.$(SHLIBEXT) $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbbackup tools/tdbbackup.o -L. -ltdb test: bin/tdbtorture$(EXEEXT) diff --git a/source4/lib/tdb/configure.ac b/source4/lib/tdb/configure.ac index 8bfff589cc..de8fc9c2b5 100644 --- a/source4/lib/tdb/configure.ac +++ b/source4/lib/tdb/configure.ac @@ -6,5 +6,9 @@ AC_INIT(tdb, 1.1.0) AC_CONFIG_SRCDIR([common/tdb.c]) AC_CONFIG_HEADER(include/config.h) AC_LIBREPLACE_ALL_CHECKS +AC_LD_SONAMEFLAG +AC_LD_PICFLAG +AC_LD_SHLDFLAGS +AC_LD_SHLIBEXT m4_include(libtdb.m4) AC_OUTPUT(Makefile tdb.pc) -- cgit