76 lines
2.4 KiB
Diff
76 lines
2.4 KiB
Diff
|
# Update main Makefile in oprder to build and install follow guidelines
|
||
|
|
||
|
diff -up liblmdb/Makefile.orig liblmdb/Makefile
|
||
|
--- liblmdb/Makefile.orig 2014-05-22 13:56:31.804238561 +0200
|
||
|
+++ liblmdb/Makefile 2014-05-22 13:56:45.959294775 +0200
|
||
|
@@ -23,25 +23,30 @@ OPT = -O2 -g
|
||
|
CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS)
|
||
|
LDLIBS =
|
||
|
SOLIBS =
|
||
|
+SOVERSION = 0.0.0
|
||
|
prefix = /usr/local
|
||
|
+binprefix = $(prefix)/bin
|
||
|
+libprefix = $(prefix)/lib
|
||
|
+includeprefix = $(prefix)/include
|
||
|
+manprefix = $(prefix)/man
|
||
|
|
||
|
########################################################################
|
||
|
|
||
|
IHDRS = lmdb.h
|
||
|
-ILIBS = liblmdb.a liblmdb.so
|
||
|
+ILIBS = liblmdb.so liblmdb.so.$(SOVERSION)
|
||
|
IPROGS = mdb_stat mdb_copy
|
||
|
IDOCS = mdb_stat.1 mdb_copy.1
|
||
|
PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5
|
||
|
all: $(ILIBS) $(PROGS)
|
||
|
|
||
|
install: $(ILIBS) $(IPROGS) $(IHDRS)
|
||
|
- for f in $(IPROGS); do cp $$f $(DESTDIR)$(prefix)/bin; done
|
||
|
- for f in $(ILIBS); do cp $$f $(DESTDIR)$(prefix)/lib; done
|
||
|
- for f in $(IHDRS); do cp $$f $(DESTDIR)$(prefix)/include; done
|
||
|
- for f in $(IDOCS); do cp $$f $(DESTDIR)$(prefix)/man/man1; done
|
||
|
+ for f in $(IPROGS); do cp $$f $(DESTDIR)$(binprefix); done
|
||
|
+ for f in $(ILIBS); do cp -d $$f $(DESTDIR)$(libprefix); done
|
||
|
+ for f in $(IHDRS); do cp $$f $(DESTDIR)$(includeprefix); done
|
||
|
+ for f in $(IDOCS); do cp $$f $(DESTDIR)$(manprefix)/man1; done
|
||
|
|
||
|
clean:
|
||
|
- rm -rf $(PROGS) *.[ao] *.so *~ testdb
|
||
|
+ rm -rf $(PROGS) *.[ao] *.so* *~ testdb
|
||
|
|
||
|
test: all
|
||
|
mkdir testdb
|
||
|
@@ -50,18 +55,22 @@ test: all
|
||
|
liblmdb.a: mdb.o midl.o
|
||
|
ar rs $@ mdb.o midl.o
|
||
|
|
||
|
-liblmdb.so: mdb.o midl.o
|
||
|
+liblmdb.so: liblmdb.so.$(SOVERSION)
|
||
|
+ rm -f $@
|
||
|
+ ln -s $< $@
|
||
|
+
|
||
|
+liblmdb.so.$(SOVERSION): mdb.o midl.o
|
||
|
# $(CC) $(LDFLAGS) -pthread -shared -Wl,-Bsymbolic -o $@ mdb.o midl.o $(SOLIBS)
|
||
|
- $(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.o midl.o $(SOLIBS)
|
||
|
+ $(CC) $(LDFLAGS) -pthread -shared -Wl,-soname,$@ -o $@ mdb.o midl.o $(SOLIBS)
|
||
|
|
||
|
-mdb_stat: mdb_stat.o liblmdb.a
|
||
|
-mdb_copy: mdb_copy.o liblmdb.a
|
||
|
-mtest: mtest.o liblmdb.a
|
||
|
-mtest2: mtest2.o liblmdb.a
|
||
|
-mtest3: mtest3.o liblmdb.a
|
||
|
-mtest4: mtest4.o liblmdb.a
|
||
|
-mtest5: mtest5.o liblmdb.a
|
||
|
-mtest6: mtest6.o liblmdb.a
|
||
|
+mdb_stat: mdb_stat.o liblmdb.so
|
||
|
+mdb_copy: mdb_copy.o liblmdb.so
|
||
|
+mtest: mtest.o liblmdb.so
|
||
|
+mtest2: mtest2.o liblmdb.so
|
||
|
+mtest3: mtest3.o liblmdb.so
|
||
|
+mtest4: mtest4.o liblmdb.so
|
||
|
+mtest5: mtest5.o liblmdb.so
|
||
|
+mtest6: mtest6.o liblmdb.so
|
||
|
|
||
|
mdb.o: mdb.c lmdb.h midl.h
|
||
|
$(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c mdb.c
|