Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Ark Format: MakefileNew to Visual Studio Code? Get it now.
Ark Format: Makefile

Ark Format: Makefile

Tooark

|
20 installs
| (0) | Free
| Sponsor
Format Makefiles (Makefile, GNUmakefile, *.mk) with comprehensive code formatting options
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Ark Format: Makefile

Open VSX Version Open VSX Downloads License: MIT

A safe formatting extension for Makefiles (Makefile, GNUmakefile, *.mk) in Visual Studio Code. Keep your Makefiles consistently formatted without ever breaking the strict whitespace rules of make.

🌍 Languages: USA Flag English (this file) · Brazil Flag Português


✨ Features

  • 🎯 Full document formatting — format entire files with a single command
  • ✏️ Selection formatting — format only the selected text
  • 🎛️ Highly configurable — control conditional indentation, spacing, and formatting behavior
  • 🌍 Multi-language UI — English (EN) and Brazilian Portuguese (PT-BR)
  • 📋 .editorconfig support — respects project configuration (optional)
  • 🛡️ Makefile-aware safety — TAB recipe prefix and define blocks are never broken
  • ⚡ Optimized performance — fast and lightweight processing

🛡️ Safety Invariants

Makefiles have strict whitespace semantics. The formatter is built around invariants that guarantee it never changes what make executes:

  • Recipe lines (TAB-prefixed) keep their prefix and their body is never modified — recipe content belongs to the shell.
  • define ... endef blocks are preserved verbatim.
  • Line continuations (\) are preserved; only whitespace after the backslash is trimmed.
  • .RECIPEPREFIX: if the file redefines the recipe prefix, the document is left untouched (TAB detection no longer applies).

🚀 Getting Started

Install

  • Open VSX: https://open-vsx.org/extension/tooark/ark-format-makefile
  • VS Code Marketplace: https://marketplace.visualstudio.com/items?itemName=tooark.ark-format-makefile

Or inside VS Code:

  1. Open Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  2. Search for Ark Format: Makefile
  3. Click Install

🧩 How to Use

Preview

Ark Format Makefile - Settings

Ark Format Makefile - Formatting

Format a Full Document

  • Press Shift+Alt+F (Windows/Linux) or Shift+Option+F (Mac)
  • Or use the command: Editor: Format Document

Format a Selection

  • Select the text you want to format
  • Press Ctrl+K Ctrl+F (Windows/Linux) or Cmd+K Cmd+F (Mac)
  • Or use the command: Editor: Format Selection

Tip: You can set Ark Format as the default formatter for Makefile files to ensure consistent formatting on save.


📄 Supported File Types

  • Makefile - standard Makefile
  • makefile - lowercase Makefile
  • GNUmakefile - GNU Makefile
  • *.mk — Make include files

⚙️ Configuration

Customize the formatter in settings.json:

{
  "arkFormatMakefile.enabled": true,
  "arkFormatMakefile.effectLanguages": ["makefile"],
  "arkFormatMakefile.useEditorConfig": false,
  "arkFormatMakefile.indentConditionals": true,
  "arkFormatMakefile.normalizeRecipePrefix": true,
  "arkFormatMakefile.alignAssignments": false,
  "arkFormatMakefile.indentSize": 2,
  "arkFormatMakefile.lineEnding": "LF",
  "arkFormatMakefile.trimTrailingWhitespace": true,
  "arkFormatMakefile.maxConsecutiveBlankLines": 1,
  "arkFormatMakefile.removeLeadingBlankLines": true,
  "arkFormatMakefile.insertFinalNewline": true,
  "arkFormatMakefile.collapseSpaces": true,
  "arkFormatMakefile.spacing.spaceAroundAssignment": true,
  "arkFormatMakefile.spacing.spaceAfterTargetColon": true,
  "arkFormatMakefile.spacing.spaceAfterCommentMarker": true,
  "arkFormatMakefile.rangeFormatting.enabled": true,
  "arkFormatMakefile.rangeFormatting.reindent": false,
  "arkFormatMakefile.rangeFormatting.useDocumentContext": true
}

Description of Settings

Option Default Description
enabled true Enables or disables the extension
effectLanguages ["makefile"] Language IDs for which the formatter is active
useEditorConfig false Uses .editorconfig file context for configuration
indentConditionals true Indents conditional bodies (ifeq/else/endif) using spaces
normalizeRecipePrefix true Converts space-indented recipe lines to the mandatory TAB prefix
alignAssignments false Aligns assignment operators in contiguous variable blocks
indentSize 2 Number of spaces per indentation level for conditional blocks
lineEnding LF Line break type (Auto, LF, CRLF)
trimTrailingWhitespace true Removes trailing whitespace
maxConsecutiveBlankLines 1 Maximum number of consecutive blank lines
removeLeadingBlankLines true Removes blank lines at the beginning of the file
insertFinalNewline true Inserts a new line at the end of the file
collapseSpaces true Collapses multiple spaces (never in recipes, comments, values, define)
spacing.spaceAroundAssignment true Adds a single space around assignment operators
spacing.spaceAfterTargetColon true Adds a single space after : in target declarations
spacing.spaceAfterCommentMarker true Adds a space between # and the comment text
rangeFormatting.enabled true Enables range formatting
rangeFormatting.reindent false Re-indents the selected range
rangeFormatting.useDocumentContext true Uses document context to compute base conditional depth for selection

💡 Tips & Best Practices

  • Use Selection Formatting to adjust only specific parts without affecting the rest of the file
  • Configure .editorconfig in your project to maintain consistency between tools
  • Combine with other formatting extensions for a complete workflow

🤝 Contributing

  • Open an issue: Tooark/vscode-ark-format/issues
  • Suggest improvements or report bugs with examples to help reproduction

💖 Support

If this extension helps your workflow, consider supporting its development:

  • 💙 GitHub Sponsors
  • ☕ Ko-fi
  • 💸 PayPal

Every contribution helps keep the project maintained and improving. Thank you! 🙏


📝 License

This project is licensed under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft