MAKETD(1L) UNIX System V (PUCC) MAKETD(1L)
NAME
maketd - edit a makefile to update transitive dependencies
SYNOPSIS
maketd [-4CabcdfhlnrvVx] [-D define] [-L lib.a] [-I
includedir] [-U undefine] [-j extender] [-m makefile] [-o
dir] [-s suffix] [-t target] [files]
DESCRIPTION
Maketd computes dependencies for targets that are introduced
through the C preprocessor's (cpp) #include directive. The
development of this program resulted from make(1)'s
inability to recognize transitive dependencies. For
example, given the following makefile fragment:
xx.o: xx.c e.h
e.h: struct.h /usr/include/local/const.h
Make will not recognize the target xx.o's dependency on
struct.h. Maketd generates lines like:
xx.o: xx.c e.h struct.h $L/const.h
Thus making the target xx.o not only dependent on all files
that it includes, but also recursively on all files that the
included files include. This is achieved by passing the
source through the C preprocessor (/bin/cc -M).
The directories used in the search for include files are
identical to the ones used by the C compiler because the C
preprocessor is used. This also means that #define's,
#ifdef's, etc., are evaluated. It is necessary to recompute
the dependencies when any source has been changed. The
generated dependencies will be inserted after a line of the
form # DO NOT DELETE... (which will be inserted if maketd
finds the end of file). Everything after this line may be
deleted or changed as maketd edits the makefile (the portion
of the makefile before this line is only examined for
context). If no such line exists, a line of the expected
form will be emitted, followed by the dependencies.
By default maketd will search for the makefile to be edited
in the same way make does; that is by first checking for the
existence of makefile, then Makefile. The -m and -d options
override this default action (below). Before it is edited,
makefile will be saved in makefile.extend (overwriting any
existing file with the same name). This extender on the old
version of makefile may be changed by using the -j option
(below).
OPTIONS
Page 1 (printed 5/23/00)
MAKETD(1L) UNIX System V (PUCC) MAKETD(1L)
Options and arguments may be intermixed on the command line
to modify maketd's behavior on a per file basis.
-4 Use m4(1) as the preprocessor rather than cc(1). This
requires that modifications have been made to m4 and
that this program be compiled with CPP_M defined. Use
maketd-h to check this.
-a Normally, dependencies on files in /usr/include are not
included. This option also includes dependencies on
those files. This option should always be used for
system level makefiles.
-b Generate dependencies for binaries rather than object
files. This is equivalent to specifying a null suffix:
the .o is stripped from the target.
-c Use cc to generate dependencies (rather than m4). This
is the default.
-d Dependencies are written to standard output instead of
editing a makefile. The standard header and trailer, #
DO NOT DELETE... are not printed.
-f Force printing of header and trailer. Normally these
are suppressed when the output file is the standard
output.
-h Only output a usage summary.
-jextender
Specify an extension for the backup makefile, rather
than the default bak extender.
-l Turn off the nonlocal object option, and make all
targets local.
-mmakefile
Instead of editing makefile, makefile is edited.
-n Generate nonlocal object dependency paths. These paths
will match the source paths given.
-odir
Generate nonlocal object dependencies in the specified
dir. This option generates dependencies of the form
dir/a.o: a.c
which is useful for makefiles that produce the objects
in a separate subdirectory. The name of the directory
must not be empty (see -l above).
Page 2 (printed 5/23/00)
MAKETD(1L) UNIX System V (PUCC) MAKETD(1L)-r Replace the dependencies for the target(s) mentioned on
the command line. Do not alter any other dependencies
that may have been in makefile. This option is of
limited use and unlimited misuse: beware.
-ssuffix
Supply a suffix for the target. The suffix should
start with a .. The target file name should have a
suffix of some sort that is delimited by a . that is
replaced by this suffix.
-ttarget
Supply a new basename for the target rather than using
the basename of the source file.
-v Be verbose. Extra output is directed to the standard
error channel.
-V Show which version of maketd is running.
-x Do not shorten include files. The pathnames
/usr/include and /usr/include/sys along with any
pathnames specified with the -I options, are
abbreviated. Unused uppercase single letters are
defined in makefile and used to compress pathnames.
-C Cancel all previous cpp flags (-D, -I, and -U) and
begin a new list. This is useful for generating
dependencies for more than one product with only one
maketd call.
-Ddefine
Specify a cpp (C preprocessor) definition. See cc(1).
for a complete description.
-Iincludedir
Specify a directory for cpp to search for include
files. See cc(1) for a complete description. Note
that includedir is subject to abbreviation unless -x is
given.
-Llib.a
This option produces a dependency that tells make(1)
that the target is part of lib.a.
-Uname
Remove any initial definition of the (C preprocessor)
variable name.
EXAMPLES
A typical application in a makefile might look like:
Page 3 (printed 5/23/00)
MAKETD(1L) UNIX System V (PUCC) MAKETD(1L)
L=/usr/include/local
INCLUDE= -I$L -I../h
CDEFS= -DPUCC -DBSD4_2
CFLAGS= ${DEFS} ${INCLUDE}
SRC= a.c b.c c.c
HDR= a.h b.h c.h
. . .
depend: ${SRC} ${HDR}
maketd-a ${CDEFS} ${INCLUDE} ${SRC}
# DO NOT DELETE THIS LINE - maketd DEPENDS ON IT
a.o: a.c a.h b.h c.h $L/goop.h
b.o: b.c b.h $L/goop.h
c.o: c.c c.h
# *** Do not add anything here - It will go away. ***
BUGS
If a single letter macro name is used but never defined (in
the makefile) maketd might still use it for an abbreviation
name. This should not effect the makefile as all the
dependencies and the redefinition of the macro will follow
the users last usage of it. This happens in DYNIX makefiles
that use P to indicate that parallel compilation should be
used. We suggest that Makefiles which use this trick put a
P=
in the Makefile (above the all target) to keep maketd from
using the macro P; the command line definition of P="&" will
override the Makefile's definition.
Some more path compression could be done.
AUTHORS
Stephan Bechtolsheim (a shell script), Purdue CS
Stephen Uitti (a C version), Purdue CC
Craig Norborg (m4 modifications), Purdue CC
Kevin Braunsdorf (intermix options), Purdue CC
SEE ALSO
make(1), cc(1), m4(1)
Page 4 (printed 5/23/00)