snappy-java/Makefile.common

115 lines
3.4 KiB
Makefile
Raw Normal View History

2011-03-29 15:19:23 +02:00
TARGET:=target
SRC:=src/main/java
include $(SRC)/org/xerial/snappy/VERSION
2011-03-29 11:17:07 +02:00
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"
2011-03-29 15:19:23 +02:00
OSINFO_CLASS := org.xerial.snappy.OSInfo
OSINFO_PROG := lib/org/xerial/snappy/OSInfo.class
2011-03-29 11:17:07 +02:00
## 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 15:19:23 +02:00
snappy := snappy-$(VERSION)
2011-03-31 05:23:57 +02:00
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
2011-03-29 15:19:23 +02:00
known_os_archs := Linux-i386 Linux-amd64 Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64
os_arch := $(OS_NAME)-$(OS_ARCH)
2011-03-29 11:17:07 +02:00
2011-03-29 15:19:23 +02:00
ifeq (,$(findstring $(strip $(os_arch)),$(known_os_archs)))
os_arch := Default
2011-03-29 11:17:07 +02:00
endif
2011-03-29 15:19:23 +02:00
Default_CXX := g++
Default_STRIP := strip
Default_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC
2011-03-30 04:20:18 +02:00
Default_LINKFLAGS := -shared -static
Default_LIBNAME := libsnappyjava.so
2011-03-29 15:19:23 +02:00
Default_SNAPPY_FLAGS :=
2011-03-29 11:17:07 +02:00
2011-03-29 15:19:23 +02:00
Linux-i386_CXX := g++
Linux-i386_STRIP := strip
Linux-i386_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m32
2011-05-05 03:55:19 +02:00
Linux-i386_LINKFLAGS := -shared -static-libgcc -static-libstdc++
Linux-i386_LIBNAME := libsnappyjava.so
2011-03-29 15:19:23 +02:00
Linux-i386_SNAPPY_FLAGS:=
2011-03-29 11:17:07 +02:00
2011-03-31 10:22:40 +02:00
Linux-amd64_CXX := g++
2011-03-29 15:19:23 +02:00
Linux-amd64_STRIP := strip
2011-06-04 03:17:10 +02:00
Linux-amd64_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
Linux-amd64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
Linux-amd64_LIBNAME := libsnappyjava.so
Linux-amd64_SNAPPY_FLAGS :=
2011-03-29 11:17:07 +02:00
2011-03-29 15:19:23 +02:00
Mac-i386_CXX := g++ -arch $(OS_ARCH)
2011-03-29 11:17:07 +02:00
Mac-i386_STRIP := strip -x
Mac-i386_CXXFLAGS := -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.4
Mac-i386_LINKFLAGS := -dynamiclib -static-libgcc
Mac-i386_LIBNAME := libsnappyjava.jnilib
2011-03-29 15:19:23 +02:00
Mac-i386_SNAPPY_FLAGS :=
2011-03-29 11:17:07 +02:00
2011-03-29 15:19:23 +02:00
Mac-x86_64_CXX := g++ -arch $(OS_ARCH)
2011-03-29 11:17:07 +02:00
Mac-x86_64_STRIP := strip -x
Mac-x86_64_CXXFLAGS := -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.5
Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc
Mac-x86_64_LIBNAME := libsnappyjava.jnilib
Mac-x86_64_SNAPPY_FLAGS :=
2011-03-29 11:17:07 +02:00
2011-03-29 15:19:23 +02:00
Windows-x86_CXX := mingw32-g++
2011-03-29 11:17:07 +02:00
Windows-x86_STRIP := strip
2011-03-31 05:23:57 +02:00
Windows-x86_CXXFLAGS := -Ilib/inc_win -O2
2011-03-30 09:46:19 +02:00
Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-x86_LIBNAME := snappyjava.dll
Windows-x86_SNAPPY_FLAGS :=
2011-03-29 11:17:07 +02:00
2011-03-30 04:10:57 +02:00
Windows-amd64_CXX := x86_64-w64-mingw32-g++
Windows-amd64_STRIP := x86_64-w64-mingw32-strip
2011-03-30 04:20:18 +02:00
Windows-amd64_CXXFLAGS := -Ilib/inc_win -O2
2011-03-30 09:46:19 +02:00
Windows-amd64_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-amd64_LIBNAME := snappyjava.dll
Windows-amd64_SNAPPY_FLAGS :=
2011-03-29 11:17:07 +02:00
2011-03-29 15:19:23 +02:00
CXX := $($(os_arch)_CXX)
STRIP := $($(os_arch)_STRIP)
CXXFLAGS := $($(os_arch)_CXXFLAGS)
LINKFLAGS := $($(os_arch)_LINKFLAGS)
LIBNAME := $($(os_arch)_LIBNAME)
SNAPPY_FLAGS := $($(os_arch)_SNAPPY_FLAGS)
2011-03-29 11:17:07 +02:00
2011-03-29 15:19:23 +02:00
2011-03-31 05:23:57 +02:00
CXXFLAGS := $(CXXFLAGS) -Ilib/include
2011-03-29 11:17:07 +02:00
ifneq ($(jni_include),)
CXXFLAGS := $(CXXFLAGS) -I"$(jni_include)"
2011-03-29 11:17:07 +02:00
endif