What is a .mk file?
text/x-makefile
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 a .mk 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.
Download example .mk files
- Makefile Targets and TAB IndentationA 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.
- Makefile Pattern Rules and ConditionalsPattern rules with the automatic variables $@, $<, $^ and $*, ifeq/ifdef conditional directives, a vpath search path, and a define block invoked through $(call). All recipe lines are TAB-indented and echo-only.
- Makefile with Space Indentation, Intentionally InvalidAn intentionally invalid Makefile whose recipe lines are indented with four spaces instead of the required TAB. This is the most common Makefile defect there is, and it is invisible in most editors — which is exactly why it belongs in a fixture set.