scripts/check_test_wiring.py and scripts/check_security_coverage.py import tomllib, which landed in Python 3.11. macOS ships /usr/bin/python3 at 3.9, so `make pre-commit` failed on a clean machine with `ModuleNotFoundError: No module named 'tomllib'` in test-wiring-check, even though the checkers themselves are fine. Add scripts/python_bin.sh, which resolves an interpreter (explicit RUSTFS_PYTHON, then python3.14..3.11/python3/python on PATH, then a `uv run --python 3.12 --no-project` fallback) and execs it, failing with the concrete remediation when nothing usable exists. Route the Make call sites through RUSTFS_PYTHON_BIN. CI workflows keep calling python3 directly because their runners already provide 3.11+.
89 lines
2.9 KiB
Makefile
89 lines
2.9 KiB
Makefile
###########
|
|
# Remote development requires VSCode with Dev Containers, Remote SSH, Remote Explorer
|
|
# https://code.visualstudio.com/docs/remote/containers
|
|
###########
|
|
|
|
.PHONY: SHELL
|
|
|
|
# Makefile global config
|
|
# Use config.mak to override any of the following variables.
|
|
# Do not make changes here.
|
|
|
|
.DEFAULT_GOAL := help
|
|
.EXPORT_ALL_VARIABLES:
|
|
.ONESHELL:
|
|
.SILENT:
|
|
|
|
NUM_CORES := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu)
|
|
|
|
MAKEFLAGS += -j$(NUM_CORES) -l$(NUM_CORES)
|
|
MAKEFLAGS += --silent
|
|
|
|
SHELL := $(shell which bash)
|
|
.SHELLFLAGS = -eu -o pipefail -c
|
|
|
|
DOCKER_CLI ?= docker
|
|
# Python interpreter for the repository's helper scripts. They import tomllib
|
|
# (Python 3.11+), while macOS still ships /usr/bin/python3 at 3.9, so calls go
|
|
# through a resolver that picks a new-enough interpreter (or falls back to uv).
|
|
# Override with RUSTFS_PYTHON=/path/to/python3.12, or replace the resolver via
|
|
# RUSTFS_PYTHON_BIN=<command>.
|
|
RUSTFS_PYTHON_BIN ?= ./scripts/python_bin.sh
|
|
IMAGE_NAME ?= rustfs:v1.0.0
|
|
CONTAINER_NAME ?= rustfs-dev
|
|
# Docker build configurations
|
|
DOCKERFILE_PRODUCTION = Dockerfile
|
|
DOCKERFILE_SOURCE = Dockerfile.source
|
|
BUILD_OS ?= rockylinux9.3
|
|
|
|
# Makefile colors config
|
|
bold := $(shell tput bold)
|
|
normal := $(shell tput sgr0)
|
|
errorTitle := $(shell tput setab 1 && tput bold && echo '\n')
|
|
recommendation := $(shell tput setab 4)
|
|
underline := $(shell tput smul)
|
|
reset := $(shell tput -Txterm sgr0)
|
|
black := $(shell tput setaf 0)
|
|
red := $(shell tput setaf 1)
|
|
green := $(shell tput setaf 2)
|
|
yellow := $(shell tput setaf 3)
|
|
blue := $(shell tput setaf 4)
|
|
magenta := $(shell tput setaf 5)
|
|
cyan := $(shell tput setaf 6)
|
|
white := $(shell tput setaf 7)
|
|
|
|
define HEADER
|
|
How to use me:
|
|
# To get help for each target
|
|
${bold}make help${reset}
|
|
|
|
# To run and execute a target
|
|
${bold}make ${cyan}<target>${reset}
|
|
|
|
💡 For more help use 'make help', 'make help-build' or 'make help-docker'
|
|
|
|
🦀 RustFS Makefile Help:
|
|
|
|
📋 Main Command Categories:
|
|
make help-build # Show build-related help
|
|
make help-docker # Show Docker-related help
|
|
|
|
🔧 Code Quality:
|
|
make fmt # Format code
|
|
make clippy-check # Run clippy (all targets, all features, -D warnings)
|
|
make quick-check # Fast workspace compile check (excludes e2e_test)
|
|
make test # Script tests + workspace tests + doc tests
|
|
make pre-commit # Fast gate: fmt-check + guard scripts + quick-check (NO clippy, NO tests)
|
|
make pre-pr # Full pre-PR gate: pre-commit gates + clippy-check + test
|
|
|
|
🚀 Quick Start:
|
|
make build # Build RustFS binary
|
|
make docker-dev-local # Build development Docker image (local)
|
|
make dev-env-start # Start development environment
|
|
|
|
|
|
endef
|
|
export HEADER
|
|
|
|
-include $(addsuffix /*.mak, $(shell find .config/make -type d))
|