--- Makefile.orig 2016-12-28 18:36:01 UTC +++ Makefile @@ -23,17 +23,17 @@ AR = ar W = -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized THREADS = -pthread OPT = -O2 -g -CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS) +CFLAGS += $(THREADS) $(W) LDLIBS = SOLIBS = -SOEXT = .so -prefix = /usr/local +SOEXT = .so.0 +prefix ?= /usr/local exec_prefix = $(prefix) bindir = $(exec_prefix)/bin libdir = $(exec_prefix)/lib includedir = $(prefix)/include datarootdir = $(prefix)/share -mandir = $(datarootdir)/man +mandir = $(prefix)/man ######################################################################## @@ -49,10 +49,10 @@ install: $(ILIBS) $(IPROGS) $(IHDRS) mkdir -p $(DESTDIR)$(libdir) mkdir -p $(DESTDIR)$(includedir) mkdir -p $(DESTDIR)$(mandir)/man1 - for f in $(IPROGS); do cp $$f $(DESTDIR)$(bindir); done - for f in $(ILIBS); do cp $$f $(DESTDIR)$(libdir); done - for f in $(IHDRS); do cp $$f $(DESTDIR)$(includedir); done - for f in $(IDOCS); do cp $$f $(DESTDIR)$(mandir)/man1; done + for f in $(IPROGS); do $(INSTALL_PROGRAM) $$f $(DESTDIR)$(bindir); done + for f in $(ILIBS); do $(INSTALL_LIB) $$f $(DESTDIR)$(libdir); done + for f in $(IHDRS); do $(INSTALL_DATA) $$f $(DESTDIR)$(includedir); done + for f in $(IDOCS); do $(INSTALL_MAN) $$f $(DESTDIR)$(mandir)/man1; done clean: rm -rf $(PROGS) *.[ao] *.[ls]o *~ testdb @@ -64,20 +64,30 @@ test: all liblmdb.a: mdb.o midl.o $(AR) rs $@ mdb.o midl.o -liblmdb$(SOEXT): mdb.lo midl.lo -# $(CC) $(LDFLAGS) -pthread -shared -Wl,-Bsymbolic -o $@ mdb.o midl.o $(SOLIBS) - $(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.lo midl.lo $(SOLIBS) + liblmdb$(SOEXT): mdb.lo midl.lo + # $(CC) $(LDFLAGS) -pthread -shared -Wl,-Bsymbolic -o $@ mdb.o midl.o $(SOLIBS) + $(CC) $(LDFLAGS) -pthread -shared -Wl,-soname,$@ -o $@ mdb.lo midl.lo $(SOLIBS) mdb_stat: mdb_stat.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mdb_copy: mdb_copy.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mdb_dump: mdb_dump.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mdb_load: mdb_load.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mtest: mtest.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mtest2: mtest2.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mtest3: mtest3.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mtest4: mtest4.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mtest5: mtest5.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mtest6: mtest6.o liblmdb.a + ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} mdb.o: mdb.c lmdb.h midl.h $(CC) $(CFLAGS) $(CPPFLAGS) -c mdb.c