EmbeddedRelated.com
Books

GNU Make Reference Manual

Stallman, Richard M. ● 2015

For GNU Make Version 4.1
The Make program is indispensable to maintainers of free software systems. The GNU Make manual, written by the program's original authors, is the definitive tutorial. It also includes an introductory chapter for novice users. The Make utility automates the process of compilation; it is especially useful when the source files of large programs change. It is a small program with a lot of power.
This book will show you:

  • How to write your own makefiles
  • Make's rule syntax and how to write your own rules
  • How the Make utility can be configured to automatically put binary and source files in the right places.
  • How to use make to create archive files automatically
  • Define, set and use Make's variables
  • How Make uses targets so that you can broaden or narrow Make's recompilation efforts on demand.
  • And much more!
This manual provides a complete explanation of Make, both the basics and extended features. There is also a convenient Quick Reference appendix for experts.


Why Read This Book

You will learn how to wield GNU Make as the backbone of reproducible, efficient build systems for firmware, embedded Linux, and cross-compiled toolchains — directly from the tool’s original author. This manual is both a practical tutorial for writing working makefiles and an authoritative reference to master rules, variables, functions, and portability issues so your builds scale cleanly as projects grow.

Who Will Benefit

Embedded/firmware engineers, build and release engineers, and systems integrators who need reliable, portable build automation for cross-compilation, embedded Linux images, or complex multi-language projects.

Level: Intermediate — Prerequisites: Familiarity with the command line, basic software compilation concepts (how source files become binaries), and a working knowledge of C/C++ or other compiled languages; shell scripting experience is helpful but not required.

Get This Book

Key Takeaways

  • Write robust makefiles using explicit rules, pattern rules, and implicit rules to automate compilation and linking across targets
  • Manage variables, automatic variables, and functions to create configurable, reusable build recipes and cross-compilation flows
  • Optimize and parallelize builds safely (including use of .PHONY, order-only prerequisites, and -j) to reduce CI and local build times
  • Debug and diagnose makefile behavior using tracing, debugging options, and remaking strategies to resolve dependency issues and rebuild correctness
  • Integrate make into larger workflows: create archives, install targets, include files, and interact with toolchains used for embedded Linux, Buildroot/Yocto, and firmware packaging

Topics Covered

  1. Introduction and Overview of GNU Make
  2. Invoking Make: Command-Line Options and Environment
  3. How Make Reads Makefiles and Remakes Targets
  4. Rules and Recipes: Writing Explicit and Implicit Rules
  5. Variables: Definitions, Assignment Forms, and Overrides
  6. Automatic Variables, Functions, and Text Manipulation
  7. Pattern Rules, Suffix Rules, and Implicit Rule Mechanisms
  8. Special Targets (.PHONY, .DEFAULT, .PRECIOUS) and Order-Only Prerequisites
  9. Directives and Conditionals: include, ifeq/ifneq, and shell evaluation
  10. Remaking Makefiles, Debugging, and Diagnostics
  11. Parallel Execution, Jobserver, and Portability Considerations
  12. Installing, Archiving, and Interaction with Toolchains
  13. Advanced Topics: Custom Functions, Recursive Make, and Integration with Other Build Systems
  14. Appendices: Compatibility Notes, Built-in Rules, and Reference Index

Languages, Platforms & Tools

MakefileShell (sh/bash)CC++AssemblyPython (build helpers/scripts)LinuxEmbedded Linux (Yocto, Buildroot)macOSWindows (MSYS/MinGW/Cygwin)Cross-compilation targets (ARM, ARM64, RISC-V, MIPS)GNU Make (make)GCC/Clang cross-compilersbinutils (ld, ar, objcopy)BuildrootYocto/BitBakeCMake (Makefile generator)GNU Autotools (occasionally interacts with make)

How It Compares

Compared with O'Reilly’s 'Managing Projects with GNU Make' which is more example-driven, Stallman’s GNU Make Reference Manual is the definitive, authoritative specification and reference for GNU Make behaviors and edge cases.

Related Books