# Makefile Tab Indentation Rule
## Rule
All Makefile recipe lines (commands under targets) MUST use tab characters for indentation. Spaces cause a syntax error. Configure editors to use tabs in Makefiles.
## Why
GNU Make requires literal tab characters before recipe lines. This is a syntactic requirement from 1976 that cannot be changed. Spaces produce the cryptic error: `*** missing separator. Stop.`
## Format
```makefile
# CORRECT: tab-indented recipe
.PHONY: build
build:
go build -o bin/app ./cmd/app
↑ This MUST be a tab character
# WRONG: space-indented recipe
.PHONY: build
build:
go build -o bin/app ./cmd/app
↑ These spaces cause: *** missing separator. Stop.
```
## Editor Configuration
### VS Code
```json
// .vscode/settings.json
{
"[makefile]": {
"editor.insertSpaces": false,
"editor.tabSize": 4
}
}
```
### .editorconfig
```ini
[Makefile]
indent_style = tab
indent_size = 4
[*.mk]
indent_style = tab
indent_size = 4
```
### Neovim
```lua
vim.api.nvim_create_autocmd("FileType", {
pattern = "make",
callback = function()
vim.opt_local.expandtab = false
vim.opt_local.tabstop = 4
end,
})
```
## Debugging
```bash
# Check for spaces in Makefile
cat -A Makefile | grep "^ "
# ^I = tab (correct), spaces = wrong
# Show invisible characters
cat -et Makefile
```
## Good
```
build:
^Igo build -o bin/app (^I = tab character)
```
## Bad
```
build:
go build -o bin/app (4 spaces = syntax error)
```