forked from crawshaw/sqlitejdbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
87 lines (72 loc) · 2.36 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
ifndef JAVA_HOME
$(error Set JAVA_HOME environment variable)
endif
ifeq ($(os),)
ifeq ($(shell uname),Darwin)
os := Darwin
endif
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
os := Win
endif
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
os := Win
endif
endif
ifeq ($(os),)
os := Default
endif
# Windows uses different path separators, because they hate me
ifeq ($(os),Win)
sep := ;
else
sep := :
endif
ifeq ($(arch),)
arch := $(shell uname -m)
endif
sqlite_version := 3.6.14.2
sqlite := sqlite-$(sqlite_version)
sqlitejdbc := sqlitejdbc-v$(shell cat VERSION)
jni_md := $(shell find -L "$(JAVA_HOME)/include" -name jni_md.h)
ifneq ($(jni_md),)
jni_include := $(shell dirname "$(jni_md)")
endif
libjdbc := $(wildcard lib/jdbc-*.jar)
libjunit := $(wildcard lib/junit-*.jar)
JAVA := $$JAVA_HOME/bin/java
JAVAC := $$JAVA_HOME/bin/javac -Xbootclasspath/p:$(libjdbc)
JAVAH := $$JAVA_HOME/bin/javah
java_sources = $(wildcard src/org/sqlite/*.java)
java_classes = $(java_sources:src/%.java=build/%.class)
native_classes = $(filter-out %NestedDB.class,$(java_classes))
java_classlist = $(subst $$,\$$,$(patsubst build/%, %, $(wildcard $(java_classes:%.class=%*))))
test_sources = $(wildcard src/test/*.java)
test_classes = $(test_sources:src/%.java=build/%.class)
tests = $(subst /,.,$(patsubst build/%.class,%,$(test_classes)))
target := $(os)-$(arch)
# os=Default is meant to be generic unix/linux
Default_CC := gcc
Default_STRIP := strip
Default_CFLAGS := -I$(JAVA_HOME)/include -Os -fPIC
Default_LINKFLAGS := -shared
Default_LIBNAME := libsqlitejdbc.so
Support10_4 := -isysroot /Developer/SDKs/MacOSX10.4u.sdk
Darwin_CC := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4)
Darwin_STRIP := strip -x
Darwin_CFLAGS := -I$(JAVA_HOME)/include -Os -fPIC
Darwin_LINKFLAGS := -dynamiclib $(Support10_4)
Darwin_LIBNAME := libsqlitejdbc.jnilib
Win_CC := $(arch)-mingw32msvc-gcc
Win_STRIP := $(arch)-mingw32msvc-strip
Win_CFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -O
Win_LINKFLAGS := -Wl,--kill-at -shared
Win_LIBNAME := sqlitejdbc.dll
CC := $($(os)_CC)
STRIP := $($(os)_STRIP)
CFLAGS := $($(os)_CFLAGS)
LINKFLAGS := $($(os)_LINKFLAGS)
LIBNAME := $($(os)_LIBNAME)
CFLAGS := $(CFLAGS) -Ibuild/$(sqlite)-$(target) -Ibuild
ifneq ($(jni_include),)
CFLAGS := $(CFLAGS) -I$(jni_include)
endif