Anúncios incomodam? Ir Sem anúncios Hoje

Formatação de Makefile

DesenvolvedorTexto
ANUNCIADO Remover?
Used to detect leading-space indentation that should become tabs.
ANUNCIADO Remover?

Guia

Makefile Formatter

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

  1. Paste your Makefile into the input panel — or click Tente um exemplo to load a sample with intentional issues.
  2. Pick a tab width (used to detect indented recipe lines that should be tabs).
  3. 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.
  4. 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 define e endef is preserved verbatim.
  • Totalmente no lado do cliente – your Makefile never leaves the browser.

Perguntas frequentes

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Quer eliminar anúncios? Fique sem anúncios hoje mesmo

Instale nossas extensões

Adicione ferramentas de IO ao seu navegador favorito para acesso instantâneo e pesquisa mais rápida

Ao Extensão do Chrome Ao Extensão de Borda Ao Extensão Firefox Ao Extensão Opera

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!

ANUNCIADO Remover?
ANUNCIADO Remover?
ANUNCIADO Remover?

Notícias com destaques técnicos

Envolver-se

Ajude-nos a continuar fornecendo ferramentas gratuitas valiosas

Compre-me um café
ANUNCIADO Remover?