-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (39 loc) · 1.57 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
.PHONY: clean
TARGET :=
TARGET_DIR := ./target
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
ifeq ($(PLATFORM),arm)
TARGET = --target aarch64-unknown-linux-gnu
TARGET_DIR = ./target/aarch64-unknown-linux-gnu
endif
endif
ifeq ($(UNAME_S),Darwin)
ifeq ($(PLATFORM),arm)
TARGET = --target aarch64-apple-darwin --target-dir ./target
TARGET_DIR = ./target/aarch64-apple-darwin
endif
endif
capi:
cargo build ${TARGET} -p klever-chain-vm-executor-c-api --release
capi-linux-amd64: capi
mv ${TARGET_DIR}/release/libklever_chain_vm_executor_c_api.so target/release/libvmexeccapi.so
patchelf --set-soname libvmexeccapi.so target/release/libvmexeccapi.so
capi-linux-arm: capi
mv ${TARGET_DIR}/release/libklever_chain_vm_executor_c_api.so target/release/libvmexeccapi_arm.so
patchelf --set-soname libvmexeccapi_arm.so target/release/libvmexeccapi_arm.so
capi-osx-amd64: capi
mv ${TARGET_DIR}/release/libklever_chain_vm_executor_c_api.dylib target/release/libvmexeccapi.dylib
install_name_tool -id @rpath/libvmexeccapi.dylib target/release/libvmexeccapi.dylib
capi-osx-arm: capi
mv ${TARGET_DIR}/release/libklever_chain_vm_executor_c_api.dylib target/release/libvmexeccapi_arm.dylib
install_name_tool -id @rpath/libvmexeccapi_arm.dylib target/release/libvmexeccapi_arm.dylib
clean:
cargo clean
rm target/release/libvmexeccapi.so
rm target/release/libvmexeccapi_arm.so
rm target/release/libvmexeccapi.dylib
rm target/release/libvmexeccapi_arm.dylib
rm c-api/libvmexeccapi.h
docker-build-arm:
docker buildx build --platform linux/arm64/v8 -t libvm_arm -f Docker/arm64.dockerfile .