Managing Projects with Make 2nd Ed.

C Programming Utility

Andrew Oram, Stephen L. Talbott

Publisher: O'Reilly, 1993, 149 pages

ISBN: 0-937175-90-0

Keywords: Programming

Last modified: April 26, 2021, 12:35 a.m.

make is one of UNIX's greatest contribution to software development, and this book is the clearest description of make ever written. Even the smallest software project typically involves a number of files that depend upon each other in various ways. If you modify one or more source files, you must re-link the program after re-compiling some, but not necessarily all, of the sources.

make greatly simplifies this process. By recording the specific relationship between a set of files, make can automatically perform all the necessary updating.

On large projects with teams of programmers and multiple releases, make becomes even more critical. But in order to avoid spending a major portion of your maintenance budget on maintaining the makefiles, you need a system for handling directories, dependencies, and macro definitions. The new edition of this book includes guidelines on meeting the needs of large, modern projects.

Topics covered include:

  • Shell variables
  • Internal macros
  • Suffix rules, including ways to write your own rules
  • Maintaining libraries
  • Invoking make recursively

The new edition of this book is over 50 percent larger than the original. It includes more detailed information on advanced features, as well as guidelines for meeting the needs of large modern projects:

  • Projects covering several directories
  • Maintaining consistency when building variants of a program
  • Automatic generation of header file dependencies
  • Forced rebuilds of existing files
  • A description of free products that contain major enhancements to make
  • Listings of the features that vary between different versions of make and simple ways to test them
  • More detail and examples on common errors, use of the shell in make, formal rules of syntax in make, and support for various utilities

This handbook focuses on the version of make shipped with System V, Release 4, which is a stable product available on most modern UNIX systems. The book also describes some important features in other versions of make.

  • Preface
    • The value of makle
    • Lessons from make
    • Variants
    • Scope of This Book
    • Getting Automated Tests
    • FTP
    • FTPMAIL
    • BITFTP
    • UUCP
    • Conventions Used in This Handbook
    • Acknowledgements
    • We'd Like to Hear From You
  1. How to Write a Simple Makefile
    • The Description File
    • Dependency Checking
    • Minimizing Rebuilds
    • Invoking make
    • Basic Rules of Syntax
  2. Macros
    • Syntax Rules
    • Internally Defined Macros
    • macro Definition on the Command Line
    • Shell Variables
    • Priority of Macro Assignments
    • Relying on Environment Variables for Defaults
    • Macro String Substitution
    • Internal Macros for Prerequisites and Targets
  3. Suffix Rules
    • What is a Suffix Rule?
      • Command Options
      • Internal Macros
    • Commands Supported by Default Suffix Rules
      • Fortran and Pascal
      • SCCS and RCS
      • Libraries (Archives)
      • Using Parentheses for Library Modules
      • A Library Example
      • Maintaining Libraries
      • The Double Colon
      • lex and yacc
      • The Null Suffix
    • How to Display Defaults
      • Generating the Display
      • What the Display Means
    • Writing Your Own Suffix Rules
      • A Sample Collection of Suffix Rules
      • Nullifying Rules
      • Conflicts With Default Suffixes
  4. Commands
    • Filename Patterns Matching
    • Effects of Newlines on Commands
    • Errors and Exit Status
    • Which Shell?
    • Pathnames and Security
  5. Project Management
    • Dummy Targets
    • Recursive make on Directories
    • General Tips on Recursive make
    • Other Techniques for Multiple Directories
      • Directories in Internal Macros
      • Viewpath (VPATH Macro)
    • Compiler Options and #ifdef directives
      • Forcing Remakes
      • Maintaining Multiple Variants Through Explicit Targets
      • Maintaining Multiple Variants in Different Directories
      • Maintaining Variants Through Suffix Rules
    • Header Files
    • Global Definitions (include Statement)
    • Distributed Files and NFS Issues
  6. Command-line Usage and Special Targets
    • Description Filenames
    • Status Information and Debugging
    • Errors and File Deletion
    • The MAKEFLAGS Macro
    • Miscellaneous Features Affecting Defaults
  7. Troubleshooting
    • Debugging a Build (-d Option)
    • Syntax Errors
    • Don't Know How to Make
    • Target Up to Date
    • Command Not Found, or Cannot Load
    • Syntax Errors in Multi-line Commands
    • Inconsistent Lines, or Too Many Lines
    • Unrecognized Macros
    • Default Rules Ignored
  1. Quick-reference
    • Command Line
    • Description File Lines
    • Macros
      • Internal Macros
      • Macro Modifiers
      • Macro String Substitution
      • Macros with Special Handling
    • Special target Names
  2. Popular Extensions
    • mk and nmake
    • GNU make
    • imake
    • makedepend
    • shape
    • Parallel and Distributed Implementations
  3. Features That Differ Between Variants of make
    • Background
    • List of Differences
    • Tests You Can Run
      • Macro String Substitution
      • File and Directory Macros
      • Target name as $$@ on Dependency Lines
      • Parenthesis Syntax for Libraries
      • Single-suffix Rules and .sh Rules
      • Default Shell
      • MAKE and MAKEFLAGS Macros
      • include Statement
      • VPATH

Reviews

Managing Projects with Make

Reviewed by Roland Buresund

Decent ****** (6 out of 10)

Last modified: July 13, 2008, 11:20 a.m.

Updated to cover SVR4 make (still little coverage of GNU make).

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required