-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (51 loc) · 1.45 KB
/
Copy pathMakefile
File metadata and controls
65 lines (51 loc) · 1.45 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
# condrun — Makefile wrapper around cargo
#
# Default install prefix is $HOME/.local (user-writable, no sudo, on most PATHs).
# Override with PREFIX=/usr/local for system-wide install (needs sudo).
#
# make install # → ~/.local/bin/condrun
# make install PREFIX=/usr/local # → /usr/local/bin/condrun (sudo)
# make uninstall
PREFIX ?= $(HOME)/.local
BINDIR := $(PREFIX)/bin
CARGO ?= cargo
BIN := condrun
TARGET := target/release/$(BIN)
.PHONY: all build release debug install uninstall test check fmt clippy clean help
all: build
build release:
$(CARGO) build --release
debug:
$(CARGO) build
$(TARGET): build
install: $(TARGET)
@mkdir -p "$(BINDIR)"
install -m 0755 "$(TARGET)" "$(BINDIR)/$(BIN)"
@echo "installed: $(BINDIR)/$(BIN)"
uninstall:
@rm -f "$(BINDIR)/$(BIN)"
@echo "removed: $(BINDIR)/$(BIN)"
test:
$(CARGO) test
check:
$(CARGO) check
fmt:
$(CARGO) fmt
clippy:
$(CARGO) clippy -- -D warnings
clean:
$(CARGO) clean
help:
@echo "Targets:"
@echo " build — cargo build --release (default)"
@echo " install — copy release binary to \$$(PREFIX)/bin (default: ~/.local/bin)"
@echo " uninstall — remove installed binary"
@echo " test — cargo test"
@echo " check — cargo check"
@echo " fmt — cargo fmt"
@echo " clippy — cargo clippy with -D warnings"
@echo " clean — cargo clean"
@echo ""
@echo "Variables:"
@echo " PREFIX=$(PREFIX)"
@echo " BINDIR=$(BINDIR)"