PACKAGE= rc
VERSION= 0.0.1
PROFILE?= debug
PREFIX = /usr/local
BIN_DIR = $(PREFIX)/bin
CARGO?= cargo
INSTALL?= install
CARGOFLAGS?= -j$(shell nproc)
RUSTFLAGS?=
SRC= Cargo.toml $(wildcard *.rs src/*.rs)
ifeq ($(PROFILE), debug)
BIN= ./target/debug/$(PACKAGE)
else
BIN= ./target/release/$(PACKAGE)
CARGOFLAGS+= --release
RUSTFLAGS+= -Ctarget-feature=+crt-static
endif
all: $(BIN)
fmt:
$(CARGO) +nightly fmt
lint:
$(CARGO) deny check
$(CARGO) +nightly acl -n || true
$(CARGO) +nightly clippy $(CARGOFLAGS)
install: $(BIN)
$(INSTALL) -d $(BIN_DIR)
$(INSTALL) -m 755 $(BIN) $(BIN_DIR)
uninstall:
rm -f $(BIN_DIR)/$(PACKAGE)
check: test
test: $(BIN)
$(CARGO) test $(CARGOFLAGS)
clean:
$(CARGO) clean
$(BIN): $(SRC)
env RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build $(CARGOFLAGS)
.PHONY: all clean check test install uninstall fmt lint