-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (34 loc) · 1.05 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
.POSIX:
.SUFFIXES:
PREFIX = /usr/local
BINDIR = bin
TARGET = target/release
MANDIR = share/man
CARGO = cargo
RUSTFMT = rustfmt
GIT = git
RM = rm
INSTALL = install
SCDOC = scdoc
all: build doc
pre-commit: fmt build clean # Runs all pre-commit checks.
commit: pre-commit # Commits the changes to the repository.
$(GIT) commit -s
push: commit # Pushes the changes to the repository.
$(GIT) push origin trunk
build: # Builds an application binary.
$(CARGO) fetch --locked
$(CARGO) build --frozen --release --all-features
doc: # Builds the manpage.
$(SCDOC) <doc/bonk.1.scd >bonk.1
install: # Installs the release binary.
$(INSTALL) -d \
$(DESTDIR)$(PREFIX)/$(BINDIR)/ \
$(DESTDIR)$(PREFIX)/$(MANDIR)/man1/
$(INSTALL) -pm 0755 $(TARGET)/bonk $(DESTDIR)$(PREFIX)/$(BINDIR)/
$(INSTALL) -pm 0644 bonk.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1/
fmt: # Checks Rust source files in the repository for formatting issues.
$(RUSTFMT) --check src/*.rs
clean: # Cleans any build output.
$(RM) -rf target bonk.1
.PHONY: all pre-commit commit push build doc install fmt clean