RUST_TARGETARCH ?= x86_64
TARGET_DIR := ./target
OUTPUT := $(TARGET_DIR)/$(RUST_TARGETARCH)-unknown-linux-musl/release/object-storage-maintenance
all: build
build:
rustup target add $(RUST_TARGETARCH)-unknown-linux-musl
RUSTFLAGS='-C relocation-model=static -C strip=symbols' cargo build --release --target $(RUST_TARGETARCH)-unknown-linux-musl --target-dir $(TARGET_DIR)
compress: build
strip $(OUTPUT)
upx --brute $(OUTPUT)
release: build compress
cp $(OUTPUT) $(TARGET_DIR)/
run: build
$(OUTPUT)
clean:
cargo clean
help:
@echo "Makefile commands:"
@echo " make Build the static binary"
@echo " make build Build the static binary"
@echo " make compress Compress the binary with UPX"
@echo " make release Build and compress the binary"
@echo " make clean Remove build artifacts"