-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
118 lines (94 loc) · 3.82 KB
/
Makefile.common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
include VERSION
ifndef JAVA_HOME
$(error Set JAVA_HOME environment variable)
endif
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 := ;
else
sep := :
endif
sqlite := sqlite-$(version)
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 SunOS-sparcv9
target := $(OS_NAME)-$(OS_ARCH)
ifeq (,$(findstring $(strip $(target)),$(known_targets)))
target := Default
endif
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-i386_SQLITE_FLAGS := -DSQLITE_ENABLE_LOCKING_STYLE=0
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_FLAGS := $($(target)_SQLITE_FLAGS)
SQLITE_AMAL_PREFIX:=sqlite-amalgamation-$(subst .,0,$(version))00
CFLAGS := $(CFLAGS)
ifneq ($(jni_include),)
CFLAGS := $(CFLAGS) -I"$(jni_include)"
endif