-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (79 loc) · 2.82 KB
/
Copy pathMakefile
File metadata and controls
100 lines (79 loc) · 2.82 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Makefile — portable MIRROR of the justfile (the canonical task source).
#
# The justfile is authoritative; this file exists so deployment hosts that have
# `make` but not `just` get the same tasks. Keep the two in step: `make
# check-build-sync` (CI / pre-commit) fails if recipe and target names drift.
#
# Common entry points:
# make build release binary
# make build-native native-CPU build (non-portable, fastest)
# make install PREFIX=/opt/dada2 binary + helper scripts onto PATH
# make check fmt-check + clippy + tests
#
# Helper R/Python scripts are installed namespaced as `dada2-rs-<name>` (e.g.
# scripts/plot_errors.R -> dada2-rs-plot-errors) to avoid PATH collisions.
PREFIX ?= /usr/local
DESTDIR ?=
BINDIR = $(DESTDIR)$(PREFIX)/bin
BIN = dada2-rs
SCRIPTS = $(wildcard scripts/*.R) $(wildcard scripts/*.py)
.PHONY: all build build-native build-arm64 install uninstall \
check fmt fmt-check clippy test clean docs-serve docs-build \
publish-crate check-build-sync help
PUBLISH_ARGS ?=
all: build
## build: release binary -> target/release/$(BIN)
build:
cargo build --release
## build-native: native-CPU build (cluster/in-house; non-portable binary)
build-native:
RUSTFLAGS="-C target-cpu=native" cargo build --profile release-native
## build-arm64: cross-compile Linux ARM64 (requires `cross`)
build-arm64:
cross build --release --target aarch64-unknown-linux-gnu
## install: copy binary + helper scripts onto PATH (scripts made executable)
install: build
install -d "$(BINDIR)"
install -m 755 target/release/$(BIN) "$(BINDIR)/$(BIN)"
@for s in $(SCRIPTS); do \
name=$$(basename "$$s" | sed -E 's/\.(R|py)$$//; s/_/-/g'); \
dest="$(BINDIR)/$(BIN)-$$name"; \
echo "install -m 755 $$s $$dest"; \
install -m 755 "$$s" "$$dest"; \
done
## uninstall: remove installed binary + helper scripts
uninstall:
rm -f "$(BINDIR)/$(BIN)"
@for s in $(SCRIPTS); do \
name=$$(basename "$$s" | sed -E 's/\.(R|py)$$//; s/_/-/g'); \
dest="$(BINDIR)/$(BIN)-$$name"; \
echo "rm -f $$dest"; \
rm -f "$$dest"; \
done
## check: fmt-check + clippy (warnings as errors) + tests
check: fmt-check clippy test
fmt:
cargo fmt
fmt-check:
cargo fmt --check
clippy:
cargo clippy --all-targets -- -D warnings
test:
cargo test
## docs-serve: live-reload mkdocs site
docs-serve:
mkdocs serve
## docs-build: build static mkdocs site
docs-build:
mkdocs build
clean:
cargo clean
## publish-crate: publish NW-only crate to crates.io (strips WFA git dep; PUBLISH_ARGS=--dry-run to test)
publish-crate:
./scripts/publish-crate.sh $(PUBLISH_ARGS)
## check-build-sync: fail if justfile recipes and Makefile targets have drifted
check-build-sync:
./scripts/check-build-sync.sh
## help: list documented targets
help:
@grep -E '^## ' $(MAKEFILE_LIST) | sed -E 's/^## / /'