2026-04-16 22:38:20 +02:00
|
|
|
VENV := .venv
|
|
|
|
|
PYTHON := $(VENV)/bin/python
|
|
|
|
|
PIP := $(VENV)/bin/pip
|
|
|
|
|
MKDOCS := $(VENV)/bin/mkdocs
|
|
|
|
|
|
|
|
|
|
CARGO_DIR := src
|
|
|
|
|
|
2026-08-15 20:56:29 +02:00
|
|
|
DOC_DIR := DevDocMD
|
2026-04-16 22:38:20 +02:00
|
|
|
DOC_FILE := mkdocs.yml
|
2026-08-15 20:56:29 +02:00
|
|
|
DOC_SITE := DevDoc
|
2026-04-16 22:38:20 +02:00
|
|
|
DOC_PORT := 8001
|
|
|
|
|
|
2026-08-13 10:01:29 +02:00
|
|
|
DOC_USER_DIR := UserDocMD
|
|
|
|
|
DOC_USER_FILE := mkdocs-user.yml
|
2026-08-15 20:56:29 +02:00
|
|
|
DOC_USER_SITE := doc
|
2026-08-13 10:01:29 +02:00
|
|
|
DOC_USER_PORT := 8002
|
|
|
|
|
|
2026-04-16 22:38:20 +02:00
|
|
|
# ── virtualenv ────────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
$(VENV)/bin/activate:
|
|
|
|
|
python3 -m venv $(VENV)
|
|
|
|
|
|
|
|
|
|
$(MKDOCS): $(VENV)/bin/activate
|
|
|
|
|
$(PIP) install --quiet --upgrade pip
|
|
|
|
|
$(PIP) install --quiet \
|
|
|
|
|
livereload watchdog \
|
|
|
|
|
mkdocs mkdocs-material \
|
|
|
|
|
mkdocs-mermaid2-plugin \
|
|
|
|
|
mkdocs-bibtex
|
2026-06-19 09:55:41 +02:00
|
|
|
$(PIP) install --quiet --upgrade InSilicoSeq
|
2026-04-16 22:38:20 +02:00
|
|
|
|
2026-12-01 11:13:02 +01:00
|
|
|
# ── standard targets (names and behaviour follow crate-kit's crate.mk) ───────────
|
|
|
|
|
# obiskim is an application workspace: cargo runs on $(CARGO_DIR)/Cargo.toml, default features.
|
|
|
|
|
|
|
|
|
|
CARGO ?= cargo
|
|
|
|
|
CARGO_MANIFEST := $(CARGO_DIR)/Cargo.toml
|
|
|
|
|
GREEN ?= \033[0;32m
|
|
|
|
|
YELLOW ?= \033[1;33m
|
|
|
|
|
BLUE ?= \033[1;34m
|
|
|
|
|
NC ?= \033[0m
|
|
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := build
|
|
|
|
|
|
|
|
|
|
.PHONY: help build release test check fmt fmt-check clippy ci
|
|
|
|
|
## help: Lists the documented targets (this Makefile and the kit's)
|
|
|
|
|
help:
|
|
|
|
|
@echo "$(GREEN)Available commands:$(NC)"
|
|
|
|
|
@sed -n "s/^## *\([^:]*\): */\1$$(printf '\t')/p" $(MAKEFILE_LIST) | column -t -s "$$(printf '\t')" | sed -e 's/^/ /'
|
|
|
|
|
|
|
|
|
|
## build: Release build of the obikmer binary (alias of release)
|
|
|
|
|
build: release
|
|
|
|
|
|
|
|
|
|
## release: Release build of the obikmer binary
|
|
|
|
|
release: obikmer
|
|
|
|
|
|
|
|
|
|
## test: Workspace tests
|
|
|
|
|
test:
|
|
|
|
|
$(CARGO) test --workspace --manifest-path $(CARGO_MANIFEST)
|
|
|
|
|
|
|
|
|
|
## check: Code check (all targets of the workspace)
|
|
|
|
|
check:
|
|
|
|
|
$(CARGO) check --workspace --all-targets --manifest-path $(CARGO_MANIFEST)
|
|
|
|
|
|
|
|
|
|
## fmt: Code formatting
|
|
|
|
|
fmt:
|
|
|
|
|
$(CARGO) fmt --all --manifest-path $(CARGO_MANIFEST)
|
|
|
|
|
|
|
|
|
|
## fmt-check: Formatting check
|
|
|
|
|
fmt-check:
|
|
|
|
|
$(CARGO) fmt --all --manifest-path $(CARGO_MANIFEST) -- --check
|
|
|
|
|
|
|
|
|
|
## clippy: Static analysis (warnings = errors)
|
|
|
|
|
clippy:
|
|
|
|
|
$(CARGO) clippy --workspace --all-targets --manifest-path $(CARGO_MANIFEST) -- -D warnings
|
|
|
|
|
|
|
|
|
|
## ci: Verification pipeline (deps-check fmt-check clippy test)
|
|
|
|
|
ci: deps-check fmt-check clippy test
|
|
|
|
|
@echo "$(GREEN)✓ All CI checks passed$(NC)"
|
|
|
|
|
|
2026-04-16 22:38:20 +02:00
|
|
|
# ── obikmer binary ───────────────────────────────────────────────────────────
|
|
|
|
|
|
2026-04-27 20:17:06 +02:00
|
|
|
PROFILE_FILE := profile.pb
|
|
|
|
|
PPROF_PORT := 8081
|
|
|
|
|
|
2026-04-16 22:38:20 +02:00
|
|
|
.PHONY: obikmer
|
2026-12-01 11:13:02 +01:00
|
|
|
## obikmer: Release build of the obikmer binary
|
2026-04-16 22:38:20 +02:00
|
|
|
obikmer:
|
|
|
|
|
cargo build --release --manifest-path $(CARGO_DIR)/Cargo.toml --bin obikmer
|
2026-04-27 20:17:06 +02:00
|
|
|
|
|
|
|
|
.PHONY: debug
|
2026-12-01 11:13:02 +01:00
|
|
|
## debug: Debug build of the obikmer binary
|
2026-04-16 22:38:20 +02:00
|
|
|
debug:
|
|
|
|
|
cargo build --manifest-path $(CARGO_DIR)/Cargo.toml --bin obikmer
|
2026-04-27 20:17:06 +02:00
|
|
|
|
|
|
|
|
.PHONY: profile-build
|
|
|
|
|
profile-build:
|
|
|
|
|
cargo build --release --manifest-path $(CARGO_DIR)/Cargo.toml \
|
|
|
|
|
--bin obikmer --features obikmer/profiling
|
|
|
|
|
|
|
|
|
|
.PHONY: profile-view
|
|
|
|
|
profile-view:
|
|
|
|
|
go tool pprof -http=127.0.0.1:$(PPROF_PORT) $(PROFILE_FILE)
|
2026-04-16 22:38:20 +02:00
|
|
|
# ── documentation ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
.PHONY: doc
|
2026-12-01 11:13:02 +01:00
|
|
|
## doc: Builds the developer documentation (DevDoc/)
|
2026-04-16 22:38:20 +02:00
|
|
|
doc: $(MKDOCS)
|
|
|
|
|
$(MKDOCS) build -f $(DOC_FILE)
|
|
|
|
|
|
|
|
|
|
.PHONY: doc-serve
|
|
|
|
|
doc-serve: $(MKDOCS)
|
|
|
|
|
$(MKDOCS) serve -f $(DOC_FILE) \
|
|
|
|
|
--dev-addr=127.0.0.1:$(DOC_PORT) \
|
|
|
|
|
--livereload
|
|
|
|
|
.PHONY: clean-doc
|
|
|
|
|
clean-doc:
|
|
|
|
|
rm -rf $(DOC_SITE)/
|
|
|
|
|
|
2026-08-13 10:01:29 +02:00
|
|
|
.PHONY: doc-user
|
2026-12-01 11:13:02 +01:00
|
|
|
## doc-user: Builds the user documentation (doc/)
|
2026-08-13 10:01:29 +02:00
|
|
|
doc-user: $(MKDOCS)
|
|
|
|
|
$(MKDOCS) build -f $(DOC_USER_FILE)
|
|
|
|
|
|
|
|
|
|
.PHONY: doc-user-serve
|
|
|
|
|
doc-user-serve: $(MKDOCS)
|
|
|
|
|
$(MKDOCS) serve -f $(DOC_USER_FILE) \
|
|
|
|
|
--dev-addr=127.0.0.1:$(DOC_USER_PORT) \
|
|
|
|
|
--livereload
|
|
|
|
|
|
|
|
|
|
.PHONY: clean-doc-user
|
|
|
|
|
clean-doc-user:
|
|
|
|
|
rm -rf $(DOC_USER_SITE)/
|
|
|
|
|
|
2026-11-19 17:37:19 +01:00
|
|
|
# Regenerates the Gitea/Forgejo wiki (a separate repository, checked out next
|
|
|
|
|
# to this one) from the user documentation. Only rewrites its working tree:
|
|
|
|
|
# committing and pushing it stays a manual step. Not part of `clean`.
|
2026-12-01 11:13:02 +01:00
|
|
|
DOC_WIKI_DIR := ../obiskim.wiki
|
2026-11-19 17:37:19 +01:00
|
|
|
|
|
|
|
|
.PHONY: wiki
|
2026-12-01 11:13:02 +01:00
|
|
|
## wiki: Regenerates the wiki working tree (../obiskim.wiki); commit and push stay manual
|
2026-11-19 17:37:19 +01:00
|
|
|
wiki:
|
|
|
|
|
@command -v pmotransdoc >/dev/null || { echo "pmotransdoc not found in PATH" >&2; exit 1; }
|
|
|
|
|
@test -d $(DOC_WIKI_DIR)/.git || { echo "$(DOC_WIKI_DIR) is not a git checkout of the wiki" >&2; exit 1; }
|
|
|
|
|
pmotransdoc $(DOC_USER_DIR) $(DOC_WIKI_DIR)
|
|
|
|
|
|
2026-04-16 22:38:20 +02:00
|
|
|
.PHONY: clean
|
2026-08-13 10:01:29 +02:00
|
|
|
clean: clean-doc clean-doc-user
|
2026-04-16 22:38:20 +02:00
|
|
|
rm -rf $(VENV)
|
2026-06-22 10:33:16 +02:00
|
|
|
|
2026-12-01 11:13:02 +01:00
|
|
|
# ── release (jj only; the kit's norms for a repository that is not a crate) ───────
|
|
|
|
|
# Version: patch bump of the obikmer crate (RELEASE=x.y.z forces it). Tag: v<version> (what release.yml
|
|
|
|
|
# triggers on), created and pushed with jj, lightweight: the CI release body is the tagged commit's
|
|
|
|
|
# message. Release notes: ReleaseNotes/version-<version>.md (jj release-notes), committed with the release.
|
|
|
|
|
# No git command is run. The user runs `make jjrelease`; it never runs by itself.
|
2026-06-22 10:33:16 +02:00
|
|
|
|
|
|
|
|
CARGO_TOML := $(CARGO_DIR)/obikmer/Cargo.toml
|
2026-12-01 11:13:02 +01:00
|
|
|
RELEASE_NOTES_DIR := ReleaseNotes
|
|
|
|
|
API_DIR := api
|
|
|
|
|
RELEASE_PROJECT_DESC := obiskim (Rust k-mer genomics tool)
|
|
|
|
|
TAG_PREFIX := v
|
|
|
|
|
# Backlog of outdated external dependencies: not enforced until TASK-24 of the obi backlog is done.
|
|
|
|
|
# The private-registry check (neighbours, lock, duplicates) stays active.
|
|
|
|
|
export DEPS_CHECK_EXTERNAL ?= 0
|
|
|
|
|
export RELEASE_NOTES_DIR API_DIR RELEASE_PROJECT_DESC TAG_PREFIX
|
2026-06-22 10:33:16 +02:00
|
|
|
|
2026-12-01 11:13:02 +01:00
|
|
|
.PHONY: bump-version jjpush jjrelease bookmark-check print-%
|
|
|
|
|
|
|
|
|
|
## bump-version: Next patch version of the obikmer crate, or fixed RELEASE=x.y.z (refused if the tag exists)
|
2026-06-22 10:33:16 +02:00
|
|
|
bump-version:
|
2026-12-01 11:13:02 +01:00
|
|
|
@jj git fetch
|
2026-06-22 10:33:16 +02:00
|
|
|
@current=$$(grep '^version = ' $(CARGO_TOML) | head -n 1 | sed 's/version = "\(.*\)"/\1/'); \
|
|
|
|
|
if [ -n "$(RELEASE)" ]; then \
|
|
|
|
|
new_version="$(RELEASE)"; \
|
|
|
|
|
else \
|
|
|
|
|
major=$$(echo $$current | cut -d. -f1); \
|
|
|
|
|
minor=$$(echo $$current | cut -d. -f2); \
|
|
|
|
|
patch=$$(echo $$current | cut -d. -f3); \
|
2026-12-01 11:13:02 +01:00
|
|
|
new_version="$$major.$$minor.$$((patch + 1))"; \
|
|
|
|
|
fi; \
|
|
|
|
|
if [ -n "$$(jj tag list "$(TAG_PREFIX)$$new_version" 2>/dev/null)" ]; then \
|
|
|
|
|
echo "✗ tag $(TAG_PREFIX)$$new_version already exists (use RELEASE=x.y.z)" >&2; exit 1; \
|
2026-06-22 10:33:16 +02:00
|
|
|
fi; \
|
|
|
|
|
echo "Version: $$current -> $$new_version"; \
|
|
|
|
|
sed -i.bak "s/^version = \"$$current\"/version = \"$$new_version\"/" $(CARGO_TOML) && \
|
|
|
|
|
rm $(CARGO_TOML).bak
|
|
|
|
|
|
2026-12-01 11:13:02 +01:00
|
|
|
## bookmark-check: Does main track main@origin? Otherwise the push of main would fail (read-only)
|
|
|
|
|
bookmark-check:
|
|
|
|
|
@.crate-kit/scripts/bookmark-check.sh
|
|
|
|
|
|
|
|
|
|
## jjpush: Documents the commit, advances main to it and pushes main (no PR branch), then starts a new commit
|
|
|
|
|
jjpush: bookmark-check deps-check
|
|
|
|
|
@echo "$(YELLOW)→ Pushing the commit to main...$(NC)"
|
2026-08-13 16:33:22 +02:00
|
|
|
@jj auto-doc
|
2026-12-01 11:13:02 +01:00
|
|
|
@.crate-kit/scripts/push-main.sh
|
|
|
|
|
@.crate-kit/scripts/new-commit.sh
|
|
|
|
|
@echo "$(GREEN)✓ main pushed; new working commit created on top of it$(NC)"
|
|
|
|
|
|
|
|
|
|
## jjrelease: Release (ci, version bump, notes, push of main, tag v<version> pushed; release.yml then builds)
|
|
|
|
|
jjrelease: bookmark-check ci bump-version
|
|
|
|
|
@echo "$(BLUE)→ Documenting the undocumented commits...$(NC)"
|
|
|
|
|
@jj auto-doc
|
|
|
|
|
@.crate-kit/scripts/release-notes.sh
|
|
|
|
|
@echo "$(BLUE)→ Documenting the current commit...$(NC)"
|
|
|
|
|
@jj auto-doc
|
|
|
|
|
@echo "$(BLUE)→ Pushing main...$(NC)"
|
|
|
|
|
@.crate-kit/scripts/push-main.sh
|
|
|
|
|
@scripts/jj-tag.sh
|
|
|
|
|
@.crate-kit/scripts/new-commit.sh
|
|
|
|
|
@echo "$(GREEN)✓ Tag pushed: the CI (release.yml) builds and publishes the release$(NC)"
|
|
|
|
|
|
|
|
|
|
## print-%: Value of a make variable (e.g. make print-REGISTRY)
|
|
|
|
|
print-%:
|
|
|
|
|
@echo '$($*)'
|
|
|
|
|
|
|
|
|
|
# ── crate-kit (registry `obi`, joint development) ─────────────────────────────
|
|
|
|
|
# obiskim is an APPLICATION workspace, not a crate. It includes dev-patch.mk (private registry
|
|
|
|
|
# definition, local patches to neighbouring crates, deps-check/deps-bump) and jj.mk (jjnew, jjfetch).
|
|
|
|
|
# The crate targets of crate.mk (publish, api-*, kit-check: it requires a release.yaml workflow) do NOT
|
|
|
|
|
# apply; the release targets above are the application's own, built on the kit's scripts.
|
|
|
|
|
# .crate-kit/ is resynchronized from obi-kit (which assembles crate-kit) at every make, before the include.
|
|
|
|
|
# Skipped when obi-kit is absent (CI, repository cloned alone): the committed copy is used.
|
|
|
|
|
# Included last so that the default goal stays `build`.
|
|
|
|
|
KIT_SRC ?= ../obi-kit
|
|
|
|
|
$(shell [ -x '$(KIT_SRC)/tools/kit-copy.sh' ] && '$(KIT_SRC)/tools/kit-copy.sh' .crate-kit)
|
|
|
|
|
|
|
|
|
|
include .crate-kit/dev-patch.mk
|
|
|
|
|
include .crate-kit/jj.mk
|
|
|
|
|
|
|
|
|
|
# Exported after the includes: KIT_LANG comes from org.mk (`?=`), and an earlier `export KIT_LANG` would
|
|
|
|
|
# define it empty with GNU make 3.81 (macOS).
|
|
|
|
|
export KIT_LANG CARGO_TOML
|
|
|
|
|
export PMOJJ_LANG = $(KIT_LANG)
|