Brandon's Notepad

June 5, 2015

m4 Macro Processor

Filed under: Computer Software,Linux — Brandon @ 3:54 am
Tags: , , , , , ,

Home > My Lists > Technical Notes > Linux > m4 Macro Processor

m4 is a macro processor that replaces tokens in a file. It was once used as a FORTRAN preprocessor and is now used by various systems to manage configuration files. I started using it years ago in conjunction with make to automatically generate web pages, but that practice ended when I decided to move this site to a ‘blog platform. Since then, I’ve continued to look for additional ways to leverage it.

Presently, I’m collecting links about m4 and will write more if needed:

GNU m4 Manual
m4 Manpage (
Using m4 Macros in Your Programs
Building text files with m4 macros
Michael Breen’s Notes on the M4 Macro Language
Fractals with SVG and m4
m4 Macros and CSS
Using the m4 macro processor for fun and profit

Here’s a random snippet of a makefile using m4:

.SUFFIXES: .m4 .html
.m4.html: $(Common)
m4 -D_LOCATION=coding -P $*.html


Create a free website or blog at

%d bloggers like this: