2011-03-29 11:17:07 +02:00
|
|
|
include VERSION
|
|
|
|
|
|
|
|
ifndef JAVA_HOME
|
|
|
|
$(error Set JAVA_HOME environment variable)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
JAVA := "$$JAVA_HOME/bin/java"
|
|
|
|
JAVAC := "$$JAVA_HOME/bin/javac"
|
|
|
|
JAVAH := "$$JAVA_HOME/bin/javah"
|
|
|
|
|
|
|
|
WORK := target
|
|
|
|
OSINFO_CLASS := org.sqlite.OSInfo
|
|
|
|
OSINFO_PROG := lib/org/sqlite/OSInfo.class
|
|
|
|
|
|
|
|
## building OSInfo.java
|
|
|
|
#$(info compiling OSInfo.java)
|
|
|
|
#$(shell mkdir -p lib)
|
|
|
|
#$(shell $(JAVAC) src/main/java/org/sqlite/OSInfo.java -d lib)
|
|
|
|
|
|
|
|
OS_NAME := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --os)
|
|
|
|
OS_ARCH := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --arch)
|
|
|
|
LIB_FOLDER := $(shell $(JAVA) -cp lib $(OSINFO_CLASS))
|
|
|
|
|
|
|
|
# Windows uses different path separators, because they hate me
|
|
|
|
ifeq ($(OS_NAME),Windows)
|
|
|
|
sep := ;
|
|
|
|
else
|
|
|
|
sep := :
|
|
|
|
endif
|
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
snappy := snappy-$(version)
|
2011-03-29 11:17:07 +02:00
|
|
|
|
|
|
|
jni_md := $(shell find -L "$(JAVA_HOME)" -name jni_md.h)
|
|
|
|
ifneq ($(jni_md),)
|
|
|
|
jni_include := $(shell dirname "$(jni_md)")
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# os=Default is meant to be generic unix/linux
|
|
|
|
|
|
|
|
known_targets := Linux-i386 Linux-amd64 Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64
|
|
|
|
target := $(OS_NAME)-$(OS_ARCH)
|
|
|
|
|
|
|
|
ifeq (,$(findstring $(strip $(target)),$(known_targets)))
|
|
|
|
target := Default
|
|
|
|
endif
|
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
Default_CXX := gcc
|
2011-03-29 11:17:07 +02:00
|
|
|
Default_STRIP := strip
|
2011-03-29 13:30:07 +02:00
|
|
|
Default_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -Os -fPIC
|
2011-03-29 11:17:07 +02:00
|
|
|
Default_LINKFLAGS := -shared
|
2011-03-29 13:30:07 +02:00
|
|
|
Default_LIBNAME := libsnappy.so
|
|
|
|
Default_SNAPPY_FLAGS :=
|
2011-03-29 11:17:07 +02:00
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
Linux-i386_CXX := cc
|
2011-03-29 11:17:07 +02:00
|
|
|
Linux-i386_STRIP := strip
|
2011-03-29 13:30:07 +02:00
|
|
|
Linux-i386_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -Os -fPIC
|
2011-03-29 11:17:07 +02:00
|
|
|
Linux-i386_LINKFLAGS := -shared
|
2011-03-29 13:30:07 +02:00
|
|
|
Linux-i386_LIBNAME := libsnappy.so
|
|
|
|
Linux-i386_SNAPPY_FLAGS :=
|
2011-03-29 11:17:07 +02:00
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
Linux-amd64_CXX := gcc
|
2011-03-29 11:17:07 +02:00
|
|
|
Linux-amd64_STRIP := strip
|
2011-03-29 13:30:07 +02:00
|
|
|
Linux-amd64_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -Os -fPIC
|
2011-03-29 11:17:07 +02:00
|
|
|
Linux-amd64_LINKFLAGS := -shared
|
2011-03-29 13:30:07 +02:00
|
|
|
Linux-amd64_LIBNAME := libsnappy.so
|
|
|
|
Linux-amd64_SNAPPY_FLAGS :=
|
2011-03-29 11:17:07 +02:00
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
Mac-i386_CXX := gcc -arch $(OS_ARCH)
|
2011-03-29 11:17:07 +02:00
|
|
|
Mac-i386_STRIP := strip -x
|
2011-03-29 13:30:07 +02:00
|
|
|
Mac-i386_CXXFLAGS := -I$(JAVA_HOME)/include -Os -fPIC
|
2011-03-29 11:17:07 +02:00
|
|
|
Mac-i386_LINKFLAGS := -dynamiclib
|
2011-03-29 13:30:07 +02:00
|
|
|
Mac-i386_LIBNAME := libsnappy.jnilib
|
|
|
|
Mac-i386_SNAPPY_FLAGS := -DSNAPPY_ENABLE_LOCKING_STYLE=0
|
2011-03-29 11:17:07 +02:00
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
Mac-x86_64_CXX := gcc -arch $(OS_ARCH)
|
2011-03-29 11:17:07 +02:00
|
|
|
Mac-x86_64_STRIP := strip -x
|
2011-03-29 13:30:07 +02:00
|
|
|
Mac-x86_64_CXXFLAGS := -I$(JAVA_HOME)/include -Os -fPIC
|
2011-03-29 11:17:07 +02:00
|
|
|
Mac-x86_64_LINKFLAGS := -dynamiclib
|
2011-03-29 13:30:07 +02:00
|
|
|
Mac-x86_64_LIBNAME := libsnappy.jnilib
|
|
|
|
Mac-x86_64_SNAPPY_FLAGS :=
|
2011-03-29 11:17:07 +02:00
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
Windows-x86_CXX := mingw32-gcc
|
2011-03-29 11:17:07 +02:00
|
|
|
Windows-x86_STRIP := strip
|
2011-03-29 13:30:07 +02:00
|
|
|
Windows-x86_CXXFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -O
|
2011-03-29 11:17:07 +02:00
|
|
|
Windows-x86_LINKFLAGS := -Wl,--kill-at -shared
|
2011-03-29 13:30:07 +02:00
|
|
|
Windows-x86_LIBNAME := snappy.dll
|
|
|
|
Windows-x86_SNAPPY_FLAGS :=
|
2011-03-29 11:17:07 +02:00
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
Windows-amd64_CXX := x86_64-w64-mingw32-gcc
|
2011-03-29 11:17:07 +02:00
|
|
|
Windows-amd64_STRIP := x86_64-w64-mingw32-strip
|
2011-03-29 13:30:07 +02:00
|
|
|
Windows-amd64_CXXFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -O
|
2011-03-29 11:17:07 +02:00
|
|
|
Windows-amd64_LINKFLAGS := -Wl,--kill-at -shared
|
2011-03-29 13:30:07 +02:00
|
|
|
Windows-amd64_LIBNAME := snappy.dll
|
|
|
|
Windows-amd64_SNAPPY_FLAGS :=
|
2011-03-29 11:17:07 +02:00
|
|
|
|
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
CXX := $($(target)_CXX)
|
2011-03-29 11:17:07 +02:00
|
|
|
STRIP := $($(target)_STRIP)
|
2011-03-29 13:30:07 +02:00
|
|
|
CXXFLAGS := $($(target)_CXXFLAGS)
|
2011-03-29 11:17:07 +02:00
|
|
|
LINKFLAGS := $($(target)_LINKFLAGS)
|
|
|
|
LIBNAME := $($(target)_LIBNAME)
|
2011-03-29 13:30:07 +02:00
|
|
|
SNAPPY_FLAGS := $($(target)_SNAPPY_FLAGS)
|
2011-03-29 11:17:07 +02:00
|
|
|
|
2011-03-29 13:30:07 +02:00
|
|
|
CXXFLAGS := $(CXXFLAGS) -I$(WORK)/build/$(snappy)-$(target) -I$(WORK)/build
|
2011-03-29 11:17:07 +02:00
|
|
|
ifneq ($(jni_include),)
|
2011-03-29 13:30:07 +02:00
|
|
|
CXXFLAGS := $(CXXFLAGS) -I"$(jni_include)"
|
2011-03-29 11:17:07 +02:00
|
|
|
endif
|
|
|
|
|