|
1 | 1 | pes_parent_dir:=$(shell pwd)/$(lastword $(MAKEFILE_LIST))
|
2 | 2 | cur_makefile_path := $(shell dirname $(pes_parent_dir))
|
3 | 3 |
|
4 |
| -all: build-lib build-example |
| 4 | +all: build build-example target/tikv-example |
5 | 5 |
|
6 |
| -build-lib: pre-build target/debug/tikv_client_glue.o target/debug/tikv_client_cpp.o target/debug/libtikv_client.a |
| 6 | +build: pre-build target/debug/libtikv_client.a |
7 | 7 |
|
8 |
| -build-example: target/tikv-test |
| 8 | +release: pre-build target/release/libtikv_client.a |
9 | 9 |
|
10 |
| -pre-build: target/debug/libtikv_client_rust.a target/debug/tikv_client_glue.cc include/tikv_client_glue.h |
| 10 | +pre-build: target/tikv_client_glue.cc include/tikv_client_glue.h |
11 | 11 |
|
12 | 12 | clean:
|
13 | 13 | cargo clean
|
14 | 14 |
|
15 |
| -run-example: target/tikv-test |
16 |
| - RUST_BACKTRACE=1 $(cur_makefile_path)/target/tikv-test |
| 15 | +run-example: target/tikv-example |
| 16 | + $(cur_makefile_path)/target/tikv-example |
| 17 | + |
| 18 | +target/tikv-example: target/debug/libtikv_client.a example/main.cpp |
| 19 | + 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 |
| 20 | + |
| 21 | + |
| 22 | +target/tikv_client_glue.cc: src/lib.rs |
| 23 | + cxxbridge $(cur_makefile_path)/src/lib.rs > $(cur_makefile_path)/target/tikv_client_glue.cc |
| 24 | + |
| 25 | +include/tikv_client_glue.h: src/lib.rs |
| 26 | + cxxbridge $(cur_makefile_path)/src/lib.rs --header > $(cur_makefile_path)/include/tikv_client_glue.h |
17 | 27 |
|
18 |
| -target/tikv-test: target/debug/libtikv_client.a example/main.cpp |
19 |
| - c++ $(cur_makefile_path)/example/main.cpp -o $(cur_makefile_path)/target/tikv-test -std=c++17 -g -I$(cur_makefile_path)/include -L$(cur_makefile_path)/target/debug -ltikv_client -lpthread -ldl -lssl -lcrypto |
20 | 28 |
|
21 | 29 | target/debug/libtikv_client.a: target/debug/libtikv_client_rust.a target/debug/tikv_client_glue.o target/debug/tikv_client_cpp.o
|
22 | 30 | 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
|
23 | 31 |
|
24 | 32 | target/debug/tikv_client_cpp.o: src/tikv_client.cpp
|
25 | 33 | 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
|
26 | 34 |
|
27 |
| -target/debug/tikv_client_glue.o: target/debug/tikv_client_glue.cc |
28 |
| - c++ -c $(cur_makefile_path)/target/debug/tikv_client_glue.cc -o $(cur_makefile_path)/target/debug/tikv_client_glue.o -std=c++17 |
| 35 | +target/debug/tikv_client_glue.o: target/tikv_client_glue.cc |
| 36 | + c++ -c $(cur_makefile_path)/target/tikv_client_glue.cc -o $(cur_makefile_path)/target/debug/tikv_client_glue.o -std=c++17 |
29 | 37 |
|
30 | 38 | target/debug/libtikv_client_rust.a: src/lib.rs
|
31 | 39 | cargo build
|
32 | 40 |
|
33 |
| -target/debug/tikv_client_glue.cc: src/lib.rs |
34 |
| - cxxbridge $(cur_makefile_path)/src/lib.rs > $(cur_makefile_path)/target/debug/tikv_client_glue.cc |
35 | 41 |
|
36 |
| -include/tikv_client_glue.h: src/lib.rs |
37 |
| - cxxbridge $(cur_makefile_path)/src/lib.rs --header > $(cur_makefile_path)/include/tikv_client_glue.h |
| 42 | +target/release/libtikv_client.a: target/release/libtikv_client_rust.a target/release/tikv_client_glue.o target/release/tikv_client_cpp.o |
| 43 | + 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 |
| 44 | + |
| 45 | +target/release/tikv_client_cpp.o: src/tikv_client.cpp |
| 46 | + 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 |
| 47 | + |
| 48 | +target/release/tikv_client_glue.o: target/tikv_client_glue.cc |
| 49 | + c++ -O3 -c $(cur_makefile_path)/target/tikv_client_glue.cc -o $(cur_makefile_path)/target/release/tikv_client_glue.o -std=c++17 |
| 50 | + |
| 51 | +target/release/libtikv_client_rust.a: src/lib.rs |
| 52 | + cargo build --release |
0 commit comments