Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (51 loc) · 1.42 KB
/
Copy pathMakefile
File metadata and controls
65 lines (51 loc) · 1.42 KB
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
64
65
CARGO ?= cargo
BIN_NAME ?= runuz
TARGET ?= release
BUILT_BIN := target/$(TARGET)/$(BIN_NAME)
INSTALL_DIR := $(HOME)/.local/bin
INSTALL_BIN := $(INSTALL_DIR)/$(BIN_NAME)
CARGO_BIN := $(HOME)/.cargo/bin/$(BIN_NAME)
.PHONY: help check clippy build run install uninstall test clean
.DEFAULT_GOAL := check
help:
@echo "runuz. A standalone filesystem tool."
@echo ""
@echo "fast iteration (no link):"
@echo " make check cargo check"
@echo " make clippy lints + check"
@echo ""
@echo "build + install:"
@echo " make build compile a release binary at $(BUILT_BIN)"
@echo " make run build + run with no args"
@echo " make install build + copy to $(INSTALL_BIN)"
@echo " make uninstall remove $(INSTALL_BIN)"
@echo ""
@echo " make test cargo test"
@echo " make clean cargo clean"
check:
$(CARGO) check
clippy:
$(CARGO) clippy -- -D warnings
build:
$(CARGO) build --$(TARGET)
run: build
$(BUILT_BIN)
install: build
@if [ -e "$(CARGO_BIN)" ]; then \
echo "runuz is already installed via cargo at $(CARGO_BIN); bailing."; \
exit 1; \
fi
@mkdir -p "$(INSTALL_DIR)"
@install -m 0755 "$(BUILT_BIN)" "$(INSTALL_BIN)"
@echo "installed -> $(INSTALL_BIN)"
uninstall:
@if [ -e "$(INSTALL_BIN)" ]; then \
rm -f "$(INSTALL_BIN)"; \
echo "removed -> $(INSTALL_BIN)"; \
else \
echo "no $(INSTALL_BIN), already gone"; \
fi
test:
$(CARGO) test
clean:
$(CARGO) clean