Permalink
Browse files

Implement make file

  • Loading branch information...
1 parent 1a0a574 commit 45702c345c6dbc46b55601d20bad44d3e732e486 Victor committed Aug 2, 2011
Showing with 32 additions and 26 deletions.
  1. +23 −7 Makefile
  2. +8 −13 Makefile.vars
  3. +1 −0 VERSION
  4. +0 −1 db.i
  5. +0 −5 src/com/anvisics/jleveldb/LevelDBAccess.java
  6. BIN src/jleveldb-linux-x86.lib
View
@@ -6,7 +6,7 @@
#
# To combine these, type:
# cd build
-# mv LIBNAME linux-x86.lib (or win-x86.lib, freebsd-ppc.lib, mac.lib, etc)
+# mv LIBNAME jleveldb-linux-x86.lib (or jleveldb-win-x86.lib, jleveldb-freebsd-ppc.lib, jleveldb-mac.lib, etc)
# java uf jleveldb-vXXX.jar linux-x86.lib
#
# The first is the native library, the second is the java support files.
@@ -17,18 +17,34 @@
include Makefile.vars
-default: test
+default : build/$(LIBNAME)
-test: native $(test_classes)
- $(JAVA) -Djava.library.path=build/$(target) \
- -cp "build/$(sqlitejdbc)-native.jar$(sep)build$(sep)$(libjunit)" \
- org.junit.runner.JUnitCore $(tests)
+native : build/$(LIBNAME) build/$(jleveldb)-native.jar
-native: build/$(jleveldb)-native.jar build/$(target)/$(LIBNAME)
+build/$(LIBNAME) : build/obj build/obj/db_wrap.o
+ g++ -shared build/obj/*.o -o build/$(LIBNAME)
+ cp build/$(LIBNAME) src/
+build/obj : build/$(leveldb)/Makefile
+ cd build/$(leveldb) && $(MAKE) -f Makefile
+ mkdir build/obj
+ cd build/obj && ar -x ../$(leveldb)/libleveldb.a
+
+build/$(leveldb)/Makefile :
+ svn checkout http://leveldb.googlecode.com/svn/trunk/ build/$(leveldb)
+
+build/obj/db_wrap.o : build/db_wrap.cpp
+ g++ -c -fpic build/db_wrap.cpp -I$(JAVA_HOME)/include/ -Ibuild/leveldb/include/ -o build/obj/db_wrap.o;
+
+build/db_wrap.cpp : db.i
+ rm -rf src/com/anvisics/jleveldb/ext
+ mkdir src/com/anvisics/jleveldb/ext
+ swig -c++ -java -package com.anvisics.jleveldb.ext -outdir src/com/anvisics/jleveldb/ext -o build/db_wrap.cpp db.i;
+
build/$(jleveldb)-native.jar: $(java_classes)
cd build && jar cf $(jleveldb)-native.jar $(java_classlist)
+
# build/$(leveldb)-$(target)
build/$(target)/$(LIBNAME): build/$(leveldb)-$(target)/libleveldb.a build/com/anvisics/jleveldb/NativeLevelDB.class
@mkdir -p build/$(target)
View
@@ -28,49 +28,44 @@ ifeq ($(arch),)
arch := $(shell uname -m)
endif
-leveldb := leveldb
-jleveldb := jleveldb-v$(shell cat VERSION)
-
-jni_md := $(shell find -L "$(JAVA_HOME)/include" -name jni_md.h)
-ifneq ($(jni_md),)
-jni_include := $(shell dirname "$(jni_md)")
+ifneq (0,$(shell expr match $(arch) 'i.*86'))
+arch := x86
endif
-libjdbc := $(wildcard lib/jdbc-*.jar)
+leveldb := leveldb
+jleveldb := jleveldb-v$(shell cat VERSION)
libjunit := $(wildcard lib/junit-*.jar)
JAVA := $$JAVA_HOME/bin/java
JAVAC := $$JAVA_HOME/bin/javac -Xbootclasspath/p:$(libjdbc)
-JAVAH := $$JAVA_HOME/bin/javah
java_sources = $(wildcard src/com/anvisics/jleveldb/*.java)
-java_classes = $(java_sources:src/%.java=build/%.class)
+java_classes = $(java_sour'[+\-x/]'ces:src/%.java=build/%.class)
java_classlist = $(subst $$,\$$,$(patsubst build/%, %, $(wildcard $(java_classes:%.class=%*))))
test_sources = $(wildcard src/test/*.java)
test_classes = $(test_sources:src/%.java=build/%.class)
tests = $(subst /,.,$(patsubst build/%.class,%,$(test_classes)))
-target := $(os)-$(arch)
# os=Default is meant to be generic unix/linux
Default_CC := gcc
Default_STRIP := strip
Default_CFLAGS := -I$(JAVA_HOME)/include -Os -fPIC
Default_LINKFLAGS := -shared
-Default_LIBNAME := libleveldb.so
+Default_LIBNAME := jleveldb-linux-$(arch).lib
Support10_4 := -isysroot /Developer/SDKs/MacOSX10.4u.sdk
Darwin_CC := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4)
Darwin_STRIP := strip -x
Darwin_CFLAGS := -I$(JAVA_HOME)/include -Os -fPIC
Darwin_LINKFLAGS := -dynamiclib $(Support10_4)
-Darwin_LIBNAME := libleveldb.jnilib
+Darwin_LIBNAME := jleveldb-mac-universal.lib
Win_CC := $(arch)-mingw32msvc-gcc
Win_STRIP := $(arch)-mingw32msvc-strip
Win_CFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -O
Win_LINKFLAGS := -Wl,--kill-at -shared
-Win_LIBNAME := libleveldb.dll
+Win_LIBNAME := jleveldb-win-$(arch).lib
CC := $($(os)_CC)
STRIP := $($(os)_STRIP)
View
@@ -0,0 +1 @@
+01
View
1 db.i
@@ -140,7 +140,6 @@ namespace leveldb {
// If an error has occurred, return it. Else return an ok status.
Status status() { return it->status(); }
-
};
@@ -6,11 +6,6 @@
import java.io.OutputStream;
import com.anvisics.jleveldb.ext.DBAccessor;
-import com.anvisics.jleveldb.ext.DBWriteBatch;
-import com.anvisics.jleveldb.ext.Options;
-import com.anvisics.jleveldb.ext.ReadOptions;
-import com.anvisics.jleveldb.ext.Status;
-import com.anvisics.jleveldb.ext.WriteOptions;
public class LevelDBAccess {
View
Binary file not shown.

0 comments on commit 45702c3

Please sign in to comment.