-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (56 loc) · 2.16 KB
/
Makefile
File metadata and controls
70 lines (56 loc) · 2.16 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
66
67
68
69
70
prefix ?= /usr
SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct)
# https://reproducible-builds.org/docs/archives/
TAR_REPRODUCIBLE = tar --mtime="@${SOURCE_DATE_EPOCH}" --sort=name --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime
all: bin manpages
.PHONY: bin
bin:
cargo check --workspace
cargo build --release
# Generate man pages from markdown sources
MAN8_SOURCES := $(wildcard docs/src/man/*.md)
TARGETMAN := target/man
MAN8_TARGETS := $(patsubst docs/src/man/%.md,$(TARGETMAN)/%.8,$(MAN8_SOURCES))
# Single rule for generating man pages
$(TARGETMAN)/%.8: docs/src/man/%.md
@mkdir -p $(TARGETMAN)
@# Create temp file with synced content
@cp $< $<.tmp
@# Generate man page using go-md2man
@go-md2man -in $<.tmp -out $@
@# Fix apostrophe handling
@sed -i -e "1i .ds Aq \\\\(aq" -e "/\\.g \\.ds Aq/d" -e "/.el .ds Aq \'/d" $@
@rm -f $<.tmp
@echo "Generated $@"
# Sync CLI options before generating man pages
.PHONY: manpages
manpages: sync-cli-options $(MAN8_TARGETS)
# Hidden target to sync CLI options once
sync-cli-options:
@cargo xtask sync-manpages >/dev/null 2>&1 || true
# This gates CI by default. Note that for clippy, we gate on
# only the clippy correctness and suspicious lints, plus a select
# set of default rustc warnings.
# We intentionally don't gate on this for local builds in cargo.toml
# because it impedes iteration speed.
CLIPPY_CONFIG = -A clippy::all -D clippy::correctness -D clippy::suspicious -D clippy::disallowed-methods -Dunused_imports -Ddead_code
validate:
cargo fmt -- --check -l
cargo test --no-run --workspace
cargo clippy -- $(CLIPPY_CONFIG)
env RUSTDOCFLAGS='-D warnings' cargo doc --lib
.PHONY: validate
install:
install -D -m 0755 -t $(DESTDIR)$(prefix)/bin target/release/bcvk
if [ -n "$(MAN8_TARGETS)" ]; then \
install -D -m 0644 -t $(DESTDIR)$(prefix)/share/man/man8 $(MAN8_TARGETS); \
fi
makesudoinstall:
make
sudo make install
sync-manpages:
cargo xtask sync-manpages
update-manpages:
cargo xtask update-manpages
update-generated: sync-manpages manpages
.PHONY: all bin install manpages update-generated makesudoinstall sync-manpages update-manpages sync-cli-options