Skip to content
Novus Examples
mk932 B

Makefile Targets and TAB Indentation

A Makefile whose recipe lines are indented with real TAB characters, as make requires. Covers simple, conditional, appended and substitution-reference variables, .PHONY, and .DEFAULT_GOAL. Every recipe is echo-only, so running it does nothing.

Preview — first 34 linesmk
# Makefile. NOTE: every recipe line below begins with a real TAB character — that is what make
# requires, and it is the single most common way a hand-edited Makefile breaks. Recipes are
# `echo` only, deliberately: this is a parsing fixture and running it must do nothing.

BUILD_DIR   := build
DIST_DIR    := dist
VERSION     ?= 1.4.0
SOURCES     := $(wildcard src/*.c)
OBJECTS     := $(SOURCES:src/%.c=$(BUILD_DIR)/%.o)
CFLAGS      += -O2 -Wall

.DEFAULT_GOAL := all
.PHONY: all build test package clean help

all: build test

build: $(BUILD_DIR)
	@echo "compiling $(words $(SOURCES)) source files with $(CFLAGS)"

$(BUILD_DIR):
	@echo "would create $(BUILD_DIR)"

test: build
	@echo "running tests for version $(VERSION)"

package: build
	@echo "would package $(BUILD_DIR) into $(DIST_DIR)/app-$(VERSION).tar.gz"

clean:
	@echo "would remove $(BUILD_DIR) and $(DIST_DIR)"

help:
	@echo "targets: all build test package clean"

Specifications

Targets
6
Phony Targets
5
Recipe Indent
TAB (U+0009), required by make
Recipe Lines
6
Recipes Are Inert
echo only
Variable Flavours
:=, ?=, +=, substitution reference

Testing contract

Expected to pass
Scenario
Parse a Makefile in which recipe lines must be distinguished by a leading TAB
Expected result
All six recipe lines are recognised by their U+0009 prefix, and the OBJECTS substitution reference expands from SOURCES rather than being treated as a literal

What is a .mk file?

A .mk file is a makefile fragment — the same syntax as a Makefile, meant to be pulled in with `include`. Rules pair a target with its prerequisites and a recipe whose lines must be indented with a literal tab, not spaces; variables are assigned with `=` (recursive), `:=` (immediate), or `?=` (conditional) and expanded with `$(...)`; and pattern rules, automatic variables such as `$@` and `$<`, and phony targets round out the language.

How to use this file

Use an example .mk file to test makefile parsers, build-graph extractors, and editor tooling, checking tab-versus-space recipe detection, variable expansion order, pattern-rule matching, and line continuations inside recipes.

How to use this file for testing

“Makefile Targets and TAB Indentation” is a deterministic Novus Examples fixture for Config parsing, Syntax highlighting, Editor testing. TOML and INI configuration files with nested sections and typed values — for testing config parsers and loaders.

Documented properties for this file: MK · 932 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.

Point your config loader at the file and assert it reads the documented sections and typed values, including any deliberately-tricky nesting or comments.

Generated by generation/pipelines.py. Free for any use, no attribution required — license.