-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
120 lines (83 loc) · 3.62 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
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
include Makefile.common
MVN:=mvn
SBT:=./sbt
all: chimera
CHIMERA_OUT:=$(TARGET)/$(chimera)-$(os_arch)
CHIMERA_OBJ:=$(addprefix $(CHIMERA_OUT)/,OpensslSecureRandom.o OpensslNative.o)
ifeq ($(OS_NAME),SunOS)
TAR:= gtar
else
TAR:= tar
endif
$(TARGET)/jni-classes/com/intel/chimera/crypto/OpensslNative.class : $(SRC)/com/intel/chimera/crypto/OpensslNative.java
@mkdir -p $(TARGET)/jni-classes
$(JAVAC) -source 1.6 -target 1.6 -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
$(TARGET)/jni-classes/com/intel/chimera/random/OpensslSecureRandomNative.class : $(SRC)/com/intel/chimera/random/OpensslSecureRandomNative.java
@mkdir -p $(TARGET)/jni-classes
$(JAVAC) -source 1.6 -target 1.6 -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
$(TARGET)/jni-classes/com/intel/chimera/crypto/OpensslNative.h: $(TARGET)/jni-classes/com/intel/chimera/crypto/OpensslNative.class
$(JAVAH) -force -classpath $(TARGET)/jni-classes -o $@ com.intel.chimera.crypto.OpensslNative
$(TARGET)/jni-classes/com/intel/chimera/random/OpensslSecureRandomNative.h: $(TARGET)/jni-classes/com/intel/chimera/random/OpensslSecureRandomNative.class
$(JAVAH) -force -classpath $(TARGET)/jni-classes -o $@ com.intel.chimera.random.OpensslSecureRandomNative
$(CHIMERA_OUT)/OpensslNative.o : $(SRC_NATIVE)/com/intel/chimera/crypto/OpensslNative.c $(TARGET)/jni-classes/com/intel/chimera/crypto/OpensslNative.h
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
$(CHIMERA_OUT)/OpensslSecureRandom.o : $(SRC_NATIVE)/com/intel/chimera/random/OpensslSecureRandomNative.c $(TARGET)/jni-classes/com/intel/chimera/random/OpensslSecureRandomNative.h
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
$(CHIMERA_OUT)/$(LIBNAME): $(CHIMERA_OBJ)
$(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS)
$(STRIP) $@
clean:
rm -rf $(TARGET)
rm -rf $(CHIMERA_OUT)
NATIVE_DIR:=src/main/resources/com/intel/chimera/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_TARGET_DIR:=$(TARGET)/classes/com/intel/chimera/native/$(OS_NAME)/$(OS_ARCH)
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
chimera-jar-version:=chimera-$(shell perl -npe "s/version in ThisBuild\s+:=\s+\"(.*)\"/\1/" version.sbt | sed -e "/^$$/d")
native: $(NATIVE_DLL)
chimera: native $(TARGET)/$(chimera-jar-version).jar
$(NATIVE_DLL): $(CHIMERA_OUT)/$(LIBNAME)
@mkdir -p $(@D)
cp $< $@
@mkdir -p $(NATIVE_TARGET_DIR)
cp $< $(NATIVE_TARGET_DIR)/$(LIBNAME)
package: $(TARGET)/$(chimera-jar-version).jar
$(TARGET)/$(chimera-jar-version).jar:
$(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=x86_64
mac32:
$(MAKE) native OS_NAME=Mac OS_ARCH=x86
linux32:
$(MAKE) native OS_NAME=Linux OS_ARCH=x86
freebsd64:
$(MAKE) native OS_NAME=FreeBSD OS_ARCH=x86_64
# 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
# for cross-compilation on Ubuntu, install the g++-aarch64-linux-gnu
linux-aarch64:
$(MAKE) native CROSS_PREFIX=aarch64-linux-gnu- OS_NAME=Linux OS_ARCH=aarch64
clean-native-linux32:
$(MAKE) clean-native OS_NAME=Linux OS_ARCH=x86
clean-native-win32:
$(MAKE) clean-native OS_NAME=Windows OS_ARCH=x86
javadoc:
$(SBT) packageDoc
packageSource:
$(SBT) packageSrc
publishSigned:
$(SBT) publishSigned
sonatypeRelease:
$(SBT) sonatypeRelease
install-m2:
$(SBT) publishM2