Formatação de Makefile
Guia
Formatação de Makefile
Paste a Makefile and the formatter normalizes it to GNU make’s strict tab-indented recipe rules. Recipe lines that use spaces instead of tabs (the most common cause of “missing separator” errors and a frequent issue with AI-generated Makefiles) are repaired automatically. Trailing whitespace, runaway blank lines, and inconsistent assignment spacing are cleaned up in the same pass, and every change is reported so you can audit it before copying.
Como usar
- Paste your Makefile into the input panel — or click Tente um exemplo to load a sample with intentional issues.
- Pick a tab width (used to detect indented recipe lines that should be tabs).
- Toggle the cleanup options: convert spaces to tabs on recipe lines, trim trailing whitespace, normalize blank-line runs, normalize assignment spacing, and optionally align consecutive variable assignments.
- Review the issue summary and per-line fix list, then copy or download the formatted Makefile.
Características
- Recipe tab repair – converts space-indented recipe lines to tab-indented (the only indentation GNU make accepts).
- Smart line classification – distinguishes targets, variable assignments, conditionals (
ifeq,else,endif), directives (include,vpath,export), and recipe lines. - Assignment spacing – normalizes whitespace around
=,:=,::=,?=,+=e, e!=. - Optional column alignment – aligns consecutive variable assignments to the same operator column for readability.
- Issue report – every fix is shown with the source line number so you can verify changes.
- Define block safety – content between
defineeendefis preserved verbatim. - Totalmente no lado do cliente – your Makefile never leaves the browser.
Perguntas frequentes
-
Why does GNU make require tabs for recipe lines?
Make's parser uses a single tab character as the unambiguous prefix that marks a line as part of a rule's recipe. The choice predates make's first public release in 1977 and was cemented because tabs were a reliable, line-leading sentinel that would not collide with whitespace inside variable assignments or target definitions. Even though it has caused decades of confusion, changing the rule would silently break millions of existing Makefiles, so GNU make keeps tab as the default RECIPEPREFIX.
-
What is the difference between =, :=, ::=, ?=, += and != in Makefiles?
Recursive assignment (=) defers expansion until the variable is used, so referenced variables are looked up at use-time. Simple assignment (:=) and POSIX simple assignment (::=) expand the right-hand side immediately, so the value is fixed at definition time. Conditional assignment (?=) only sets the variable if it is currently undefined, which is useful for default values that the environment can override. Append assignment (+=) adds to the existing value, preserving the recursive or simple flavor of the original. Shell assignment (!=) executes the right-hand side as a shell command and stores the resulting output, similar to backticks in shell.
-
What is the difference between a recipe line and a continuation line?
A recipe line is the indented command line that runs as part of a rule's actions; in standard make it must begin with a tab character. A continuation line is any line whose preceding line ended with a backslash, which logically joins the two lines into one. Continuation lines inherit the context of their preceding line, so a continued recipe is still a recipe and a continued variable assignment is still an assignment. Indentation of a continuation line is purely cosmetic and does not change how make parses it.
-
Why are .PHONY targets needed and how do they affect parsing?
A .PHONY declaration tells make that the listed names are not real files but action labels, so make should always run their recipes regardless of any same-named file in the working directory. Without it, a file named clean would silently disable make clean because make would consider the target up to date. .PHONY does not change recipe parsing or indentation rules — recipe lines under phony targets still must start with a tab — but it changes timestamp comparison logic so the recipe is treated as out of date on every invocation.
Instale nossas extensões
Adicione ferramentas de IO ao seu navegador favorito para acesso instantâneo e pesquisa mais rápida
恵 O placar chegou!
Placar é uma forma divertida de acompanhar seus jogos, todos os dados são armazenados em seu navegador. Mais recursos serão lançados em breve!
Ferramentas essenciais
Ver tudo Novas chegadas
Ver tudoAtualizar: Nosso ferramenta mais recente foi adicionado em 4 de maio de 2026
