sqlite-jdbc-linux64 / Makefile.common

include VERSION

ifndef JAVA_HOME
$(error Set JAVA_HOME environment variable)

libjdbc  := $(wildcard lib/jdbc-*.jar)

JAVA  := "$$JAVA_HOME/bin/java"
JAVAC := "$$JAVA_HOME/bin/javac" -Xbootclasspath/p:$(libjdbc)
JAVAH := "$$JAVA_HOME/bin/javah"

TARGET := 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 := ;
	sep := :

sqlite := sqlite-$(version)

jni_md := $(shell find -L "$(JAVA_HOME)" -name jni_md.h)
ifneq ($(jni_md),)
jni_include := $(shell dirname "$(jni_md)")

# os=Default is meant to be generic unix/linux

known_targets := Linux-i386 Linux-amd64 Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64 SunOS-sparcv9
target := $(OS_NAME)-$(OS_ARCH)

ifeq (,$(findstring $(strip $(target)),$(known_targets)))
  target := Default

Default_CC        := gcc
Default_STRIP     := strip
Default_CFLAGS    := -I$(JAVA_HOME)/include -Isqlitejdbc/lib/inc_linux -Os -fPIC -fvisibility=hidden
Default_LINKFLAGS := -shared
Default_LIBNAME   := libsqlitejdbc.so
Default_SQLITE_FLAGS  := 

Linux-i386_CC  := gcc
Linux-i386_STRIP  := strip
Linux-i386_CFLAGS    := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -m32 -fvisibility=hidden
Linux-i386_LINKFLAGS := -shared -static-libgcc
Linux-i386_LIBNAME   := libsqlitejdbc.so
Linux-i386_SQLITE_FLAGS  := 

Linux-amd64_CC  := gcc
Linux-amd64_STRIP  := strip
Linux-amd64_CFLAGS    := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -m64 -fvisibility=hidden
Linux-amd64_LINKFLAGS := -shared -static-libgcc
Linux-amd64_LIBNAME   := libsqlitejdbc.so
Linux-amd64_SQLITE_FLAGS  := 

SunOS-sparcv9_CC  := gcc
SunOS-sparcv9_STRIP  := strip
SunOS-sparcv9_CFLAGS    := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -m64 -fvisibility=hidden
SunOS-sparcv9_LINKFLAGS := -shared -static-libgcc
SunOS-sparcv9_LIBNAME   := libsqlitejdbc.so
SunOS-sparcv9_SQLITE_FLAGS  := 

Mac-i386_CC        := gcc -arch $(OS_ARCH) 
Mac-i386_STRIP     := strip -x
Mac-i386_CFLAGS    := -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden
Mac-i386_LINKFLAGS := -dynamiclib -static-libgcc
Mac-i386_LIBNAME   := libsqlitejdbc.jnilib

Mac-x86_64_CC        := gcc -arch $(OS_ARCH) 
Mac-x86_64_STRIP     := strip -x
Mac-x86_64_CFLAGS    := -I/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/JavaVM.framework/Headers -O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc
Mac-x86_64_LIBNAME   := libsqlitejdbc.jnilib
Mac-x86_64_SQLITE_FLAGS  := 

Windows-x86_CC           := mingw32-gcc
Windows-x86_STRIP        := strip
Windows-x86_CFLAGS       := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -O2
Windows-x86_LINKFLAGS    := -Wl,--kill-at -shared
Windows-x86_LIBNAME      := sqlitejdbc.dll
Windows-x86_SQLITE_FLAGS := 

Windows-amd64_CC           := x86_64-w64-mingw32-gcc 
Windows-amd64_STRIP        := x86_64-w64-mingw32-strip
Windows-amd64_CFLAGS       := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -O2
Windows-amd64_LINKFLAGS    := -Wl,--kill-at -shared
Windows-amd64_LIBNAME      := sqlitejdbc.dll
Windows-amd64_SQLITE_FLAGS := 

CC        := $($(target)_CC)
STRIP     := $($(target)_STRIP)
CFLAGS    := $($(target)_CFLAGS) 
LINKFLAGS := $($(target)_LINKFLAGS) 
LIBNAME   := $($(target)_LIBNAME)
SQLITE_AMAL_PREFIX:=sqlite-amalgamation-$(subst .,0,$(version))00
ifneq ($(jni_include),)
CFLAGS := $(CFLAGS) -I"$(jni_include)"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.