ports/databases/leveldb/files/patch-Makefile
Sunpoet Po-Chuan Hsieh 65aafbcdb6 - Add leveldb 1.2.20111024
LevelDB is a fast key-value storage library written at Google that provides an
ordered mapping from string keys to string values.

Features:
- Keys and values are arbitrary byte arrays.
- Data is stored sorted by key.
- Callers can provide a custom comparison function to override the sort order.
- The basic operations are Put(key,value), Get(key), Delete(key).
- Multiple changes can be made in one atomic batch.
- Users can create a transient snapshot to get a consistent view of data.
- Forward and backward iteration is supported over the data.
- Data is automatically compressed using the Snappy compression library.
- External activity (file system operations etc.) is relayed through a virtual
  interface so users can customize the operating system interactions.
- Detailed documentation about how to use the library is included with the
  source code.

Limitations:
- This is not a SQL database. It does not have a relational data model, it does
  not support SQL queries, and it has no support for indexes.
- Only a single process (possibly multi-threaded) can access a particular
  database at a time.
- There is no client-server support builtin to the library. An application that
  needs such support will have to wrap their own server around the library.

WWW: http://code.google.com/p/leveldb/
2011-10-28 10:54:30 +00:00

60 lines
2.1 KiB
Text

--- Makefile.orig 2011-10-24 18:02:13.000000000 +0800
+++ Makefile 2011-10-27 18:37:46.857260892 +0800
@@ -2,13 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. See the AUTHORS file for names of contributors.
-CC = g++
+CC ?= g++
#-----------------------------------------------
# Uncomment exactly one of the lines labelled (A), (B), and (C) below
# to switch between compilation modes.
-OPT = -O2 -DNDEBUG # (A) Production use (optimized mode)
+OPT ?= -O2 -DNDEBUG # (A) Production use (optimized mode)
# OPT = -g2 # (B) Debug mode, w/ full line-level debugging symbols
# OPT = -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols
#-----------------------------------------------
@@ -36,7 +36,7 @@
GOOGLE_PERFTOOLS_LDFLAGS=
endif
-CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
+CFLAGS += -c -fPIC -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
LDFLAGS=$(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
@@ -103,15 +103,19 @@
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
LIBRARY = libleveldb.a
+SHARED_LIBRARY = libleveldb.so
+SHARED_LIBRARY_VER = 0
MEMENVLIBRARY = libmemenv.a
-all: $(LIBRARY)
+SHARED_LIBOBJECTS = $(LIBOBJECTS:.o=.so)
+
+all: $(LIBRARY) $(SHARED_LIBRARY)
check: $(PROGRAMS) $(TESTS)
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
clean:
- -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
+ -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED_LIBRARY) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
-rm -rf ios-x86/* ios-arm/*
-rm build_config.mk
@@ -119,6 +123,10 @@
rm -f $@
$(AR) -rs $@ $(LIBOBJECTS)
+$(SHARED_LIBRARY): $(LIBOBJECTS)
+ rm -f $@
+ $(CC) -shared -Wl,-soname,$@.$(SHARED_LIBRARY_VER) -o $@.$(SHARED_LIBRARY_VER) $(LDFLAGS) $(LIBOBJECTS)
+
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
$(CC) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@