forked from wasmCloud/capability-providers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.common
70 lines (63 loc) · 2.07 KB
/
Makefile.common
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
CONST_FILE := src/lib.rs
define readvar
$(or $(shell sed -nE 's/^.*$(1).*"(.*)";$$/\1/p' $(CONST_FILE)),$(error "Cannot find variable $(1)"))
endef
CAPABILITY_ID := $(call readvar,CAPABILITY_ID)
NAME := $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name')
LIBNAME := $(shell echo $(NAME) | tr '-' '_')
VENDOR := waSCC
TARGETS := armv7-unknown-linux-gnueabihf \
aarch64-unknown-linux-gnu \
x86_64-apple-darwin \
x86_64-pc-windows-gnu \
x86_64-unknown-linux-gnu
# not currently supported
MIPS_TARGETS := mips-unknown-linux-gnu \
mipsel-unknown-linux-gnu \
mips64-unknown-linux-gnuabi64 \
mips64el-unknown-linux-gnuabi64
$(TARGETS):
cross build --target $@ --release
par: $(TARGETS)
wash par create \
--arch arm-linux \
--binary target/armv7-unknown-linux-gnueabihf/release/lib$(LIBNAME).so \
--capid $(CAPABILITY_ID) \
--name $(NAME) \
--vendor $(VENDOR) \
--compress
wash par insert \
--arch aarch64-linux \
--binary target/aarch64-unknown-linux-gnu/release/lib$(LIBNAME).so \
lib$(LIBNAME).par.gz
wash par insert \
--arch x86_64-macos \
--binary target/x86_64-apple-darwin/release/lib$(LIBNAME).dylib \
lib$(LIBNAME).par.gz
wash par insert \
--arch x86_64-windows \
--binary target/x86_64-pc-windows-gnu/release/$(LIBNAME).dll \
lib$(LIBNAME).par.gz
wash par insert \
--arch x86_64-linux \
--binary target/x86_64-unknown-linux-gnu/release/lib$(LIBNAME).so \
lib$(LIBNAME).par.gz
$(MIPS_TARGETS):
cross build --target $@ --release
par-mips: $(MIPS_TARGETS) par
wash par insert \
--arch mips-linux \
--binary target/mips-unknown-linux-gnu/release/lib$(LIBNAME).so \
lib$(LIBNAME).par.gz
wash par insert \
--arch mipsel-linux \
--binary target/mipsel-unknown-linux-gnu/release/lib$(LIBNAME).so \
lib$(LIBNAME).par.gz
wash par insert \
--arch mips64-linux \
--binary target/mips64-unknown-linux-gnuabi64/release/lib$(LIBNAME).so \
lib$(LIBNAME).par.gz
wash par insert \
--arch mips64el-linux \
--binary target/mips64el-unknown-linux-gnuabi64/release/lib$(LIBNAME).so \
lib$(LIBNAME).par.gz