.MK

MK File

Makefile
Ask a question
QUICK ANSWER

A .mk file is a plain-text build script (makefile) that tells the make utility how to compile software. Open it in any text editor such as VS Code or Notepad++. To run it, use make -f yourfile.mk on Linux/macOS or GNU Make on Windows. Never run an untrusted .mk file without inspecting it first.

Developer: Various (GNU Make: Free Software Foundation; POSIX make; BSD make; NMAKE: Microsoft) Category: Developer Files Open standard MIME: text/x-makefile
OPENS ON Windows macOS Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jul 8, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the MK file format?

A .mk file is a plain-text build script fragment written in make syntax. Where the main build file is conventionally named Makefile (no extension), .mk files serve as modular sub-makefiles - partial rule sets, variable definitions, or platform-specific configuration blocks - pulled into a parent build via make's include directive. The same rules and syntax apply to both.

A makefile rule consists of a target line (target: dependencies) followed by one or more recipe lines. Recipe lines must begin with a literal TAB character, not spaces - a notorious source of build failures that produce a cryptic missing separator error. Variable assignments, pattern rules, and conditional directives (ifeq, ifdef) are all valid in .mk files.

GNU Make (Free Software Foundation, currently version 4.4.1 released 2023) is the most widely used implementation. Microsoft's NMAKE (bundled with Visual Studio) and BSD make are broadly compatible. The .MAK extension serves a similar purpose and is common in Windows-oriented projects using NMAKE. .mk files became especially prominent through Android's legacy build system, which relied on Android.mk fragments extensively before Google replaced it with Android.bp and the Soong system.

CMake, Ninja, Meson, and Bazel have emerged as alternatives for large projects, but GNU Make and .mk fragments remain ubiquitous in open-source C/C++ codebases, embedded firmware, and the Linux kernel.

Security & safety

RISK: MEDIUM

A .mk file is plain text and cannot infect a machine by itself, but it contains shell commands that execute when make runs it. Running an untrusted .mk file (e.g. from an unknown source) can delete files, download malware, or modify system settings - the same risk as running any untrusted shell script. Always inspect the file in a text editor before running make.

Format details

in a nutshell
FULL NAMEMakefileaka Make include file, sub-makefile
DEVELOPERVarious (GNU Make: Free Software Foundation; POSIX make; BSD make; NMAKE: Microsoft)since 1976 (Stuart Feldman, Bell Labs - original make); .mk convention ~1980s
MIME TYPEtext/x-makefile
TYPEPlain-text build script (make rules/targets/variables)
STANDARDOpen · royalty-free

Programs that open MK files

Windows4 apps
Notepad Open-source Open the .mk file directly - Notepad++ recognises makefile syntax and highlights it. Best for viewing/editing.
Visual Studio Code Open-source Open the file - VS Code highlights makefile syntax natively. Install the 'Makefile Tools' extension for IntelliSense and build integration.
GNU Make for Windows Open-source From command prompt: make -f yourfile.mk to execute the build rules. Available via MSYS2 (recommended) or GnuWin32.
Microsoft Visual Studio (NMAKE) Freemium NMAKE is bundled with Visual Studio; from the Developer Command Prompt: nmake /f yourfile.mk. Supports a compatible make dialect.
macOS3 apps
Xcode Free Xcode includes clang and make toolchain; .mk files used in command-line targets can be edited in Xcode's text editor.
GNU Make Open-source macOS ships BSD make by default; install GNU Make via Homebrew: brew install make. Run: gmake -f yourfile.mk.
Visual Studio Code Open-source Full syntax highlighting and editing; 'Makefile Tools' extension adds build support.
Linux2 apps
GNU Make Open-source Pre-installed on most distros. Run: make -f yourfile.mk or place it in the project root as Makefile. Also install via package manager: sudo apt install make.
Visual Studio Code Open-source Open and edit .mk files with syntax highlighting; 'Makefile Tools' extension adds build integration.

Technical details

deep spec
Format typePlain-text make rule fragment (sub-makefile / included build script)
EncodingASCII or UTF-8
Byte orderN/A (plain text)
ContainerPlain text
Critical syntax requirementRecipe lines must start with a literal TAB character; spaces cause a 'missing separator' error
Include mechanismPulled into a parent Makefile via the 'include' directive
Typical file size1 KB - 50 KB
ImplementationsGNU Make 4.4.1 (2023), BSD make, Microsoft NMAKE, POSIX make (IEEE 1003.1-2017)
POSIX standardIEEE 1003.1-2017 (POSIX make specification)
Notable usageAndroid legacy build system (Android.mk, used before Soong/Android.bp)
PlatformLinux, macOS, Windows (MSYS2, WSL, Cygwin, NMAKE), BSD, Unix
Released1976 (Stuart Feldman, Bell Labs - original make); .mk convention ~1980s
Latest versionGNU Make 4.4.1 (2023)
Open standardYes · royalty-free
Specificationwww.gnu.org

MK conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with MK files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about MK files.

Frequently asked questions

What is a .mk file?
A plain-text makefile or makefile fragment - a build script for the make utility that defines how to compile and build software.
How do I run a .mk file?
On Linux/macOS: make -f yourfile.mk (or gmake on macOS). On Windows: use GNU Make via MSYS2, or NMAKE from Visual Studio's Developer Command Prompt.
How do I open a .mk file to read it?
Open it in any text editor - Notepad++ or VS Code show syntax highlighting. It is a plain-text file.
What is the difference between .mk, .mak, and Makefile?
They are all makefiles. 'Makefile' (no extension) is the conventional name for the main file that make looks for automatically. .mk and .mak are used for included fragments or alternate build files - functionally identical, just named differently by convention.
Why does my makefile give 'missing separator' errors?
Recipe lines must start with a literal TAB character, not spaces. Open the file in a text editor that shows whitespace (Notepad++, VS Code) and replace leading spaces on command lines with tabs.
Is a .mk file safe to open?
Safe to open in a text editor - it is plain text. Do not run 'make -f' on untrusted .mk files without inspecting them first, as the shell commands inside will execute.

References

1GNU Make Manualwww.gnu.org
2Microsoft NMAKE referencelearn.microsoft.com

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.PARTPartial Download File
4.BINCD/DVD Disc Image (BIN/CUE)
5.EXEWindows Executable (Portable Executable)
6.RPMSGRestricted Permission Message
7.MDMarkdown Document
8.DATProgram Data File (generic)
9.NOMEDIAAndroid No-Media Marker File
10.TXTPlain Text File

Related extensions

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z