forked from rapid7/re2-java
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
47 lines (35 loc) · 1.29 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
#
# Inspired by https://github.com/xerial/snappy-java/blob/develop/Makefile .
#
OBJ=obj
MVN=mvn
NATIVES-TARGET=src/main/resources/NATIVE/$(shell bin/os-arch.sh)/$(shell bin/os-name.sh)
all: build
build: $(OBJ)/libre2-java.so class
.re2.extract.stamp:
# hg clone https://re2.googlecode.com/hg re2
# wget http://re2.googlecode.com/files/re2-20140304.tgz -O re2.tgz
tar xvf re2-20140304.tgz
touch .re2.extract.stamp
.re2.compile.stamp: .re2.extract.stamp
cd re2 && make
touch .re2.compile.stamp
$(OBJ)/RE2.o: .re2.extract.stamp $(addprefix src/main/java/com/logentries/re2/, RE2.cpp RE2.h)
mkdir -p $(OBJ)
$(CXX) -O3 -g -fPIC -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -Ire2 -c src/main/java/com/logentries/re2/RE2.cpp -o $(OBJ)/RE2.o
$(OBJ)/libre2-java.so: $(OBJ)/RE2.o .re2.compile.stamp
$(CXX) -shared -Wl,-soname,libre2-java.so -o $(OBJ)/libre2-java.so $(OBJ)/RE2.o -Lre2/obj/so -lre2 -lpthread
class: build-class
build-class: target/libre2-java-1.0-SNAPSHOT.jar
target/libre2-java-1.0-SNAPSHOT.jar: add-so
$(MVN) package -Dmaven.test.skip=true
add-so: .re2.compile.stamp $(OBJ)/libre2-java.so
mkdir -p $(NATIVES-TARGET)
cp $(OBJ)/libre2-java.so re2/obj/so/libre2.so $(NATIVES-TARGET)
lib: add-so
clean:
rm -fr re2
rm -fr obj
rm -fr target
rm -fr src/main/resources/NATIVE
rm -f .*.stamp