DEP: A Tool for Maintaining Software-Build Dependencies
The process of translating a software system's source files
into an executable file is typically implemented by a tool
named Make. Make reads a makefile, which expresses
dependencies between a software system's files. Make also
examines the time-of-last-modification (TOLM) attribute of
files named in the makefile. As far as Make is concerned,
the makefile is maintained manually. DEP is a tool for
automatically maintaining a makefile.
DEP processes depfiles. The language of depfiles is
a subset of that of makefiles. A depfile contains a textual
description of a set of dependencies, each of which
expresses that a target file depends on a set of
prerequisites. A user is not expected to edit a
depfile. Rather, a depfile allows dependencies computed
during an execution of DEP to be used during the next
execution of DEP.
A set of prerequisites can be partitioned into a
primary file, a set of secondary files,
and a set of preprocessor macros. For example,
target main.obj may have a primary prerequisite of
main.c, secondary prerequisites of a.h and
c.h, and a macro prerequisite of
AnotherOption (defined in opts.h).
DEP performs the following functions:
- It reads old dependencies from an input file.
- It computes new dependencies from:
- the old dependencies
- preprocessor directives contained in C and
- file references in file-inclusion directives
- macro references in conditional-compilation
- macro references in conditional-assembly directives
- macro references contained elsewhere in C files (it
does not recognize macro references contained
elsewhere in assembly-language files)
- It computes that names of files that are inconsistent,
according to macro dependencies. These files can then be
deleted, forcing Make to rebuild them.
- It writes new dependencies to an output depfile.
Make can read a depfile, as part of a makefile.