02.5Makefile
Makefile tab checker
Every recipe line in a Makefile must start with a tab. Paste yours to find the lines indented with spaces, the cause of *** missing separator. Stop., and get a fixed copy.
or drop a file on this box
Summary
- Recipe prefix
- a tab
- Rules
- 4
- Recipe lines
- 7
- Inside define
- 5 lines, left alone
- Problems
- 3 · 3 fixed
Problems
- Command with a colon, indented with spacesNo error, but make reads this line as a new rule (it contains a colon), so it never runs as a command and it ends the recipe above.Fixed: now starts with a tab
- Recipe line indented with spacesMakefile:16: *** missing separator. Stop.Fixed: now starts with a tab
- Recipe line indented with spacesMakefile:24: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.Fixed: now starts with a tab
How the check works
make only treats a line as part of a recipe if it starts with a tab and follows a rule such as build: main.c. A recipe line indented with spaces is read as ordinary makefile syntax, which fails with missing separator (GNU make adds “did you mean TAB instead of 8 spaces?” when there are eight). Worse, a space-indented command that contains a colon, like @echo "Done: $@", is silently read as a new rule.
- Space-indented lines inside a rule become tab-indented; deeper indentation beyond the first recipe line is kept after the tab.
- Backslash continuation lines belong to the line above, so they are never changed.
- Text between
defineandendefis a variable’s value and is left exactly as it is. ifeq,elseandendifmay be indented with spaces, but not with a tab inside a rule, where make would hand them to the shell; those tabs are removed.- If the file sets
.RECIPEPREFIX, that character is used instead of a tab from that point on.
Questions
Why did my editor put spaces there?
Most editors insert spaces when you press Tab. Add an [Makefile] section with indent_style = tab to your .editorconfig and they will insert real tabs in Makefiles.
Can a Makefile use spaces instead of tabs?
Not plain spaces. GNU make 3.82 and later let you set .RECIPEPREFIX to another character, such as >, and start recipe lines with that instead.
Is my Makefile uploaded?
No. The check runs in your browser.