forked from ican2002/dpdk-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (48 loc) · 1.78 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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
#=======================================================================================================================
# Default Paths
#=======================================================================================================================
export PREFIX ?= $(HOME)
export PKG_CONFIG_PATH ?= $(shell find $(PREFIX)/lib/ -name '*pkgconfig*' -type d | xargs | sed -e 's/\s/:/g')
#=======================================================================================================================
# Toolchain Configuration
#=======================================================================================================================
export CARGO ?= $(HOME)/.cargo/bin/cargo
# Switches:
# - TEST Test to run.
# - BENCH Microbenchmark to run.
# - FLAGS Flags passed to cargo.
# Set driver version.
export DRIVER ?= $(shell [ ! -z "`lspci | grep -E "ConnectX-[4,5]"`" ] && echo mlx5 || echo mlx4)
export FLAGS += --features=$(DRIVER)
# Set build mode.
ifneq ($(DEBUG),yes)
export BUILD = release
else
export BUILD = dev
endif
export FLAGS += --profile $(BUILD)
#=======================================================================================================================
# Builds source code.
all:
$(CARGO) build --all $(FLAGS)
# Runs regression tests.
test:
$(CARGO) test $(FLAGS) $(TEST) -- --nocapture
# Runs microbenchmarks.
bench:
$(CARGO) bench $(FLAGS) $(BENCH) -- --nocapture
# Check code style formatting.
check-fmt: check-fmt-rust
# Check code style formatting for Rust.
check-fmt-rust:
$(CARGO) fmt --all -- --check
# Builds documentation.
doc:
$(CARGO) doc $(FLAGS) --no-deps
# Cleans up all build artifacts.
clean:
rm -rf target && \
$(CARGO) clean && \
rm -f Cargo.lock