Skip to main content

Overview

The devcpc clean command removes all generated files from your project, including intermediate compilation files and final output files.

Syntax

devcpc clean

What Gets Removed

obj/ Directory (Intermediate Files)

Removes all intermediate compilation files:
  • *.bin - Compiled binaries
  • *.lst - Assembly listings
  • *.map - Memory maps
  • *.ihx - Intel HEX files (C)
  • *.lk - Linker files
  • *.noi - Debug info
  • *.rel - Relocatable files
  • *.sym - Symbol files
  • *.scn - Screen files
  • *.scn.info - Palette info

dist/ Directory (Output Files)

Removes all final output files:
  • *.dsk - Disk images
  • *.cdt - Tape images
  • *.cpr - Cartridge ROMs

ASM Backup Files

Removes backup files created during compilation:
  • *.backup - ABASM backups
  • *.backup_build - Build backups
  • *.bak - General backups
  • *.BAK - General backups

Output Example

═══════════════════════════════════════
  Limpiar Proyecto
═══════════════════════════════════════

→ Limpiando obj/...
✓ obj/ eliminado

→ Limpiando dist/...
✓ dist/ eliminado

→ Limpiando backups en ASM/...
✓ 3 archivo(s) de backup eliminados

✓ Limpieza completada

When to Use Clean

Before Fresh Build

Clean before building to ensure all files are regenerated:
devcpc clean
devcpc build

After Configuration Changes

Clean when changing major configuration:
# Edit devcpc.conf (change BUILD_LEVEL, paths, etc.)
devcpc clean
devcpc build

Disk Space Management

Clean to free up disk space:
devcpc clean
# Removes all generated files, keeps only source code

Troubleshooting Build Issues

Clean when experiencing build problems:
devcpc clean
devcpc validate
devcpc build

What Stays

The following files/directories are NOT removed:
  • devcpc.conf - Project configuration
  • README.md - Documentation
  • .gitignore - Git configuration
  • ASM/ - Source code
  • bas/ - BASIC files
  • src/ - Source code
  • assets/ - PNG sprites and screens
  • raw/ - Raw binary files
  • c/ - C source code
  • music/ - Music files
Auto-generated sprites: The sprites.asm file in ASM/ or src/ is preserved (it will be regenerated on next build if needed).

Clean vs Build

CommandPurposeWhen to Use
cleanRemove generated filesBefore fresh build, troubleshooting
buildCompile projectAfter code changes
clean && buildFresh compilationAfter major config changes

Clean in Workflows

Development Workflow

# Edit code
vim asm/make_all_mygame.asm

# Build (incremental)
devcpc build

# Test
devcpc run

Clean Build Workflow

# Major changes
vim devcpc.conf

# Clean and rebuild
devcpc clean && devcpc build

# Test
devcpc run

Release Workflow

# Clean everything
devcpc clean

# Validate
devcpc validate

# Fresh build
devcpc build

# Test
devcpc run

# Package for release
cp dist/*.dsk releases/
cp dist/*.cdt releases/

Size Information

Typical disk space usage:
Project Typeobj/ Sizedist/ SizeTotal
Small (BASIC only)10-50 KB100-200 KB~250 KB
Medium (8BP + graphics)100-500 KB200-400 KB~900 KB
Large (8BP + C + CDT + CPR)500 KB - 2 MB400 KB - 1 MB~3 MB

Error Handling

# Not in a DevCPC project
devcpc clean
# Error: No estás en un proyecto DevCPC

# Nothing to clean
devcpc clean
# ℹ No hay nada que limpiar

# Directories already removed
devcpc clean
devcpc clean
# ℹ No hay nada que limpiar

Git Integration

The .gitignore file created by devcpc new already ignores:
# Generated files
obj/
dist/
*.bin
*.lst
*.map

# Backups
*.backup
*.bak
So obj/ and dist/ are never committed to Git, and devcpc clean removes exactly what Git ignores.

Automation

You can automate clean in scripts:
#!/bin/bash
# build-release.sh

set -e

echo "Cleaning..."
devcpc clean

echo "Validating..."
devcpc validate

echo "Building..."
devcpc build

echo "Testing..."
devcpc run --dsk

echo "Done!"

Build docs developers (and LLMs) love