forked from tikv/client-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (35 loc) · 2.73 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
pes_parent_dir:=$(shell pwd)/$(lastword $(MAKEFILE_LIST))
cur_makefile_path := $(shell dirname $(pes_parent_dir))
all: build target/tikv-example
build: pre-build target/debug/libtikv_client.a
release: pre-build target/release/libtikv_client.a
.PHONY: directories
directories:
mkdir -p target
pre-build: directories target/tikv_client_glue.cc include/tikv_client_glue.h
clean:
cargo clean
run-example: target/tikv-example
RUST_LOG=debug $(cur_makefile_path)/target/tikv-example
target/tikv-example: target/debug/libtikv_client.a example/main.cpp
c++ $(cur_makefile_path)/example/main.cpp -o $(cur_makefile_path)/target/tikv-example -std=c++17 -g -I$(cur_makefile_path)/include -L$(cur_makefile_path)/target/debug -ltikv_client -lpthread -ldl -lssl -lcrypto
target/tikv_client_glue.cc: src/lib.rs
cxxbridge $(cur_makefile_path)/src/lib.rs > $(cur_makefile_path)/target/tikv_client_glue.cc
include/tikv_client_glue.h: src/lib.rs
cxxbridge $(cur_makefile_path)/src/lib.rs --header > $(cur_makefile_path)/include/tikv_client_glue.h
target/debug/libtikv_client.a: target/debug/libtikv_client_rust.a target/debug/tikv_client_glue.o target/debug/tikv_client_cpp.o
cp $(cur_makefile_path)/target/debug/libtikv_client_rust.a $(cur_makefile_path)/target/debug/libtikv_client.a && ar cr $(cur_makefile_path)/target/debug/libtikv_client.a $(cur_makefile_path)/target/debug/tikv_client_cpp.o $(cur_makefile_path)/target/debug/tikv_client_glue.o
target/debug/tikv_client_cpp.o: src/tikv_client.cpp
c++ -c $(cur_makefile_path)/src/tikv_client.cpp -o $(cur_makefile_path)/target/debug/tikv_client_cpp.o -std=c++17 -g -I$(cur_makefile_path)/include
target/debug/tikv_client_glue.o: target/tikv_client_glue.cc
c++ -c $(cur_makefile_path)/target/tikv_client_glue.cc -o $(cur_makefile_path)/target/debug/tikv_client_glue.o -std=c++17
target/debug/libtikv_client_rust.a: src/lib.rs
cargo build
target/release/libtikv_client.a: target/release/libtikv_client_rust.a target/release/tikv_client_glue.o target/release/tikv_client_cpp.o
cp $(cur_makefile_path)/target/release/libtikv_client_rust.a $(cur_makefile_path)/target/release/libtikv_client.a && ar cr $(cur_makefile_path)/target/release/libtikv_client.a $(cur_makefile_path)/target/release/tikv_client_cpp.o $(cur_makefile_path)/target/release/tikv_client_glue.o
target/release/tikv_client_cpp.o: src/tikv_client.cpp
c++ -O3 -c $(cur_makefile_path)/src/tikv_client.cpp -o $(cur_makefile_path)/target/release/tikv_client_cpp.o -std=c++17 -g -I$(cur_makefile_path)/include
target/release/tikv_client_glue.o: target/tikv_client_glue.cc
c++ -O3 -c $(cur_makefile_path)/target/tikv_client_glue.cc -o $(cur_makefile_path)/target/release/tikv_client_glue.o -std=c++17
target/release/libtikv_client_rust.a: src/lib.rs
cargo build --release