MAKEDEPEND(1) MAKEDEPEND(1)
NAME
makedepend - create dependencies in makefiles
SYNOPSIS
makedepend [-Dname=def] [-Dname] [-Iincludedir]
[-fmakefile] [-oobjsuffix] [-sstring] [-wwidth ]
sourcefile ...
DESCRIPTION
makedepend reads each sourcefile in sequence and parses
it like a C preprocessor, processing all #include,
#define, #undef, #ifdef, #ifndef, #endif, #if, and
#else directives so that it can correctly tell which
#include directives would be used in a compilation.
Any #include directives can reference files having
other #include directives, and parsing will occur in
these files as well.
Every file that a sourcefile includes, directly or
indirectly, is what makedepend calls a dependency.
These dependencies are then written to a makefile in
such a way that make(1) will know which object files
must be recompiled when a dependency has changed.
By default, makedepend places its output in the file
named makefile, if it exists, otherwise Makefile. An
alternate makefile may be specified with the -f option.
It first searches the makefile for the following line:
# DO NOT DELETE THIS LINE -- make depend depends on
it.
or one provided with the -s option, as a delimiter for
the dependency output. If makedepend finds this line,
it will delete everything from that line to the end of
the makefile and put its own output after this line.
If makedepend does not find this line, it will default
or append the specified string to the end of the
makefile and place its output following that. For each
sourcefile appearing on the command line, makedepend
puts lines in the makefile of the form:
sourcefile.o :dfile ...
Where sourcefile.o is the name from the command line
with its suffix replaced with .o, and dfile is a
dependency discovered in a #include directive while
parsing sourcefile or one of the files sourcefile
included.
- 1 -
MAKEDEPEND(1) MAKEDEPEND(1)
EXAMPLE
Normally, makedepend is used in a makefile target so
that typing make depend will bring the dependencies up
to date for the makefile. For example:
SRCS = file1.c file2.c
CFLAGS = -O -DHACK -I../foobar -xyz
depend:
makedepend $(CFLAGS) $(SRCS)
OPTIONS
makedepend will ignore any option that it does not
understand so that you may use the same arguments that
you would for cc(1).
-Dname=def or -Dname
Define. This places a definition for name in
makedepend's symbol table. Without =def the symbol
becomes defined as 1.
-Iincludedir
Include directory. This option tells makedepend to
prepend includedir to its list of directories to
search when it encounters a #include directive. By
default, makedepend only searches /usr/include.
-fmakefile
Filename. This allows you to specify an alternate
makefile in which makedepend can place its output.
-oobjsuffix
Object file suffix. Some systems may have object
files whose suffix is something other than .o.
This option allows you to specify another suffix,
such as .b with -o.b or :obj with -o:obj.
-sstring
Starting string delimiter. This option permits you
to specify a different string for makedepend to
look for in the makefile.
-wwidth
Line width. Normally, makedepend ensures that
every output line it writes is no wider than 78
characters, for the sake of readability. This
option enables you to change this width.
SEE ALSO
cc(1), make(1)
AUTHOR
Todd Brunhoff, Tektronix, Inc. and MIT Project Athena
- 2 -