forked from xerial/larray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
executable file
·125 lines (95 loc) · 4.15 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
TARGET:=target
SRC:=src/main/scala
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"
UTIL:=$(TARGET)/util
OSINFO_CLASS := xerial.larray.impl.OSInfo
OSINFO_PROG := $(UTIL)/xerial/larray/impl/OSInfo.class
## building OSInfo.java
osinfo: $(OSINFO_PROG)
$(OSINFO_PROG):
-mkdir -p $(@D)
$(info compiling OSInfo.java)
$(JAVAC) $(SRC)/xerial/larray/impl/OSInfo.java -d $(UTIL)
OS_NAME := $(shell $(JAVA) -cp $(UTIL) $(OSINFO_CLASS) --os)
OS_ARCH := $(shell $(JAVA) -cp $(UTIL) $(OSINFO_CLASS) --arch)
# Windows uses different path separator-)
ifeq ($(OS_NAME),Windows)
sep := ;
else
sep := :
endif
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_os_archs := Linux-i386 Linux-amd64 Linux-arm Linux-armhf Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64
os_arch := $(OS_NAME)-$(OS_ARCH)
ifeq (,$(findstring $(strip $(os_arch)),$(known_os_archs)))
os_arch := Default
endif
# cross-compilation toolchain prefix (e.g. "arm-linux-gnueabi-")
CROSS_PREFIX :=
Default_CC := $(CROSS_PREFIX)gcc
Default_STRIP := $(CROSS_PREFIX)strip
Default_CFLAGS := -I$(JAVA_HOME)/include -Iinclude/inc_mac -O2 -fPIC -fvisibility=hidden
Default_LINKFLAGS := -shared -static
Default_LIBNAME := liblarray.so
Linux-i386_CC := $(CROSS_PREFIX)gcc
Linux-i386_STRIP := $(CROSS_PREFIX)strip
Linux-i386_CFLAGS := -include include/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m32
Linux-i386_LINKFLAGS := -shared -static-libgcc
Linux-i386_LIBNAME := liblarray.so
Linux-amd64_CC := $(CROSS_PREFIX)gcc
Linux-amd64_STRIP := $(CROSS_PREFIX)strip
Linux-amd64_CFLAGS := -include include/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m64
Linux-amd64_LINKFLAGS := -shared -static-libgcc
Linux-amd64_LIBNAME := liblarray.so
# '-include lib/inc_linux/jni_md.h' is used to force the use of our version,
# which defines JNIEXPORT differently; otherwise, since OpenJDK includes
# jni_md.h in same directory as jni.h, the include path is ignored when
# jni_md.h is included from jni.h
Linux-arm_CC := $(CROSS_PREFIX)gcc
Linux-arm_STRIP := $(CROSS_PREFIX)strip
Linux-arm_CFLAGS := -include include/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=softfp
Linux-arm_LINKFLAGS := -shared -static-libgcc
Linux-arm_LIBNAME := liblarray.so
Linux-armhf_CC := $(CROSS_PREFIX)gcc
Linux-armhf_STRIP := $(CROSS_PREFIX)strip
Linux-armhf_CFLAGS := -include include/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=hard
Linux-armhf_LINKFLAGS := -shared -static-libgcc
Linux-armhf_LIBNAME := liblarray.so
Mac-i386_CC := gcc -arch $(OS_ARCH)
Mac-i386_STRIP := strip -x
Mac-i386_CFLAGS := -Iinclude/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden
Mac-i386_LINKFLAGS := -dynamiclib -static-libgcc
Mac-i386_LIBNAME := liblarray.jnilib
Mac-x86_64_CC := gcc -arch $(OS_ARCH)
Mac-x86_64_STRIP := strip -x
Mac-x86_64_CFLAGS := -Iinclude/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc
Mac-x86_64_LIBNAME := liblarray.jnilib
Windows-x86_CC := $(CROSS_PREFIX)gcc
Windows-x86_STRIP := $(CROSS_PREFIX)strip
Windows-x86_CFLAGS := -Iinclude/inc_win -O2
Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-x86_LIBNAME := larray.dll
Windows-amd64_CC := $(CROSS_PREFIX)gcc
Windows-amd64_STRIP := $(CROSS_PREFIX)strip
Windows-amd64_CFLAGS := -Iinclude/inc_win -O2
Windows-amd64_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-amd64_LIBNAME := larray.dll
CC := $($(os_arch)_CC)
STRIP := $($(os_arch)_STRIP)
CFLAGS := $($(os_arch)_CFLAGS)
LINKFLAGS := $($(os_arch)_LINKFLAGS)
LIBNAME := $($(os_arch)_LIBNAME)
CFLAGS := $(CFLAGS) -Iinclude
ifneq ($(jni_include),)
CFLAGS := $(CFLAGS) -I"$(jni_include)"
endif