minix/man/man1/mkdep.1
2010-02-19 12:32:01 +00:00

82 lines
2 KiB
Groff

.TH MKDEP 1 "February 1st, 2010"
.SH NAME
mkdep \- print dependencies in the Right Way for make(1)
.SH SYNOPSIS
.B mkdep
.I path
.br
.B mkdep
.I pp_command
.IR sourcefile " ... "
.SH DESCRIPTION
.B Mkdep
does what
.B cpp -M
should do, but no compiler gets it right, they all
strip the leading path of the \fI*.o\fP files.
.PP
The first synopsis form just creates the needed
.I .depend
files in all the subdirectories of
.IR path .
.PP
The second synopsis form does the hard work of emitting the
dependencies instructions for
.IR sourcefile
in the right format expected by
.IR make (1),
including the path information.
.PP
.B Mkdep
expects
.I pp_command
to be the correct invocation for the preprocessor
.\" FIXME: there are no cpp(1x) manpage presently...
.\" .IR cpp (1x)
command adequate for
.IR sourcefile ,
and also expects this command to emit lines of the form
.nf
.ta +1i +\w'# lineno "filename"'u+2m
# \fIlineno\fP "\fIfilename\fP"
.fi
for each files which is included by the named
.IR sourcefile .
.PP
For C, the typical idiom is to add in all your
.IR Makefile s:
.PP
.nf
.ta +0.2i +\w'depend:'u+1m +\w'mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend'u+2m
depend:
cd sub1 && $(MAKE) -$(MAKEFLAGS) $@
cd sub2 && $(MAKE) -$(MAKEFLAGS) $@
# repeat for each subdirectory
mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
.PP
.fi
.SH "SEE ALSO"
.BR cc (1),
.BR make (1).
.SH BUGS
Since
.I Makefile
is read in full before any command is executed,
there is no way to prevent
.IR make (1)
to report an error if the
.I .depend
file was not created beforehand; hence the first form of
.IR mkdep
should be used \fBbefore\fP any attempt is done to use this feature in any
.IR Makefile .
.PP
The current version hardcodes the \fI.o\fP suffix, so it cannot be used for e.g.
.IR flex (1)
or
.IR yacc (1)
source files.
.SH AUTHOR
.I Mkdep.c
was written by Kees J. Bot and Jorrit N. Herder.
.\" This manual page by A. Leca.