-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (40 loc) · 1.34 KB
/
Makefile
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
INSTALL_PATH :=$(HOME)/usr/libexec/
CARBON14_NAME :=carbon14
CARBON14_VERSION :=$(shell cargo run -- --version | awk '{ print $$NF }')
CARBON14_DEBUG_EXEC :=target/debug/$(CARBON14_NAME)
CARBON14_RELEASE_EXEC :=target/release/$(CARBON14_NAME)
CARBON14_EXEC :=$(CARBON14_DEBUG_EXEC)
CARBON14_RUN :=$(CARBON14_DEBUG_EXEC)
CARBON14_RUN :=cargo run --bin $(CARBON14_NAME) --
all: test debug release
$(INSTALL_PATH):
mkdir -p $@
$(CARBON14_RELEASE_EXEC): $(INSTALL_PATH)
cargo build --release
$(CARBON14_DEBUG_EXEC): $(INSTALL_PATH)
cargo build
release: check fix | $(CARBON14_RELEASE_EXEC)
install $(CARBON14_RELEASE_EXEC) $(INSTALL_PATH)/$(CARBON14_NAME)-$(CARBON14_VERSION)
install $(CARBON14_RELEASE_EXEC) $(INSTALL_PATH)
debug: check fix | $(CARBON14_DEBUG_EXEC)
install $(CARBON14_DEBUG_EXEC) $(INSTALL_PATH)/$(CARBON14_NAME)-$(CARBON14_VERSION)
install $(CARBON14_DEBUG_EXEC) $(INSTALL_PATH)
clean: cls
@rm -rf target
cleanx:
@rm -rf $(CARBON14_DEBUG_EXEC)
@rm -rf $(CARBON14_RELEASE_EXEC)
cls:
-@reset || tput reset
fix:
cargo fix
fmt:
rustfmt --edition 2021 src/*.rs
check:
cargo check --all-targets
build test: check
cargo $@
run: cleanx $(CARBON14_DEBUG_EXEC)
$(CARBON14_RUN) -o target/debug/checksums.yaml target/debug/*
$(CARBON14_RUN) -o target/checksums.yaml target
.PHONY: all clean cls release debug fix fmt check build test