forked from xerial/sqlite-jdbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
185 lines (154 loc) · 6.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
include VERSION
ifndef JAVA_HOME
$(warning Set JAVA_HOME environment variable)
endif
JAVA := "$$JAVA_HOME/bin/java"
JAVAC := "$$JAVA_HOME/bin/javac"
JAVAH := "$$JAVA_HOME/bin/javah"
TARGET := target
OSINFO_CLASS := org.sqlite.OSInfo
OSINFO_PROG := lib/org/sqlite/util/OSInfo.class
## building OSInfo.java
#$(info compiling OSInfo.java)
#$(shell mkdir -p lib)
#$(shell $(JAVAC) src/main/java/org/sqlite/util/OSInfo.java -d lib)
ifndef OS_NAME
OS_NAME := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --os)
endif
ifndef OS_ARCH
OS_ARCH := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --arch)
endif
# Windows uses different path separators
ifeq ($(OS_NAME),Windows)
sep := ;
else
sep := :
endif
sqlite := sqlite-$(version)
ifdef JAVA_HOME
jni_h := $(shell find -L "$(JAVA_HOME)" -name jni.h)
ifneq ($(jni_h),)
jni_include := $(shell dirname "$(jni_h)")
endif
jni_md := $(shell find -L "$(JAVA_HOME)" -name jni_md.h)
ifneq ($(jni_md),)
jni_md_include := $(shell dirname "$(jni_md)")
endif
endif
# os=Default is meant to be generic unix/linux
known_targets := Linux-x86 Linux-x86_64 Linux-arm Linux-armv6 Linux-armv7 Linux-android-arm Linux-ppc64 Mac-x86 Mac-x86_64 FreeBSD-x86_64 OpenBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-sparcv9
target := $(OS_NAME)-$(OS_ARCH)
ifeq (,$(findstring $(strip $(target)),$(known_targets)))
target := Default
endif
# cross-compilation toolchain prefix (e.g. "arm-linux-gnueabi-")
CROSS_PREFIX :=
Default_CC := $(CROSS_PREFIX)gcc
Default_STRIP := $(CROSS_PREFIX)strip
Default_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -fPIC -fvisibility=hidden
Default_LINKFLAGS := -shared
Default_LIBNAME := libsqlitejdbc.so
Default_SQLITE_FLAGS :=
Linux-x86_CC := $(CROSS_PREFIX)gcc
Linux-x86_STRIP := $(CROSS_PREFIX)strip
Linux-x86_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -fPIC -m32 -fvisibility=hidden
Linux-x86_LINKFLAGS := -shared -static-libgcc
Linux-x86_LIBNAME := libsqlitejdbc.so
Linux-x86_SQLITE_FLAGS :=
Linux-x86_64_CC := $(CROSS_PREFIX)gcc
Linux-x86_64_STRIP := $(CROSS_PREFIX)strip
Linux-x86_64_CCFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -Os -fPIC -m64 -fvisibility=hidden
Linux-x86_64_LINKFLAGS := -shared -static-libgcc
Linux-x86_64_LIBNAME := libsqlitejdbc.so
Linux-x86_64_SQLITE_FLAGS :=
Linux-arm_CC := $(CROSS_PREFIX)gcc
Linux-arm_STRIP := $(CROSS_PREFIX)strip
Linux-arm_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -fPIC -mfloat-abi=softfp -mfpu=vfp -fvisibility=hidden
Linux-arm_LINKFLAGS := -shared -static-libgcc
Linux-arm_LIBNAME := libsqlitejdbc.so
Linux-arm_SQLITE_FLAGS :=
Linux-armv6_CC := $(CROSS_PREFIX)gcc
Linux-armv6_STRIP := $(CROSS_PREFIX)strip
Linux-armv6_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -mfloat-abi=hard -mfpu=vfp -fPIC -fvisibility=hidden
Linux-armv6_LINKFLAGS := -shared -static-libgcc
Linux-armv6_LIBNAME := libsqlitejdbc.so
Linux-armv6_SQLITE_FLAGS :=
Linux-armv7_CC := $(CROSS_PREFIX)gcc
Linux-armv7_STRIP := $(CROSS_PREFIX)strip
Linux-armv7_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -mfloat-abi=hard -mfpu=vfp -fPIC -fvisibility=hidden
Linux-armv7_LINKFLAGS := -shared -static-libgcc
Linux-armv7_LIBNAME := libsqlitejdbc.so
Linux-armv7_SQLITE_FLAGS :=
Linux-android-arm_CC := $(CROSS_PREFIX)gcc
Linux-android-arm_STRIP := $(CROSS_PREFIX)strip
Linux-android-arm_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -I/usr/arm-linux-androideabi/sysroot/usr/include -Os -fPIC -fvisibility=hidden -fPIE -pie -lm -lc -landroid -ldl -llog
Linux-android-arm_LINKFLAGS := -shared -static-libgcc
Linux-android-arm_LIBNAME := libsqlitejdbc.so
Linux-android-arm_SQLITE_FLAGS :=
Linux-ppc64_CC := $(CROSS_PREFIX)gcc
Linux-ppc64_STRIP := $(CROSS_PREFIX)strip
Linux-ppc64_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -fPIC -fvisibility=hidden
Linux-ppc64_LINKFLAGS := -shared -static-libgcc
Linux-ppc64_LIBNAME := libsqlitejdbc.so
Linux-ppc64_SQLITE_FLAGS :=
FreeBSD-x86_64_CC := $(CROSS_PREFIX)cc
FreeBSD-x86_64_STRIP := $(CROSS_PREFIX)strip
FreeBSD-x86_64_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -fPIC -fvisibility=hidden
FreeBSD-x86_64_LINKFLAGS := -shared
FreeBSD-x86_64_LIBNAME := libsqlitejdbc.so
FreeBSD-x86_64_SQLITE_FLAGS :=
OpenBSD-x86_64_CC := $(CROSS_PREFIX)gcc
OpenBSD-x86_64_STRIP := $(CROSS_PREFIX)strip
OpenBSD-x86_64_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -Os -fPIC -fvisibility=hidden
OpenBSD-x86_64_LINKFLAGS := -shared
OpenBSD-x86_64_LIBNAME := libsqlitejdbc.so
OpenBSD-x86_64_SQLITE_FLAGS :=
SunOS-sparcv9_CC := $(CROSS_PREFIX)gcc
SunOS-sparcv9_STRIP := $(CROSS_PREFIX)strip
SunOS-sparcv9_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2s-fPIC -m64 -fvisibility=hidden
SunOS-sparcv9_LINKFLAGS := -shared -static-libgcc
SunOS-sparcv9_LIBNAME := libsqlitejdbc.so
SunOS-sparcv9_SQLITE_FLAGS :=
Mac-x86_CC := gcc
Mac-x86_STRIP := strip -x
Mac-x86_CCFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -Os -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden
Mac-x86_LINKFLAGS := -dynamiclib
Mac-x86_LIBNAME := libsqlitejdbc.jnilib
Mac-x86_SQLITE_FLAGS := -DSQLITE_ENABLE_LOCKING_STYLE=0
Mac-x86_64_CC := gcc -arch $(OS_ARCH)
Mac-x86_64_STRIP := strip -x
MAC_SDK := /Developer/SDKs/MacOSX10.10.sdk
ifeq ($(wildcard MAC_SDK),)
MAC_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
endif
Mac-x86_64_CCFLAGS := -I$(MAC_SDK)/System/Library/Frameworks/JavaVM.framework/Headers -Ilib/inc_mac -Os -fPIC -mmacosx-version-min=10.6 -fvisibility=hidden
Mac-x86_64_LINKFLAGS := -dynamiclib
Mac-x86_64_LIBNAME := libsqlitejdbc.jnilib
Mac-x86_64_SQLITE_FLAGS :=
Windows-x86_CC := $(CROSS_PREFIX)gcc
Windows-x86_STRIP := $(CROSS_PREFIX)strip
Windows-x86_CCFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -Os
Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static-libgcc
Windows-x86_LIBNAME := sqlitejdbc.dll
Windows-x86_SQLITE_FLAGS :=
Windows-x86_64_CC := $(CROSS_PREFIX)gcc
Windows-x86_64_STRIP := $(CROSS_PREFIX)strip
Windows-x86_64_CCFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -Os
Windows-x86_64_LINKFLAGS := -Wl,--kill-at -shared -static-libgcc
Windows-x86_64_LIBNAME := sqlitejdbc.dll
Windows-x86_64_SQLITE_FLAGS :=
CC := $($(target)_CC)
STRIP := $($(target)_STRIP)
CCFLAGS := $($(target)_CCFLAGS)
LINKFLAGS := $($(target)_LINKFLAGS)
LIBNAME := $($(target)_LIBNAME)
SQLITE_FLAGS := $($(target)_SQLITE_FLAGS)
SQLITE_AMAL_PREFIX = sqlite-amalgamation-$(shell ./amalgamation_version.sh $(version))
SQLITE_OLD_AMAL_PREFIX = sqlite-amalgamation-$(subst .,_,$(version))
CCFLAGS := $(CCFLAGS)
ifneq ($(jni_include),)
CCFLAGS := $(CCFLAGS) -I"$(jni_include)"
endif
ifneq ($(jni_md_include),)
CCFLAGS := $(CCFLAGS) -I"$(jni_md_include)"
endif