-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (36 loc) · 1.04 KB
/
Copy pathMakefile
File metadata and controls
50 lines (36 loc) · 1.04 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
prefix=/usr/local
exec_prefix=$(prefix)
bindir=$(exec_prefix)/bin
datarootdir=$(prefix)/share
mandir=$(datarootdir)/man
man1dir=$(mandir)/man1
exec=inf
man1_pages=$(exec).1
target_dir=$(shell cargo metadata --format-version=1 --no-deps | sed -n 's/.*"target_directory":"\([^"]*\)".*/\1/p')
release_bin=$(target_dir)/release/$(exec)
all: build
build:
cargo build
release:
cargo build --release
install: install-bin install-man
install-bin: release
@mkdir -p $(DESTDIR)$(bindir)/
install -m755 $(release_bin) $(DESTDIR)$(bindir)/$(exec)
install-man: $(man1_pages)
@mkdir -p $(DESTDIR)$(man1dir)/
install -m644 $^ $(DESTDIR)$(man1dir)/
uninstall: uninstall-bin uninstall-man
uninstall-bin:
rm -f $(DESTDIR)$(bindir)/$(exec)
uninstall-man:
rm -f $(patsubst %,$(DESTDIR)$(man1dir)/%,$(man1_pages))
check: lint test
@printf '\033[0;32m>>>>>>>>>>>>>>>>\033[0m\n'
@printf '\033[0;32mChecks succeded!\033[0m\n'
@printf '\033[0;32m>>>>>>>>>>>>>>>>\033[0m\n'
lint:
cargo fmt --check
cargo clippy --all-targets -- -D warnings
test: build
cargo test