1.\" $NetBSD: mkdep.1,v 1.15 2010/10/15 05:46:48 dholland Exp $ 2.\" 3.\" Copyright (c) 1987, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)mkdep.1 8.1 (Berkeley) 6/6/93 31.\" 32.Dd October 15, 2010 33.Dt MKDEP 1 34.Os 35.Sh NAME 36.Nm mkdep 37.Nd construct Makefile dependency list 38.Sh SYNOPSIS 39.Nm 40.Op Fl aDdopq 41.Op Fl f Ar file 42.Op Fl s Ar suffixes 43.Li -- 44.Op Ar flags 45.Ar file ... 46.Sh DESCRIPTION 47.Nm 48takes a set of flags for the C compiler and a list 49of C source files as arguments and constructs a set of include 50file dependencies which are written into the file ``.depend''. 51An example of its use in a Makefile might be: 52.Bd -literal -offset indent 53CFLAGS= -O -I../include 54SRCS= file1.c file2.c 55 56depend: 57 mkdep -- ${CFLAGS} ${SRCS} 58.Ed 59.Pp 60where the macro SRCS is the list of C source files and the macro 61CFLAGS is the list of flags for the C compiler. 62.Pp 63The options are as follows: 64.Bl -tag -width Ds 65.It Fl a 66Append to the output file, 67so that multiple 68.Nm Ns 's 69may be run from a single Makefile. 70.It Fl D 71Post process (as 72.Fl d ) 73but read the list of filenames from stdin. 74.It Fl d 75Post process and merge previously created (for example by 76.Dq cc -MD x.c ) 77depend files into a single file. 78.It Fl f 79Write the include file dependencies to 80.Ar file , 81instead of the default ``.depend''. 82.It Fl o 83Add an additional .OPTIONAL line for each dependant file. 84.It Fl p 85Cause 86.Nm 87to produce dependencies of the form: 88.Bd -literal -offset indent 89program: program.c 90.Ed 91.Pp 92so that subsequent makes will produce 93.Ar program 94directly from its C module rather than using an intermediate 95.Pa \&.o 96module. 97This is useful for programs whose source is contained in a single 98module. 99.Fl p 100is equivalent to specifying a null suffix with 101.Fl s . 102.It Fl q 103Do not print a warning for inaccessible files when 104.Fl d 105is given. 106.It Fl s 107Expand each target filename to a list, replacing the 108.Ql \&.o 109suffix with each element of 110.Ar suffixes . 111The list of suffixes may be space or comma separated. 112.El 113.Sh FILES 114.Bl -tag -width .depend -compact 115.It Pa .depend 116File containing list of dependencies. 117.El 118.Sh SEE ALSO 119.Xr cc 1 , 120.Xr cpp 1 , 121.Xr make 1 122.Sh HISTORY 123The 124.Nm 125command appeared in 126.Bx 4.3 Tahoe . 127.Sh BUGS 128Some characters special to 129.Xr make 1 , 130most notably the comment character, are not escaped correctly if they 131appear in file names. 132This can lead to unparseable output or silently cause dependencies to 133be lost. 134.\" (This problem is actually in gcc -M.) 135