openldap/libraries/liblmdb/Makefile

76 lines
2 KiB
Makefile
Raw Normal View History

2013-06-26 12:02:26 -04:00
# Makefile for liblmdb (Lightning memory-mapped database library).
########################################################################
# Configuration. The compiler options must enable threaded compilation.
#
# Preprocessor macros (for CPPFLAGS) of interest...
# Note that the defaults should already be correct for most
# platforms; you should not need to change any of these.
# Read their descriptions in mdb.c if you do:
2013-06-26 12:02:26 -04:00
#
# - MDB_USE_POSIX_SEM
# - MDB_DSYNC
# - MDB_FDATASYNC
2013-06-26 12:02:26 -04:00
# - MDB_USE_PWRITEV
#
# There may be other macros in mdb.c of interest. You should
# read mdb.c before changing any of them.
2013-06-26 12:02:26 -04:00
#
2011-06-29 12:07:37 -04:00
CC = gcc
2011-08-12 07:11:14 -04:00
W = -W -Wall -Wno-unused-parameter -Wbad-function-cast
THREADS = -pthread
2011-07-01 06:56:09 -04:00
OPT = -O2 -g
CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS)
2011-07-01 09:37:51 -04:00
LDLIBS =
SOLIBS =
2012-11-30 15:39:53 -05:00
prefix = /usr/local
2013-06-26 12:02:26 -04:00
########################################################################
2012-11-30 15:39:53 -05:00
IHDRS = lmdb.h
ILIBS = liblmdb.a liblmdb.so
IPROGS = mdb_stat mdb_copy
2013-02-25 05:02:15 -05:00
IDOCS = mdb_stat.1 mdb_copy.1
2012-11-30 15:39:53 -05:00
PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5
all: $(ILIBS) $(PROGS)
install: $(ILIBS) $(IPROGS) $(IHDRS)
2013-08-10 07:12:42 -04:00
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
2011-06-29 12:07:37 -04:00
clean:
2011-08-11 17:35:52 -04:00
rm -rf $(PROGS) *.[ao] *.so *~ testdb
2011-06-29 12:07:37 -04:00
test: all
mkdir testdb
2011-06-29 12:07:37 -04:00
./mtest && ./mdb_stat testdb
liblmdb.a: mdb.o midl.o
2011-08-11 20:33:28 -04:00
ar rs $@ mdb.o midl.o
2011-06-29 12:07:37 -04:00
liblmdb.so: mdb.o midl.o
2013-02-25 08:06:51 -05:00
$(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.o midl.o $(SOLIBS)
2011-08-11 17:35:52 -04:00
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.o: mdb.c lmdb.h midl.h
2011-08-11 17:35:52 -04:00
$(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c mdb.c
2011-08-11 20:33:28 -04:00
midl.o: midl.c midl.h
$(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c midl.c
2011-08-11 17:35:52 -04:00
2011-08-11 17:23:01 -04:00
%: %.o
2011-06-29 12:07:37 -04:00
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
%.o: %.c lmdb.h
2011-06-29 12:07:37 -04:00
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<