-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
70 lines (54 loc) · 2.34 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
.PHONY: all build build-rust
SHARED_LIB = ""
ifeq ($(OS),Windows_NT)
SHARED_LIB = seda_tally_vm.dll
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SHARED_LIB = libseda_tally_vm.so
endif
ifeq ($(UNAME_S),Darwin)
SHARED_LIB = libseda_tally_vm.dylib
endif
endif
USER_ID := $(shell id -u)
USER_GROUP = $(shell id -g)
fmt:
cargo +nightly fmt --all
check:
cargo clippy --all-features --locked -- -D warnings
# TODO Update libseda_tally_vm.h?
all: build test
build: build-rust
build-rust: build-rust-release
build-rust-debug:
cargo build
cp target/debug/$(SHARED_LIB) tallyvm/$(SHARED_LIB_DST)
build-rust-release:
cargo build --release
cp target/release/$(SHARED_LIB) tallyvm/$(SHARED_LIB_DST)
###############################################################################
## Building Shared Libraries ##
###############################################################################
docker-image-centos7:
docker build --pull . --platform linux/x86_64 -t seda-wasm-vm-builder-centos7 -f ./Dockerfile.centos7
# For building glibc Linux shared libraries (.so)
release-build-centos7:
rm -rf target/x86_64-unknown-linux-gnu/release
rm -rf target/aarch64-unknown-linux-gnu/release
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code seda-wasm-vm-builder-centos7 build_linux.sh
cp target/x86_64-unknown-linux-gnu/release/libseda_tally_vm.so tallyvm/libseda_tally_vm.x86_64.so
cp target/aarch64-unknown-linux-gnu/release/libseda_tally_vm.so tallyvm/libseda_tally_vm.aarch64.so
###############################################################################
## Building Static Libraries ##
###############################################################################
docker-image-alpine:
docker build . -t seda-wasm-vm-builder-alpine
# For building musl Linux static libraries (.a)
release-build-alpine:
rm -rf target/aarch64-unknown-linux-musl/release
rm -rf target/x86_64-unknown-linux-musl/release
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code seda-wasm-vm-builder-alpine
cp target/aarch64-unknown-linux-musl/release/libseda_tally_vm.a tallyvm/libseda_tally_vm.aarch64.a
cp target/x86_64-unknown-linux-musl/release/libseda_tally_vm.a tallyvm/libseda_tally_vm.x86_64.a
.PHONY: docker-image-alpine release-build-alpine