makefile-generation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Table of Contents

目录

Makefile Generation Skill

Makefile生成技能

Generate a Makefile with standard development targets for Python, Rust, or TypeScript projects.
为Python、Rust或TypeScript项目生成带有标准开发目标的Makefile。

When To Use

适用场景

  • Need a Makefile for a project without one
  • Want to update Makefile with new targets
  • Standardizing build automation across projects
  • Setting up development workflow commands
  • Creating language-specific build targets
  • 需要为无Makefile的项目创建Makefile
  • 希望为Makefile添加新目标
  • 在多个项目中标准化构建自动化流程
  • 设置开发工作流命令
  • 创建特定语言的构建目标

When NOT To Use

不适用场景

  • Makefile already exists and is current
  • Project uses alternative build system exclusively (e.g., npm scripts only)
  • Complex custom build process that doesn't fit standard patterns
  • Use
    /attune:upgrade-project
    instead for updating existing Makefiles
  • Makefile已存在且内容最新
  • 项目完全使用其他构建系统(例如仅使用npm scripts)
  • 复杂的自定义构建流程不符合标准模式
  • 更新现有Makefile请使用
    /attune:upgrade-project

Standard Targets

标准目标

Python Makefile

Python Makefile

Common targets:
  • help
    - Show available targets
  • install
    - Install dependencies with uv
  • lint
    - Run ruff linting
  • format
    - Format code with ruff
  • typecheck
    - Run mypy type checking
  • test
    - Run pytest
  • test-coverage
    - Run tests with coverage report
  • check-all
    - Run all quality checks
  • clean
    - Remove generated files and caches
  • build
    - Build distribution packages
  • publish
    - Publish to PyPI
常见目标:
  • help
    - 显示可用目标
  • install
    - 使用uv安装依赖
  • lint
    - 运行ruff代码检查
  • format
    - 使用ruff格式化代码
  • typecheck
    - 运行mypy类型检查
  • test
    - 运行pytest测试
  • test-coverage
    - 运行测试并生成覆盖率报告
  • check-all
    - 运行所有质量检查
  • clean
    - 删除生成的文件和缓存
  • build
    - 构建分发包
  • publish
    - 发布至PyPI

Rust Makefile

Rust Makefile

Common targets:
  • help
    - Show available targets
  • fmt
    - Format with rustfmt
  • lint
    - Run clippy
  • check
    - Cargo check
  • test
    - Run tests
  • build
    - Build release binary
  • clean
    - Clean build artifacts
常见目标:
  • help
    - 显示可用目标
  • fmt
    - 使用rustfmt格式化代码
  • lint
    - 运行clippy代码检查
  • check
    - 执行Cargo检查
  • test
    - 运行测试
  • build
    - 构建发布版本二进制文件
  • clean
    - 清理构建产物

TypeScript Makefile

TypeScript Makefile

Common targets:
  • help
    - Show available targets
  • install
    - Install npm dependencies
  • lint
    - Run ESLint
  • format
    - Format with Prettier
  • typecheck
    - Run tsc type checking
  • test
    - Run Jest tests
  • build
    - Build for production
  • dev
    - Start development server
常见目标:
  • help
    - 显示可用目标
  • install
    - 安装npm依赖
  • lint
    - 运行ESLint代码检查
  • format
    - 使用Prettier格式化代码
  • typecheck
    - 运行tsc类型检查
  • test
    - 运行Jest测试
  • build
    - 构建生产版本
  • dev
    - 启动开发服务器

Workflow

工作流程

1. Detect Language

1. 检测语言

bash
undefined
bash
undefined

Check for language indicators

Check for language indicators

if [ -f "pyproject.toml" ]; then LANGUAGE="python" elif [ -f "Cargo.toml" ]; then LANGUAGE="rust" elif [ -f "package.json" ]; then LANGUAGE="typescript" fi
**Verification:** Run the command with `--help` flag to verify availability.
if [ -f "pyproject.toml" ]; then LANGUAGE="python" elif [ -f "Cargo.toml" ]; then LANGUAGE="rust" elif [ -f "package.json" ]; then LANGUAGE="typescript" fi
**验证:** 添加`--help`参数运行命令以验证可用性。

2. Load Template

2. 加载模板

python
from pathlib import Path

template_path = Path("plugins/attune/templates") / language / "Makefile.template"
Verification: Run the command with
--help
flag to verify availability.
python
from pathlib import Path

template_path = Path("plugins/attune/templates") / language / "Makefile.template"
验证: 添加
--help
参数运行命令以验证可用性。

3. Collect Project Info

3. 收集项目信息

python
metadata = {
    "PROJECT_NAME": "my-project",
    "PROJECT_MODULE": "my_project",
    "PYTHON_VERSION": "3.10",
}
Verification: Run the command with
--help
flag to verify availability.
python
metadata = {
    "PROJECT_NAME": "my-project",
    "PROJECT_MODULE": "my_project",
    "PYTHON_VERSION": "3.10",
}
验证: 添加
--help
参数运行命令以验证可用性。

4. Render Template

4. 渲染模板

python
from template_engine import TemplateEngine

engine = TemplateEngine(metadata)
engine.render_file(template_path, Path("Makefile"))
Verification: Run the command with
--help
flag to verify availability.
python
from template_engine import TemplateEngine

engine = TemplateEngine(metadata)
engine.render_file(template_path, Path("Makefile"))
验证: 添加
--help
参数运行命令以验证可用性。

5. Verify

5. 验证

bash
make help
Verification: Run
make --dry-run
to verify build configuration.
bash
make help
验证: 运行
make --dry-run
以验证构建配置。

Customization

自定义

Users can add custom targets after the generated ones:
makefile
undefined
用户可以在生成的目标后添加自定义目标:
makefile
undefined

============================================================================

============================================================================

CUSTOM TARGETS

CUSTOM TARGETS

============================================================================

============================================================================

deploy: build ## Deploy to production ./scripts/deploy.sh
**Verification:** Run the command with `--help` flag to verify availability.
deploy: build ## Deploy to production ./scripts/deploy.sh
**验证:** 添加`--help`参数运行命令以验证可用性。

Related Skills

相关技能

  • Skill(attune:project-init)
    - Full project initialization
  • /abstract:make-dogfood
    command - Makefile testing and validation
  • Skill(attune:project-init)
    - 完整项目初始化
  • /abstract:make-dogfood
    命令 - Makefile测试与验证