Support via Liberapay, GitHub or PayPal

Makefile Source Code Blocks in Org Mode

Table of Contents

Org Mode support for `make'


The make program is a dependency-tracking build utility that is distributed with *nix systems. There are several make programs, but they each generally look for a file named makefile or Makefile, which contains rules for building one or more targets. ob-makefile.el helps the Org mode user tangle a makefile using source code blocks.

Currently, ob-makefile.el is useful only for tangling a makefile. Hopefully, at some point in the future it will support variables.

Requirements and Setup

The make program is a somewhat unusual *nix utility because the TAB character is an important part of the syntax.

Emacs includes a makefile-mode for editing the makefile code.

For tangling to work, the variable org-src-preserve-indentation must be non-nil, so that tabs aren't lost in the Org mode buffer.

(setq org-src-preserve-indentation t)

Currently, there is no need to activate makefile with org-babel-do-load-languages, but it won't hurt to do so.

 '((makefile . t)))

Org Mode Features for Makefile Source Code Blocks

Header Arguments

There are no language-specific default values or header arguments for makefile.


makefile doesn't support sessions.

Result Types

makefile source code blocks currently don't return results. They exist solely for tangling.

Documentation from the orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.