# Makefile Usage Guide

**Last Updated**: 2025-01-27  
**Status**: Active

This guide explains how to use the Makefile for common project tasks.

## Table of Contents

- [Overview](#overview)
- [Prerequisites](#prerequisites)
- [Common Targets](#common-targets)
- [Deployment Targets](#deployment-targets)
- [Development Targets](#development-targets)
- [Monitoring Targets](#monitoring-targets)
- [Maintenance Targets](#maintenance-targets)
- [Examples](#examples)

## Overview

The project includes a comprehensive Makefile with targets for deployment, development, monitoring, and maintenance tasks.

## Prerequisites

- Make installed
- Azure CLI (for deployment targets)
- Terraform (for infrastructure targets)
- kubectl (for Kubernetes targets)
- Foundry (for contract targets)

## Common Targets

### Help

```bash
make help
```

Displays all available targets and their descriptions.

## Deployment Targets

### Full Deployment

```bash
# Deploy everything (infrastructure, k8s, contracts, DNS)
make deploy-all
```

### Infrastructure Deployment

```bash
# Deploy Azure infrastructure only
make deploy-infra
```

### Kubernetes Deployment

```bash
# Deploy Kubernetes resources only
make deploy-k8s
```

### Contract Deployment

```bash
# Deploy contracts only
make deploy-contracts
```

### WETH Deployment

```bash
# Deploy WETH9 contract
make deploy-weth

# Deploy WETH10 contract
make deploy-weth10

# Deploy all WETH contracts and CCIP bridges
make deploy-weth-ccip
```

### CCIP Bridge Deployment

```bash
# Deploy CCIPWETH9Bridge
make deploy-ccip-weth9-bridge

# Deploy CCIPWETH10Bridge
make deploy-ccip-weth10-bridge
```

### Blockscout Deployment

```bash
# Deploy Blockscout explorer
make deploy-blockscout
```

### DNS Configuration

```bash
# Configure Cloudflare DNS
make deploy-dns
```

## Development Targets

### Compile Contracts

```bash
# Compile and test contracts
make contracts
```

### Run Tests

```bash
# Run all tests
make test
```

### Generate Keys

```bash
# Generate validator and oracle keys
make keys
```

### Generate Genesis

```bash
# Generate genesis file
make genesis
```

## Monitoring Targets

### Monitor Deployment

```bash
# Monitor deployment status (consolidated)
make monitor

# Continuous deployment monitoring
make monitor-continuous

# Deployment dashboard view
make monitor-dashboard
```

## Maintenance Targets

### Key Vault Management

```bash
# Deploy all Key Vaults
make keyvaults

# Check Key Vault deployment status
make keyvaults-status

# Grant Key Vault permissions
make keyvaults-permissions

# Store validator keys in Key Vaults
make keyvaults-store-keys

# Run complete Key Vault setup
make keyvaults-complete
```

### Azure Resource Management

```bash
# List all Azure resources
make azure-list-resources

# Check Azure resource naming conventions
make azure-check-naming

# Authenticate with Azure CLI
make azure-login
```

### Cost Management

```bash
# Calculate deployment costs
make calculate-costs
```

### Verification

```bash
# Verify deployment
make verify
```

### Cleanup

```bash
# Clean up temporary files
make clean
```

## Parallel Deployment

```bash
# Parallel deployment (infrastructure)
make deploy-parallel
```

## Examples

### Complete Deployment Workflow

```bash
# 1. Authenticate with Azure
make azure-login

# 2. Deploy infrastructure
make deploy-infra

# 3. Deploy Kubernetes resources
make deploy-k8s

# 4. Deploy contracts
make deploy-contracts

# 5. Configure DNS
make deploy-dns

# 6. Verify deployment
make verify

# 7. Monitor status
make monitor
```

### Development Workflow

```bash
# 1. Generate keys
make keys

# 2. Generate genesis
make genesis

# 3. Compile contracts
make contracts

# 4. Run tests
make test
```

### WETH Deployment Workflow

```bash
# Deploy WETH9 and WETH10 with CCIP bridges
make deploy-weth-ccip

# Or deploy individually
make deploy-weth
make deploy-weth10
make deploy-ccip-weth9-bridge
make deploy-ccip-weth10-bridge
```

## Target Categories

### Deployment
- `deploy`, `deploy-all`, `deploy-infra`, `deploy-k8s`
- `deploy-contracts`, `deploy-blockscout`, `deploy-dns`
- `deploy-weth`, `deploy-weth10`, `deploy-weth-ccip`
- `deploy-ccip-weth9-bridge`, `deploy-ccip-weth10-bridge`

### Development
- `contracts`, `test`, `keys`, `genesis`

### Monitoring
- `monitor`, `monitor-continuous`, `monitor-dashboard`

### Maintenance
- `keyvaults*`, `azure-*`, `calculate-costs`, `verify`, `clean`

## Related Documentation

- [Deployment Guide](../deployment/DEPLOYMENT.md)
- [Deployment Quick Start](../DEPLOYMENT_QUICK_START.md)
- [Configuration Index](../configuration/CONFIGURATION_INDEX.md)

---

**Last Updated**: 2025-01-27

