make-common

Overview

make-common provides a common set of functionality for building projects. It is composed of a single makefile that you include in the main Makefile for your package.

Helpful Targets

  • make: should build any binaries and library files for the package
  • make deb: produce a deb package
  • make debinstall: produce a deb package and install it on the local machine
  • RHOST=$FOO make debinstall: produce a deb package and install it on the local machine and on host $FOO

Features

* Nonrecursive => FAST!
* automatic generation of deb packages!
* automatic dependency generation
* convenience functions to generate library and binary linking targets
* automatic targets to install binaries, libraries, headers, explicitly named files directly or via stow
* Initial portability tests of GNU/Linux and Darwin/MacOSX.

Problems Solved

* Building a new package with minimal effort
* Building a package fast

Problems Not Solved

* Building on win32
* Building using non-GNU make

Usage

`apt-get install make-common' after adding our local apt repo. Look at the examples in SVN, the README, or any of the various packages that already use it, such as ach and genmsg.

Quirks

Warnings

By default, make-common will enable just about every possible compiler warning. This is based on the (most-often true) assumption that you will waste less time fixing spurious warnings that you would chasing down a bug that a compiler warning could have caught.

Generated Headers

If you have a generated header file that is a dependency for building some source file, gcc -- when auto-generating dependencies -- will not recognize that the header is a dependency if it does not exist. Thus, for generated headers, you probably have to specify the dependencies manually.

External Links

* GNU Make Manual
* Recursive Make Considered Harmful (rationale for design of make-common and reason why other build systems suck)