UNAME_S := $(shell uname -s 2>/dev/null || echo "Windows")
ifeq ($(UNAME_S),Linux)
PLATFORM ?= linux
endif
ifeq ($(UNAME_S),Darwin)
PLATFORM ?= macos
endif
ifneq ($(or $(findstring MINGW,$(UNAME_S)),$(findstring MSYS,$(UNAME_S)),$(findstring CYGWIN,$(UNAME_S))),)
PLATFORM ?= windows
endif
ifeq ($(UNAME_S),Windows)
PLATFORM ?= windows
endif
UNAME_M := $(shell uname -m 2>/dev/null || echo "unknown")
ifeq ($(UNAME_M),x86_64)
ARCH ?= x64
endif
ifeq ($(UNAME_M),aarch64)
ARCH ?= arm64
endif
ifeq ($(UNAME_M),arm64)
ARCH ?= arm64
endif
RELEASE ?= true
PYTHON_VER ?= 3.11
FEATURES ?=
VERBOSE ?= false
WINDOWS_FEATURES := grpc,websocket,rabbitmq,cache,queue,gateway,service_mesh,auth,observability,postgres,mysql,sqlite,http_client,system_info,config_hot_reload,etcd
RI_WINDOWS_FEATURES := ri/grpc,ri/websocket,ri/rabbitmq,ri/cache,ri/queue,ri/gateway,ri/service_mesh,ri/auth,ri/observability,ri/postgres,ri/mysql,ri/sqlite,ri/http_client,ri/system_info,ri/config_hot_reload,ri/etcd
ifeq ($(RELEASE),true)
BUILD_MODE := --release
BUILD_DIR := release
else
BUILD_MODE :=
BUILD_DIR := debug
endif
ifeq ($(PLATFORM),linux)
LIB_EXT := so
LIB_PREFIX := lib
STATIC_EXT := a
TARGET ?= x86_64-unknown-linux-gnu
ifeq ($(ARCH),arm64)
TARGET := aarch64-unknown-linux-gnu
endif
endif
ifeq ($(PLATFORM),windows)
LIB_EXT := dll
LIB_PREFIX :=
STATIC_EXT := lib
TARGET ?= x86_64-pc-windows-msvc
ifeq ($(ARCH),arm64)
TARGET := aarch64-pc-windows-msvc
endif
endif
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER := rust-lld
export CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER := rust-lld
ifeq ($(PLATFORM),macos)
LIB_EXT := dylib
LIB_PREFIX := lib
STATIC_EXT := a
TARGET ?= x86_64-apple-darwin
ifeq ($(ARCH),arm64)
TARGET := aarch64-apple-darwin
endif
endif
DIST_DIR := dist
INCLUDE_DIR := include
TARGET_DIR := target/$(TARGET)/$(BUILD_DIR)
ifneq ($(TERM),)
GREEN := \033[0;32m
YELLOW := \033[0;33m
RED := \033[0;31m
NC := \033[0m
else
GREEN :=
YELLOW :=
RED :=
NC :=
endif
.PHONY: all build clean test help setup-env \
build-rust build-cli build-python build-c build-java \
build-all-archs build-all-platforms \
install install-python install-java \
doc doc-rust doc-python \
lint fmt check \
docker-clean docker-build \
setup-protoc setup-cmake setup-rust setup-openssl setup-deps
all: build
setup-env: setup-protoc setup-cmake setup-rust setup-openssl setup-deps
@echo "$(GREEN)✓ Build environment setup complete$(NC)"
setup-protoc:
@echo "$(GREEN)Installing protoc...$(NC)"
ifeq ($(PLATFORM),linux)
which protoc > /dev/null 2>&1 || (sudo apt-get update && sudo apt-get install -y protobuf-compiler)
else ifeq ($(PLATFORM),macos)
which protoc > /dev/null 2>&1 || brew install protobuf
else ifeq ($(PLATFORM),windows)
@echo "$(YELLOW)Note: protoc should be installed via GitHub Actions or manually on Windows$(NC)"
endif
setup-cmake:
@echo "$(GREEN)Installing CMake...$(NC)"
ifeq ($(PLATFORM),linux)
which cmake > /dev/null 2>&1 || (sudo apt-get update && sudo apt-get install -y cmake)
else ifeq ($(PLATFORM),macos)
which cmake > /dev/null 2>&1 || brew install cmake
else ifeq ($(PLATFORM),windows)
@echo "$(YELLOW)Note: CMake should be installed via GitHub Actions or manually on Windows$(NC)"
endif
setup-rust:
@echo "$(GREEN)Setting up Rust toolchain...$(NC)"
@which rustup > /dev/null 2>&1 || (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y)
@rustup target add $(TARGET) 2>/dev/null || true
setup-openssl:
@echo "$(GREEN)Installing OpenSSL...$(NC)"
ifeq ($(PLATFORM),windows)
ifeq ($(ARCH),x64)
@echo "$(YELLOW)Installing OpenSSL for Windows x64 via vcpkg...$(NC)"
@vcpkg install openssl:x64-windows 2>/dev/null || echo "vcpkg not available, skipping"
else ifeq ($(ARCH),arm64)
@echo "$(YELLOW)Installing OpenSSL for Windows ARM64 via vcpkg...$(NC)"
@vcpkg install openssl:arm64-windows 2>/dev/null || echo "vcpkg not available, skipping"
endif
else
@echo "$(GREEN)OpenSSL will use system version$(NC)"
endif
setup-deps:
@echo "$(GREEN)Installing system dependencies...$(NC)"
@if command -v apt-get >/dev/null 2>&1; then \
echo "Using apt-get (Debian/Ubuntu)"; \
echo 'deb [trusted=yes] https://pkgs.kquirk.com/apt all main' | sudo tee /etc/apt/sources.list.d/oqs.list > /dev/null; \
sudo apt-get update; \
sudo apt-get install -y libcurl4-openssl-dev libsasl2-dev build-essential pkg-config liboqs-dev cmake || \
echo "liboqs-dev install failed, building from source..."; \
if ! dpkg -s liboqs-dev >/dev/null 2>&1; then \
echo "Building liboqs from source..."; \
sudo apt-get install -y libcurl4-openssl-dev libsasl2-dev build-essential pkg-config cmake git ninja-build; \
cd /tmp && rm -rf liboqs && git clone --depth 1 https://github.com/open-quantum-safe/liboqs.git && \
cd liboqs && mkdir -p build && cd build && \
cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr .. && \
ninja && sudo ninja install && sudo ldconfig; \
fi; \
elif command -v yum >/dev/null 2>&1 || command -v dnf >/dev/null 2>&1; then \
echo "Using yum/dnf (CentOS/RHEL/Fedora/manylinux)"; \
if command -v dnf >/dev/null 2>&1; then PKGMGR=dnf; else PKGMGR=yum; fi; \
$$PKGMGR install -y libcurl-devel openssl-devel openssl-libs cyrus-sasl-devel gcc gcc-c++ make cmake git ninja-build perl-core perl-IPC-Cmd perl-Data-Dumper; \
if [ ! -f /usr/lib64/liboqs.so ] && [ ! -f /usr/local/lib64/liboqs.so ] && [ ! -f /usr/lib/x86_64-linux-gnu/liboqs.so ]; then \
echo "Building liboqs from source..."; \
cd /tmp && rm -rf liboqs && git clone --depth 1 https://github.com/open-quantum-safe/liboqs.git && \
cd liboqs && mkdir -p build && cd build && \
cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr .. && \
ninja && ninja install && ldconfig; \
else \
echo "liboqs already installed, skipping build"; \
fi; \
elif command -v brew >/dev/null 2>&1; then \
echo "Using brew (macOS)"; \
brew update --quiet 2>/dev/null || true; \
brew install --quiet cmake pkg-config openssl liboqs 2>/dev/null || true; \
@mkdir -p .cargo; \
echo '[target.x86_64-apple-darwin]\nrustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]\n\n[target.aarch64-apple-darwin]\nrustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]' > .cargo/config.toml; \
else \
echo "$(YELLOW)No supported package manager found, skipping system dependencies$(NC)"; \
fi
ifeq ($(PLATFORM),windows)
@echo "$(GREEN)Installing Windows dependencies via vcpkg...$(NC)"
vcpkg install openssl:x64-windows librdkafka:x64-windows --classic 2>/dev/null || echo "Dependencies may already be installed"
vcpkg integrate install 2>/dev/null || true
endif
help:
@echo "$(GREEN)Ri Build System$(NC)"
@echo ""
@echo "$(YELLOW)Usage:$(NC)"
@echo " make <target> [VARIABLE=value]"
@echo ""
@echo "$(YELLOW)Build Targets:$(NC)"
@echo " build Build Rust library (default)"
@echo " build-cli Build CLI tool (ric)"
@echo " build-python Build Python wheel"
@echo " build-c Build C static library and headers"
@echo " build-java Build Java JAR"
@echo " build-all Build all components"
@echo ""
@echo "$(YELLOW)Platform-Specific Builds:$(NC)"
@echo " build-linux-x64 Build for Linux x64"
@echo " build-linux-arm64 Build for Linux ARM64"
@echo " build-windows-x64 Build for Windows x64"
@echo " build-windows-arm64 Build for Windows ARM64"
@echo " build-macos-x64 Build for macOS x64"
@echo " build-macos-arm64 Build for macOS ARM64"
@echo ""
@echo "$(YELLOW)Testing & Quality:$(NC)"
@echo " test Run all tests"
@echo " test-unit Run unit tests"
@echo " test-integration Run integration tests"
@echo " lint Run linter (clippy)"
@echo " fmt Format code"
@echo " check Check code without building"
@echo ""
@echo "$(YELLOW)Documentation:$(NC)"
@echo " doc Build all documentation"
@echo " doc-rust Build Rust documentation"
@echo " doc-python Build Python documentation"
@echo ""
@echo "$(YELLOW)Installation:$(NC)"
@echo " install Install Rust library"
@echo " install-python Install Python package"
@echo ""
@echo "$(YELLOW)Cleaning:$(NC)"
@echo " clean Clean build artifacts"
@echo " clean-all Clean all generated files"
@echo " clean-python Clean Python build artifacts"
@echo " clean-java Clean Java build artifacts"
@echo ""
@echo "$(YELLOW)Docker:$(NC)"
@echo " docker-build Build manylinux Python wheel"
@echo " docker-clean Clean Docker artifacts"
@echo ""
@echo "$(YELLOW)Variables:$(NC)"
@echo " PLATFORM=$(PLATFORM) Target platform (linux/windows/macos)"
@echo " ARCH=$(ARCH) Target architecture (x64/arm64)"
@echo " PYTHON_VER=$(PYTHON_VER) Python version (3.8-3.14)"
@echo " RELEASE=$(RELEASE) Release mode (true/false)"
@echo " TARGET=$(TARGET) Rust target triple"
@echo " FEATURES=... Cargo features to enable"
@echo ""
@echo "$(YELLOW)Examples:$(NC)"
@echo " make build @echo " make build-python PYTHON_VER=3.12 @echo " make build-linux-arm64 @echo " make build-c @echo " make test FEATURES=full
build:
@echo "$(GREEN)Building Ri library for $(PLATFORM) $(ARCH)...$(NC)"
ifeq ($(PLATFORM),linux)
@$(MAKE) setup-deps
endif
ifeq ($(PLATFORM)-$(ARCH),windows-arm64)
cargo build $(BUILD_MODE) --target $(TARGET) --no-default-features $(if $(FEATURES),--features $(FEATURES),)
else ifeq ($(PLATFORM),windows)
cargo build $(BUILD_MODE) --target $(TARGET) --no-default-features --features $(WINDOWS_FEATURES)
else
cargo build $(BUILD_MODE) --target $(TARGET) $(if $(FEATURES),--features $(FEATURES),)
endif
@echo "$(GREEN)✓ Build complete: $(TARGET_DIR)/$(LIB_PREFIX)ri.$(LIB_EXT)$(NC)"
build-cli:
@echo "$(GREEN)Building CLI tool for $(PLATFORM) $(ARCH)...$(NC)"
ifeq ($(PLATFORM),linux)
@$(MAKE) setup-deps
endif
ifeq ($(PLATFORM)-$(ARCH),windows-arm64)
cargo build $(BUILD_MODE) -p ric --target $(TARGET) --no-default-features --features $(RI_WINDOWS_FEATURES)
else ifeq ($(PLATFORM),windows)
cargo build $(BUILD_MODE) -p ric --target $(TARGET) --no-default-features --features $(RI_WINDOWS_FEATURES)
else
cargo build $(BUILD_MODE) -p ric --target $(TARGET)
endif
ifeq ($(PLATFORM),windows)
@echo "$(GREEN)✓ Build complete: $(TARGET_DIR)/ric.exe$(NC)"
else
@echo "$(GREEN)✓ Build complete: $(TARGET_DIR)/ric$(NC)"
endif
build-python:
@echo "$(GREEN)Building Python wheel for $(PLATFORM) $(ARCH) (Python $(PYTHON_VER))...$(NC)"
@mkdir -p $(DIST_DIR)
ifeq ($(PLATFORM),linux)
ifneq ($(ARCH),arm64)
@echo "$(YELLOW)Using manylinux container for Linux wheel...$(NC)"
docker run --rm -v "$(PWD)":/io quay.io/pypa/manylinux_2_17_x86_64 \
/bin/bash -c "cd /io && make setup-deps && \
PYTHON_VER=$(PYTHON_VER) && \
PYTHON_MAJOR=\$${PYTHON_VER%%.*} && \
PYTHON_MINOR=\$${PYTHON_VER#*.} && \
PYTHON_BIN=/opt/python/cp\$${PYTHON_MAJOR}\$${PYTHON_MINOR}-cp\$${PYTHON_MAJOR}\$${PYTHON_MINOR}/bin/python && \
\$$PYTHON_BIN -m pip install maturin && \
\$$PYTHON_BIN -m maturin build --release --target $(TARGET) -o /io/$(DIST_DIR) \
--no-default-features \
--features pyo3,grpc,websocket,rabbitmq,cache,queue,gateway,service_mesh,auth,observability,postgres,mysql,sqlite,http_client,system_info,config_hot_reload,protocol,kafka,etcd
else
@echo "$(YELLOW)Building native Linux ARM64 wheel...$(NC)"
$(MAKE) setup-deps
PYTHON_VER=$(PYTHON_VER) && \
PYTHON_BIN=python$${PYTHON_VER%.*} && \
$$PYTHON_BIN -m pip install maturin && \
$$PYTHON_BIN -m maturin build --release --target $(TARGET) -o $(DIST_DIR) \
--no-default-features \
--features pyo3,grpc,websocket,rabbitmq,cache,queue,gateway,service_mesh,auth,observability,postgres,mysql,sqlite,http_client,system_info,config_hot_reload,protocol,kafka,etcd
endif
else ifeq ($(PLATFORM),windows)
@echo "$(YELLOW)Building Windows wheel...$(NC)"
pip install maturin
ifeq ($(ARCH),arm64)
maturin build --release --target $(TARGET) -o $(DIST_DIR) --no-default-features --features pyo3,grpc,websocket,rabbitmq,cache,queue,gateway,service_mesh,auth,observability,postgres,mysql,sqlite,http_client,system_info,config_hot_reload,etcd
else
maturin build --release --target $(TARGET) -o $(DIST_DIR) --no-default-features --features pyo3,grpc,websocket,rabbitmq,cache,queue,gateway,service_mesh,auth,observability,postgres,mysql,sqlite,http_client,system_info,config_hot_reload,protocol,etcd
endif
else
@echo "$(YELLOW)Building native wheel...$(NC)"
pip install maturin
OPENSSL_NO_VENDOR=1 maturin build --release --target $(TARGET) -o $(DIST_DIR) \
--no-default-features \
--features pyo3,grpc,websocket,rabbitmq,cache,queue,gateway,service_mesh,auth,observability,postgres,mysql,sqlite,http_client,system_info,config_hot_reload,protocol,kafka,etcd
endif
@echo "$(GREEN)✓ Python wheel built: $(DIST_DIR)/$(NC)"
@ls -lh $(DIST_DIR)/*.whl 2>/dev/null || echo "No wheels found"
build-c:
@echo "$(GREEN)Building C static library for $(PLATFORM) $(ARCH)...$(NC)"
ifeq ($(PLATFORM),linux)
@$(MAKE) setup-deps
endif
ifeq ($(PLATFORM),windows)
cargo build $(BUILD_MODE) --target $(TARGET) --no-default-features --features c
else
cargo build $(BUILD_MODE) --target $(TARGET) --no-default-features --features c
endif
@echo "$(GREEN)Generating C headers...$(NC)"
@mkdir -p $(INCLUDE_DIR)
@if ! command -v cbindgen >/dev/null 2>&1; then cargo install cbindgen; fi
cbindgen --crate ri -o $(INCLUDE_DIR)/ri.h
ifeq ($(PLATFORM),windows)
@echo "$(GREEN)✓ C library built: $(TARGET_DIR)/ri.$(STATIC_EXT)$(NC)"
else
@echo "$(GREEN)✓ C library built: $(TARGET_DIR)/$(LIB_PREFIX)ri.$(STATIC_EXT)$(NC)"
endif
@echo "$(GREEN)✓ C header generated: $(INCLUDE_DIR)/ri.h$(NC)"
build-java:
@echo "$(GREEN)Building Java JAR...$(NC)"
@echo "$(YELLOW)Note: This requires pre-built native libraries for all platforms$(NC)"
@mkdir -p java/src/main/resources/native
@ @for platform in linux-x64 linux-arm64 windows-x64 windows-arm64 macos-x64 macos-arm64; do \
if [ -d "native/$$platform" ]; then \
mkdir -p "java/src/main/resources/native/$$platform"; \
cp -r native/$$platform/* java/src/main/resources/native/$$platform/ 2>/dev/null || true; \
fi; \
done
cd java && mvn clean package -DskipTests
@echo "$(GREEN)✓ Java JAR built: java/target/ri-*.jar$(NC)"
build-all: build build-cli build-python build-c
@echo "$(GREEN)✓ All components built successfully$(NC)"
build-linux-x64:
@$(MAKE) build PLATFORM=linux ARCH=x64 TARGET=x86_64-unknown-linux-gnu
build-linux-arm64:
@$(MAKE) build PLATFORM=linux ARCH=arm64 TARGET=aarch64-unknown-linux-gnu
build-windows-x64:
@$(MAKE) build PLATFORM=windows ARCH=x64 TARGET=x86_64-pc-windows-msvc
build-windows-arm64:
cargo build $(BUILD_MODE) --target aarch64-pc-windows-msvc --no-default-features --features $(WINDOWS_FEATURES)
@echo "$(GREEN)✓ Build complete: target/aarch64-pc-windows-msvc/release/ri.dll$(NC)"
build-macos-x64:
@$(MAKE) build PLATFORM=macos ARCH=x64 TARGET=x86_64-apple-darwin
build-macos-arm64:
@$(MAKE) build PLATFORM=macos ARCH=arm64 TARGET=aarch64-apple-darwin
build-cli-linux-x64:
@$(MAKE) build-cli PLATFORM=linux ARCH=x64 TARGET=x86_64-unknown-linux-gnu
build-cli-linux-arm64:
@$(MAKE) build-cli PLATFORM=linux ARCH=arm64 TARGET=aarch64-unknown-linux-gnu
build-cli-windows-x64:
@$(MAKE) build-cli PLATFORM=windows ARCH=x64 TARGET=x86_64-pc-windows-msvc
build-cli-windows-arm64:
@echo "$(GREEN)Building CLI for Windows ARM64...$(NC)"
cargo build $(BUILD_MODE) -p ric --target aarch64-pc-windows-msvc --no-default-features --features $(RI_WINDOWS_FEATURES)
@echo "$(GREEN)✓ Build complete: target/aarch64-pc-windows-msvc/release/ric.exe$(NC)"
build-cli-macos-x64:
@$(MAKE) build-cli PLATFORM=macos ARCH=x64 TARGET=x86_64-apple-darwin
build-cli-macos-arm64:
@$(MAKE) build-cli PLATFORM=macos ARCH=arm64 TARGET=aarch64-apple-darwin
build-c-linux-x64:
@$(MAKE) build-c PLATFORM=linux ARCH=x64 TARGET=x86_64-unknown-linux-gnu
build-c-linux-arm64:
@$(MAKE) build-c PLATFORM=linux ARCH=arm64 TARGET=aarch64-unknown-linux-gnu
build-c-windows-x64:
@$(MAKE) build-c PLATFORM=windows ARCH=x64 TARGET=x86_64-pc-windows-msvc
build-c-windows-arm64:
@$(MAKE) build-c PLATFORM=windows ARCH=arm64 TARGET=aarch64-pc-windows-msvc
build-c-macos-x64:
@$(MAKE) build-c PLATFORM=macos ARCH=x64 TARGET=x86_64-apple-darwin
build-c-macos-arm64:
@$(MAKE) build-c PLATFORM=macos ARCH=arm64 TARGET=aarch64-apple-darwin
test:
@echo "$(GREEN)Running tests...$(NC)"
cargo test --all-features --target $(TARGET)
@echo "$(GREEN)✓ Tests passed$(NC)"
test-unit:
@echo "$(GREEN)Running unit tests...$(NC)"
cargo test --lib --all-features --target $(TARGET)
@echo "$(GREEN)✓ Unit tests passed$(NC)"
test-integration:
@echo "$(GREEN)Running integration tests...$(NC)"
cargo test --test '*' --all-features --target $(TARGET)
@echo "$(GREEN)✓ Integration tests passed$(NC)"
lint:
@echo "$(GREEN)Running linter...$(NC)"
cargo clippy --all-features --target $(TARGET) -- -D warnings
@echo "$(GREEN)✓ Linting passed$(NC)"
fmt:
@echo "$(GREEN)Formatting code...$(NC)"
cargo fmt --all
@echo "$(GREEN)✓ Code formatted$(NC)"
check:
@echo "$(GREEN)Checking code...$(NC)"
cargo check --all-features --target $(TARGET)
@echo "$(GREEN)✓ Check passed$(NC)"
doc: doc-rust doc-python
@echo "$(GREEN)✓ Documentation built$(NC)"
doc-rust:
@echo "$(GREEN)Building Rust documentation...$(NC)"
cargo doc --no-deps --all-features --target $(TARGET)
@echo "$(GREEN)✓ Rust documentation: target/doc/ri/$(NC)"
doc-python:
@echo "$(GREEN)Building Python documentation...$(NC)"
@pip install pdoc 2>/dev/null || true
pdoc -o target/doc/python ri
@echo "$(GREEN)✓ Python documentation: target/doc/python/$(NC)"
install:
@echo "$(GREEN)Installing Ri library...$(NC)"
cargo install --path .
@echo "$(GREEN)✓ Installation complete$(NC)"
install-python:
@echo "$(GREEN)Installing Python package...$(NC)"
pip install maturin
maturin develop --release --features pyo3
@echo "$(GREEN)✓ Python package installed$(NC)"
clean:
@echo "$(YELLOW)Cleaning build artifacts...$(NC)"
cargo clean
@rm -rf $(DIST_DIR)
@rm -rf $(INCLUDE_DIR)
@echo "$(GREEN)✓ Clean complete$(NC)"
clean-all: clean
@echo "$(YELLOW)Cleaning all generated files...$(NC)"
@rm -rf target
@rm -rf dist
@rm -rf include
@rm -rf java/target
@rm -rf native
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
@echo "$(GREEN)✓ All generated files cleaned$(NC)"
clean-python:
@echo "$(YELLOW)Cleaning Python artifacts...$(NC)"
@rm -rf dist
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
@find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
@echo "$(GREEN)✓ Python artifacts cleaned$(NC)"
clean-java:
@echo "$(YELLOW)Cleaning Java artifacts...$(NC)"
@rm -rf java/target
@echo "$(GREEN)✓ Java artifacts cleaned$(NC)"
docker-build:
@echo "$(GREEN)Building manylinux Python wheel in Docker...$(NC)"
@echo "$(YELLOW)This requires Docker to be installed and running$(NC)"
@$(MAKE) build-python PLATFORM=linux
docker-clean:
@echo "$(YELLOW)Cleaning Docker artifacts...$(NC)"
@docker system prune -f 2>/dev/null || true
@echo "$(GREEN)✓ Docker artifacts cleaned$(NC)"
ci-build-all: build build-cli build-python build-c
@echo "$(GREEN)✓ CI build complete for $(PLATFORM) $(ARCH)$(NC)"
ci-package:
@echo "$(GREEN)Packaging artifacts...$(NC)"
@mkdir -p artifacts
ifeq ($(PLATFORM),windows)
@cp $(TARGET_DIR)/ric.exe artifacts/ric-$(PLATFORM)-$(ARCH).exe 2>/dev/null || true
@cp $(TARGET_DIR)/ri.dll artifacts/ri-$(PLATFORM)-$(ARCH).dll 2>/dev/null || true
@cp $(TARGET_DIR)/ri.lib artifacts/ri-$(PLATFORM)-$(ARCH).lib 2>/dev/null || true
else
@cp $(TARGET_DIR)/ric artifacts/ric-$(PLATFORM)-$(ARCH) 2>/dev/null || true
@cp $(TARGET_DIR)/$(LIB_PREFIX)ri.$(LIB_EXT) artifacts/ri-$(PLATFORM)-$(ARCH).$(LIB_EXT) 2>/dev/null || true
@cp $(TARGET_DIR)/$(LIB_PREFIX)ri.$(STATIC_EXT) artifacts/ri-$(PLATFORM)-$(ARCH).$(STATIC_EXT) 2>/dev/null || true
endif
@cp $(INCLUDE_DIR)/ri.h artifacts/ri.h 2>/dev/null || true
@cp -r $(DIST_DIR)/*.whl artifacts/ 2>/dev/null || true
@echo "$(GREEN)✓ Artifacts packaged in artifacts/$(NC)"
info:
@echo "$(GREEN)Build Configuration:$(NC)"
@echo " Platform: $(PLATFORM)"
@echo " Architecture: $(ARCH)"
@echo " Target: $(TARGET)"
@echo " Build Mode: $(if $(filter true,$(RELEASE)),Release,Debug)"
@echo " Python Ver: $(PYTHON_VER)"
@echo " Features: $(or $(FEATURES),default)"
@echo ""
@echo "$(GREEN)Paths:$(NC)"
@echo " Target Dir: $(TARGET_DIR)"
@echo " Dist Dir: $(DIST_DIR)"
@echo " Include Dir: $(INCLUDE_DIR)"
@echo ""
@echo "$(GREEN)Library Names:$(NC)"
@echo " Dynamic: $(LIB_PREFIX)ri.$(LIB_EXT)"
@echo " Static: $(LIB_PREFIX)ri.$(STATIC_EXT)"
watch:
@echo "$(GREEN)Watching for changes...$(NC)"
cargo watch -x "build $(BUILD_MODE) --target $(TARGET)"
run:
@echo "$(GREEN)Running Ri...$(NC)"
cargo run $(BUILD_MODE) --target $(TARGET)
completion:
@echo "$(GREEN)Generating shell completion scripts...$(NC)"
@mkdir -p completions
@echo "Bash completion: completions/ric.bash"
@echo "Zsh completion: completions/_ric"
@echo "Fish completion: completions/ric.fish"
@echo "$(GREEN)✓ Completion scripts generated$(NC)"