NAC_Blockchain/Makefile

108 lines
3.4 KiB
Makefile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# NAC区块链 Makefile
# 作者NAC公链开发小组
# 版本v1.0.0
.PHONY: all build test clean help install check fmt clippy doc
# 默认目标
all: build
# 帮助信息
help:
@echo "NAC区块链开发工具"
@echo ""
@echo "可用命令:"
@echo " make install - 安装开发环境"
@echo " make check - 验证环境配置"
@echo " make build - 编译所有模块release模式"
@echo " make build-dev - 编译所有模块debug模式"
@echo " make test - 运行所有测试"
@echo " make fmt - 格式化代码"
@echo " make clippy - 运行代码检查"
@echo " make doc - 生成文档"
@echo " make clean - 清理编译产物"
@echo " make help - 显示此帮助信息"
@echo ""
# 安装开发环境
install:
@echo "正在安装NAC开发环境..."
@chmod +x scripts/setup_env.sh
@./scripts/setup_env.sh
# 验证环境配置
check:
@echo "正在验证环境配置..."
@chmod +x scripts/verify_env.sh
@./scripts/verify_env.sh
# 编译所有模块release模式
build:
@echo "正在编译所有模块release模式..."
@chmod +x scripts/build_all.sh
@./scripts/build_all.sh --release
# 编译所有模块debug模式
build-dev:
@echo "正在编译所有模块debug模式..."
@chmod +x scripts/build_all.sh
@./scripts/build_all.sh
# 运行所有测试
test:
@echo "正在运行所有测试..."
@chmod +x scripts/test_all.sh
@./scripts/test_all.sh
# 格式化代码
fmt:
@echo "正在格式化代码..."
@cd nac-udm && cargo fmt
@if [ -d "charter-compiler" ]; then cd charter-compiler && cargo fmt; fi
@if [ -d "nvm_v2" ]; then cd nvm_v2 && cargo fmt; fi
@if [ -d "nac-nvm" ]; then cd nac-nvm && cargo fmt; fi
@if [ -d "nac-cbpp" ]; then cd nac-cbpp && cargo fmt; fi
@if [ -d "nac-gnacs" ]; then cd nac-gnacs && cargo fmt; fi
@if [ -d "nac-acc" ]; then cd nac-acc && cargo fmt; fi
@if [ -d "nac-rpc" ]; then cd nac-rpc && cargo fmt; fi
@if [ -d "nac-storage" ]; then cd nac-storage && cargo fmt; fi
@echo "✓ 代码格式化完成"
# 运行代码检查
clippy:
@echo "正在运行代码检查..."
@cd nac-udm && cargo clippy -- -D warnings
@if [ -d "charter-compiler" ]; then cd charter-compiler && cargo clippy -- -D warnings; fi
@if [ -d "nvm_v2" ]; then cd nvm_v2 && cargo clippy -- -D warnings; fi
@if [ -d "nac-nvm" ]; then cd nac-nvm && cargo clippy -- -D warnings; fi
@if [ -d "nac-cbpp" ]; then cd nac-cbpp && cargo clippy -- -D warnings; fi
@if [ -d "nac-gnacs" ]; then cd nac-gnacs && cargo clippy -- -D warnings; fi
@if [ -d "nac-acc" ]; then cd nac-acc && cargo clippy -- -D warnings; fi
@if [ -d "nac-rpc" ]; then cd nac-rpc && cargo clippy -- -D warnings; fi
@if [ -d "nac-storage" ]; then cd nac-storage && cargo clippy -- -D warnings; fi
@echo "✓ 代码检查完成"
# 生成文档
doc:
@echo "正在生成文档..."
@cd nac-udm && cargo doc --no-deps
@if [ -d "charter-compiler" ]; then cd charter-compiler && cargo doc --no-deps; fi
@if [ -d "nvm_v2" ]; then cd nvm_v2 && cargo doc --no-deps; fi
@echo "✓ 文档生成完成"
@echo "文档位置: target/doc/index.html"
# 清理编译产物
clean:
@echo "正在清理编译产物..."
@chmod +x scripts/clean_all.sh
@./scripts/clean_all.sh
@echo "✓ 清理完成"
# 快速开发循环
dev: fmt clippy test
@echo "✓ 开发检查完成"
# 完整构建流程
full: clean build test doc
@echo "✓ 完整构建完成"