-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (31 loc) · 1007 Bytes
/
Makefile
File metadata and controls
38 lines (31 loc) · 1007 Bytes
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
.DEFAULT_GOAL := docker
BUILD_TARGET?=x86_64-unknown-linux-gnu
FEATURES?=docker kubernetes
OUT_DIR?=$(shell pwd)
check: docker-exists
docker-exists: ; @which docker > /dev/null
# Builds the project in a Docker container
docker: check
docker run --rm \
-v $(shell pwd):/opt \
rust:latest \
/bin/bash -c 'cd /opt && make compile OUT_DIR=/opt BUILD_TARGET=$(BUILD_TARGET) "FEATURES=$(FEATURES)"'
# Compiles the project via `cargo build`
compile:
cargo build --release --bins \
--package radvisor \
--target $(BUILD_TARGET) \
--no-default-features \
--features "$(FEATURES)" \
&& cp ./target/$(BUILD_TARGET)/release/radvisor $(OUT_DIR)/radvisor
# Compiles the toolbox via `cargo build`
compile-toolbox:
cargo build --release --bins \
--package radvisor-toolbox \
--target $(BUILD_TARGET) \
&& cp ./target/$(BUILD_TARGET)/release/radvisor-toolbox $(OUT_DIR)/radvisor-toolbox
# Compiles the main binary and the toolbox
all: compile compile-toolbox
# Remove compiled files
clean:
cargo clean