This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
forked from extism/extism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (50 loc) · 1.77 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
DEST?=/usr/local
SOEXT=so
AEXT=a
FEATURES?=default
DEFAULT_FEATURES?=yes
RUST_TARGET?=
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
SOEXT=dylib
endif
ifeq ($(DEFAULT_FEATURES),no)
ifeq ($(FEATURES),default)
FEATURE_FLAGS=--no-default-features
else
FEATURE_FLAGS=--features $(FEATURES) --no-default-features
endif
else
FEATURE_FLAGS=--features $(FEATURES)
endif
ifeq ($(RUST_TARGET),)
TARGET_FLAGS=
else
TARGET_FLAGS=--target $(RUST_TARGET)
endif
build:
cargo build --release $(FEATURE_FLAGS) --manifest-path libextism/Cargo.toml $(TARGET_FLAGS)
sed -e "s%@CMAKE_INSTALL_PREFIX@%$(DEST)%" libextism/extism.pc.in > libextism/extism.pc
sed -e "s%@CMAKE_INSTALL_PREFIX@%$(DEST)%" libextism/extism-static.pc.in > libextism/extism-static.pc
bench:
@(cargo criterion $(TARGET_FLAGS) || echo 'For nicer output use cargo-criterion: `cargo install cargo-criterion` - using `cargo bench`') && cargo bench $(TARGET_FLAGS)
.PHONY: kernel
kernel:
cd kernel && bash build.sh
lint:
cargo clippy --release --no-deps --manifest-path runtime/Cargo.toml $(TARGET_FLAGS)
debug:
RUSTFLAGS=-g RUST_TARGET=$(RUST_TARGET) $(MAKE) build
install:
echo $(RUST_TARGET)
mkdir -p $(DEST)/lib $(DEST)/include $(DEST)/lib/pkgconfig
install runtime/extism.h $(DEST)/include/extism.h
if [ -f target/$(RUST_TARGET)/release/libextism.$(SOEXT) ]; then \
install target/$(RUST_TARGET)/release/libextism.$(SOEXT) $(DEST)/lib/libextism.$(SOEXT); \
fi
install target/$(RUST_TARGET)/release/libextism.$(AEXT) $(DEST)/lib/libextism.$(AEXT)
install libextism/extism.pc $(DEST)/lib/pkgconfig/extism.pc
install libextism/extism-static.pc $(DEST)/lib/pkgconfig/extism-static.pc
uninstall:
rm -f $(DEST)/include/extism.h $(DEST)/lib/libextism.$(SOEXT) $(DEST)/lib/libextism.$(AEXT) \
$(DEST)/lib/pkgconfig/extism*.pc