-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
92 lines (60 loc) · 2.38 KB
/
Makefile
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
all: larray
include Makefile.common
SRC:=larray-mmap/src/main/java
LARRAY_OUT:=$(TARGET)/larray-$(os_arch)
LARRAY_SRC_DIR:=$(SRC)/xerial/larray/impl
LARRAY_SRC:=$(shell find $(LARRAY_SRC_DIR))
LARRAY_OBJ:=$(LARRAY_OUT)/LArrayNative.o
VERSION:=$(shell perl -npe "s/version in ThisBuild\s+:=\s+\"(.*)\"/\1/" version.sbt | sed -e "/^$$/d")
CFLAGS:=$(CFLAGS) -I$(LARRAY_SRC_DIR)
LARRAY_HEADER:=$(SRC)/xerial/larray/impl/LArrayNative.h
$(TARGET)/classes/xerial/larray/impl/%.class : $(LARRAY_SRC_DIR)/%.java
$(JAVAC) -sourcepath $(SRC) -d $(TARGET)/classes $<
jni-header: $(LARRAY_HEADER)
$(LARRAY_HEADER): $(SRC)/xerial/larray/impl/LArrayNative.java $(TARGET)/classes/xerial/larray/impl/LArrayNative.class
@mkdir -p $(TARGET)/classes
$(JAVAH) -classpath $(TARGET)/classes -o $@ xerial.larray.impl.LArrayNative
$(LARRAY_OUT)/%.o : $(LARRAY_SRC_DIR)/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
$(LARRAY_OUT)/$(LIBNAME): $(LARRAY_OBJ)
$(CC) $(CFLAGS) -o $@ $+ $(LINKFLAGS)
$(STRIP) $@
clean-native:
rm -rf $(LARRAY_OUT)
clean:
rm -rf $(TARGET)
NATIVE_DIR:=larray-mmap/src/main/resources/xerial/larray/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_TARGET_DIR:=$(TARGET)/classes/xerial/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
native: osinfo $(NATIVE_DLL)
larray: native $(TARGET)/larray-$(VERSION).jar
SBT:=./sbt
$(NATIVE_DLL): $(LARRAY_OUT)/$(LIBNAME)
@mkdir -p $(@D)
cp $< $@
@mkdir -p $(NATIVE_TARGET_DIR)
cp $< $(NATIVE_TARGET_DIR)/$(LIBNAME)
$(TARGET)/larray-$(VERSION).jar: native $(NATIVE_DLL)
$(SBT) package
test: $(NATIVE_DLL)
$(SBT) test
win32:
$(MAKE) native CROSS_PREFIX=i686-w64-mingw32- OS_NAME=Windows OS_ARCH=x86
# for cross-compilation on Ubuntu, install the g++-mingw-w64-x86-64 package
win64:
$(MAKE) native CROSS_PREFIX=x86_64-w64-mingw32- OS_NAME=Windows OS_ARCH=amd64
mac32:
$(MAKE) native OS_NAME=Mac OS_ARCH=i386
linux32:
$(MAKE) native OS_NAME=Linux OS_ARCH=i386
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabi package
linux-arm:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabihf package
linux-armhf:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armhf
clean-native-linux32:
$(MAKE) clean-native OS_NAME=Linux OS_ARCH=i386
clean-native-win32:
$(MAKE) clean-native OS_NAME=Windows OS_ARCH=x86