Complete infrastructure platform CLI: - Container runtime (systemd-nspawn) - VoltVisor VMs (Neutron Stardust / QEMU) - Stellarium CAS (content-addressed storage) - ORAS Registry - GitOps integration - Landlock LSM security - Compose orchestration - Mesh networking Copyright (c) Armored Gates LLC. All rights reserved. Licensed under AGPSL v5.0
197 lines
6.3 KiB
Makefile
197 lines
6.3 KiB
Makefile
# Volt Platform - Makefile
|
|
|
|
.PHONY: all build install clean test kernels images \
|
|
build-all build-android build-linux-amd64 build-linux-arm64 \
|
|
build-linux-arm build-linux-riscv64 build-android-arm64 \
|
|
build-android-amd64 checksums release
|
|
|
|
# Configuration
|
|
VERSION ?= 0.2.0
|
|
GO ?= /usr/local/go/bin/go
|
|
GOOS ?= linux
|
|
GOARCH ?= amd64
|
|
BUILD_DIR := build
|
|
INSTALL_DIR ?= /usr/local
|
|
|
|
# Go build flags
|
|
LDFLAGS := -ldflags "-X github.com/armoredgate/volt/cmd/volt/cmd.Version=$(VERSION) -X github.com/armoredgate/volt/cmd/volt/cmd.BuildDate=$(shell date -u +%Y-%m-%dT%H:%M:%SZ) -X github.com/armoredgate/volt/cmd/volt/cmd.GitCommit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) -s -w"
|
|
|
|
# Target platforms
|
|
PLATFORMS := \
|
|
linux/amd64 \
|
|
linux/arm64 \
|
|
linux/arm \
|
|
linux/riscv64 \
|
|
android/arm64 \
|
|
android/amd64
|
|
|
|
all: build
|
|
|
|
# Build the volt binary (native/configured arch)
|
|
build:
|
|
@echo "Building volt..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/volt ./cmd/volt
|
|
@echo "Built: $(BUILD_DIR)/volt"
|
|
|
|
# Build for all architectures (android/amd64 requires NDK, use build-all-ndk if available)
|
|
build-all: build-linux-amd64 build-linux-arm64 build-linux-arm build-linux-riscv64 build-android-arm64
|
|
@echo "Built 5 platform binaries (android/amd64 requires NDK — use 'make build-android-amd64' separately)"
|
|
|
|
# Build all including android/amd64 (requires Android NDK with cgo toolchain)
|
|
build-all-ndk: build-all build-android-amd64
|
|
@echo "Built all 6 platform binaries (including NDK targets)"
|
|
|
|
# Individual platform targets
|
|
build-linux-amd64:
|
|
@echo "Building linux/amd64..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/volt-linux-amd64 ./cmd/volt
|
|
|
|
build-linux-arm64:
|
|
@echo "Building linux/arm64..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/volt-linux-arm64 ./cmd/volt
|
|
|
|
build-linux-arm:
|
|
@echo "Building linux/arm (v7)..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/volt-linux-armv7 ./cmd/volt
|
|
|
|
build-linux-riscv64:
|
|
@echo "Building linux/riscv64..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/volt-linux-riscv64 ./cmd/volt
|
|
|
|
build-android-arm64:
|
|
@echo "Building android/arm64..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
CGO_ENABLED=0 GOOS=android GOARCH=arm64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/volt-android-arm64 ./cmd/volt
|
|
|
|
build-android-amd64:
|
|
@echo "Building android/amd64 (requires Android NDK for cgo)..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
CGO_ENABLED=1 GOOS=android GOARCH=amd64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/volt-android-amd64 ./cmd/volt
|
|
|
|
# Convenience: build only android variants
|
|
build-android: build-android-arm64 build-android-amd64
|
|
@echo "Built android variants"
|
|
|
|
# Install locally
|
|
install: build
|
|
@echo "Installing volt..."
|
|
@sudo install -m 755 $(BUILD_DIR)/volt $(INSTALL_DIR)/bin/volt
|
|
@sudo ln -sf $(INSTALL_DIR)/bin/volt $(INSTALL_DIR)/bin/volt-runtime
|
|
@sudo ./scripts/install.sh
|
|
@echo "Installed to $(INSTALL_DIR)"
|
|
|
|
# Uninstall
|
|
uninstall:
|
|
@echo "Uninstalling volt..."
|
|
@sudo rm -f $(INSTALL_DIR)/bin/volt
|
|
@sudo rm -f $(INSTALL_DIR)/bin/volt-runtime
|
|
@sudo rm -rf /etc/volt
|
|
@echo "Uninstalled"
|
|
|
|
# Build kernels
|
|
kernels:
|
|
@echo "Building kernels..."
|
|
@sudo ./scripts/build-kernels.sh
|
|
|
|
# Build images
|
|
images:
|
|
@echo "Building images..."
|
|
@sudo ./scripts/build-images.sh
|
|
|
|
# Run tests
|
|
test:
|
|
@echo "Running tests..."
|
|
$(GO) test -v ./...
|
|
|
|
# Integration tests
|
|
test-integration:
|
|
@echo "Running integration tests..."
|
|
@./scripts/test-integration.sh
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
@echo "Cleaning..."
|
|
@rm -rf $(BUILD_DIR)
|
|
@$(GO) clean
|
|
|
|
# Development: run locally
|
|
dev:
|
|
@$(GO) run ./cmd/volt $(ARGS)
|
|
|
|
# Format code
|
|
fmt:
|
|
@$(GO) fmt ./...
|
|
|
|
# Lint code
|
|
lint:
|
|
@golangci-lint run
|
|
|
|
# Generate documentation
|
|
docs:
|
|
@echo "Generating documentation..."
|
|
@mkdir -p docs
|
|
@cp voltainer-vm/*.md docs/
|
|
|
|
# Generate SHA256 checksums
|
|
checksums:
|
|
@echo "Generating checksums..."
|
|
cd $(BUILD_DIR) && sha256sum volt-* > SHA256SUMS
|
|
@echo "Checksums written to $(BUILD_DIR)/SHA256SUMS"
|
|
|
|
# Create release tarballs for all platforms
|
|
release: build-all
|
|
@echo "Creating release..."
|
|
@mkdir -p $(BUILD_DIR)/release
|
|
@tar -czf $(BUILD_DIR)/release/volt-$(VERSION)-linux-amd64.tar.gz \
|
|
-C $(BUILD_DIR) volt-linux-amd64 \
|
|
-C .. configs scripts README.md
|
|
@tar -czf $(BUILD_DIR)/release/volt-$(VERSION)-linux-arm64.tar.gz \
|
|
-C $(BUILD_DIR) volt-linux-arm64 \
|
|
-C .. configs scripts README.md
|
|
@tar -czf $(BUILD_DIR)/release/volt-$(VERSION)-linux-armv7.tar.gz \
|
|
-C $(BUILD_DIR) volt-linux-armv7 \
|
|
-C .. configs scripts README.md
|
|
@tar -czf $(BUILD_DIR)/release/volt-$(VERSION)-linux-riscv64.tar.gz \
|
|
-C $(BUILD_DIR) volt-linux-riscv64 \
|
|
-C .. configs scripts README.md
|
|
@tar -czf $(BUILD_DIR)/release/volt-$(VERSION)-android-arm64.tar.gz \
|
|
-C $(BUILD_DIR) volt-android-arm64 \
|
|
-C .. configs scripts README.md
|
|
@tar -czf $(BUILD_DIR)/release/volt-$(VERSION)-android-amd64.tar.gz \
|
|
-C $(BUILD_DIR) volt-android-amd64 \
|
|
-C .. configs scripts README.md
|
|
@echo "Release archives created in $(BUILD_DIR)/release"
|
|
|
|
# Show help
|
|
help:
|
|
@echo "Volt Platform Build System"
|
|
@echo ""
|
|
@echo "Targets:"
|
|
@echo " build Build volt binary (native arch)"
|
|
@echo " build-all Build for all 6 target architectures"
|
|
@echo " build-android Build android variants only"
|
|
@echo " build-linux-amd64 Build for linux/amd64"
|
|
@echo " build-linux-arm64 Build for linux/arm64"
|
|
@echo " build-linux-arm Build for linux/arm (v7)"
|
|
@echo " build-linux-riscv64 Build for linux/riscv64"
|
|
@echo " build-android-arm64 Build for android/arm64"
|
|
@echo " build-android-amd64 Build for android/amd64"
|
|
@echo " install Install volt (requires sudo)"
|
|
@echo " uninstall Uninstall volt"
|
|
@echo " kernels Build kernel profiles"
|
|
@echo " images Build VM images"
|
|
@echo " test Run unit tests"
|
|
@echo " clean Clean build artifacts"
|
|
@echo " checksums Generate SHA256 checksums"
|
|
@echo " release Create release tarballs"
|
|
@echo ""
|
|
@echo "Development:"
|
|
@echo " dev Run locally (use ARGS='vm list')"
|
|
@echo " fmt Format code"
|
|
@echo " lint Lint code"
|