.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
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)"'
compile:
cargo build --release --bins \
--package radvisor \
--target $(BUILD_TARGET) \
--no-default-features \
--features "$(FEATURES)" \
&& cp ./target/$(BUILD_TARGET)/release/radvisor $(OUT_DIR)/radvisor
compile-toolbox:
cargo build --release --bins \
--package radvisor-toolbox \
--target $(BUILD_TARGET) \
&& cp ./target/$(BUILD_TARGET)/release/radvisor-toolbox $(OUT_DIR)/radvisor-toolbox
all: compile compile-toolbox
clean:
cargo clean