]> git.sur5r.net Git - openldap/blob - libraries/liblmdb/Makefile
Tweak comments, defaults should be OK already
[openldap] / libraries / liblmdb / Makefile
1 # Makefile for liblmdb (Lightning memory-mapped database library).
2
3 ########################################################################
4 # Configuration. The compiler options must enable threaded compilation.
5 #
6 # Preprocessor macros (for CPPFLAGS) of interest...
7 # Note that the defaults should already be correct for most
8 # platforms; you should not need to change any of these:
9 #
10 # To compile successfully if the default does not:
11 # - MDB_USE_POSIX_SEM   (enabled by default on BSD, Apple)
12 #       Define if shared mutexes are unsupported.  Note that Posix
13 #       semaphores and shared mutexes have different behaviors and
14 #       different problems, see the Caveats section in lmdb.h.
15 #
16 # For best performance or to compile successfully:
17 # - MDB_DSYNC = "O_DSYNC" (default) or "O_SYNC" (less efficient)
18 #       If O_DSYNC is undefined but exists in /usr/include,
19 #       preferably set some compiler flag to get the definition.
20 # - MDB_FDATASYNC = "fdatasync" or "fsync"
21 #       Function for flushing the data of a file. Define this to
22 #       "fsync" if fdatasync() is not supported. fdatasync is
23 #       default except on BSD, Apple, Android which use fsync.
24 # - MDB_USE_PWRITEV
25 #       Define if the pwritev() function is supported.
26 #
27 # Data format:
28 # - MDB_MAXKEYSIZE
29 #       Controls data packing and limits, see mdb.c.
30 #       You might need to change this if the default size is too small.
31 #
32 CC      = gcc
33 W       = -W -Wall -Wno-unused-parameter -Wbad-function-cast
34 THREADS = -pthread
35 OPT = -O2 -g
36 CFLAGS  = $(THREADS) $(OPT) $(W) $(XCFLAGS)
37 LDLIBS  =
38 SOLIBS  =
39 prefix  = /usr/local
40
41 ########################################################################
42
43 IHDRS   = lmdb.h
44 ILIBS   = liblmdb.a liblmdb.so
45 IPROGS  = mdb_stat mdb_copy
46 IDOCS   = mdb_stat.1 mdb_copy.1
47 PROGS   = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5
48 all:    $(ILIBS) $(PROGS)
49
50 install: $(ILIBS) $(IPROGS) $(IHDRS)
51         cp $(IPROGS) $(DESTDIR)$(prefix)/bin
52         cp $(ILIBS) $(DESTDIR)$(prefix)/lib
53         cp $(IHDRS) $(DESTDIR)$(prefix)/include
54         cp $(IDOCS) $(DESTDIR)$(prefix)/man/man1
55
56 clean:
57         rm -rf $(PROGS) *.[ao] *.so *~ testdb
58
59 test:   all
60         mkdir testdb
61         ./mtest && ./mdb_stat testdb
62
63 liblmdb.a:      mdb.o midl.o
64         ar rs $@ mdb.o midl.o
65
66 liblmdb.so:     mdb.o midl.o
67         $(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.o midl.o $(SOLIBS)
68
69 mdb_stat: mdb_stat.o liblmdb.a
70 mdb_copy: mdb_copy.o liblmdb.a
71 mtest:    mtest.o    liblmdb.a
72 mtest2: mtest2.o liblmdb.a
73 mtest3: mtest3.o liblmdb.a
74 mtest4: mtest4.o liblmdb.a
75 mtest5: mtest5.o liblmdb.a
76 mtest6: mtest6.o liblmdb.a
77
78 mdb.o: mdb.c lmdb.h midl.h
79         $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c mdb.c
80
81 midl.o: midl.c midl.h
82         $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c midl.c
83
84 %:      %.o
85         $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
86
87 %.o:    %.c lmdb.h
88         $(CC) $(CFLAGS) $(CPPFLAGS) -c $<