1.\" $NetBSD: mkdep.1,v 1.18 2013/03/05 01:59:56 christos 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 March 4, 2013 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 aDdiopqv 41.Op Fl f Ar file 42.Op Fl P Ar prefix 43.Op Fl s Ar suffixes 44.Li -- 45.Op Ar flags 46.Ar file ... 47.Sh DESCRIPTION 48.Nm 49takes a set of flags for the C compiler and a list 50of C source files as arguments and constructs a set of include 51file dependencies which are written into the file ``.depend''. 52An example of its use in a Makefile might be: 53.Bd -literal -offset indent 54CFLAGS= -O -I../include 55SRCS= file1.c file2.c 56 57depend: 58 mkdep -- ${CFLAGS} ${SRCS} 59.Ed 60.Pp 61where the macro SRCS is the list of C source files and the macro 62CFLAGS is the list of flags for the C compiler. 63.Pp 64The options are as follows: 65.Bl -tag -width Ds 66.It Fl a 67Append to the output file, 68so that multiple 69.Nm Ns 's 70may be run from a single Makefile. 71.It Fl D 72Post process (as 73.Fl d ) 74but read the list of filenames from stdin. 75.It Fl d 76Post process and merge previously created (for example by 77.Dq cc -MD x.c ) 78depend files into a single file. 79.It Fl f 80Write the include file dependencies to 81.Ar file , 82instead of the default ``.depend''. 83.It Fl i 84When 85.Fl d 86or 87.Fl D 88is used, instead of inlining the contents of the files to the resulting 89depend file, use include statements to include the source dependency files. 90.It Fl o 91Add an additional .OPTIONAL line for each dependent file. 92.It Fl P 93Prepend the string given in 94.Ar prefix 95to every target filename. 96This is useful for programs that have source files in multiple subdirectories 97and a single Makefile that references all of them explicitly (without using 98the VPATH functionality because there can be files with the same name in 99each subdirectory). 100.It Fl p 101Cause 102.Nm 103to produce dependencies of the form: 104.Bd -literal -offset indent 105program: program.c 106.Ed 107.Pp 108so that subsequent makes will produce 109.Ar program 110directly from its C module rather than using an intermediate 111.Pa \&.o 112module. 113This is useful for programs whose source is contained in a single 114module. 115.Fl p 116is equivalent to specifying a null suffix with 117.Fl s . 118.It Fl q 119Do not print a warning for inaccessible files when 120.Fl d 121is given. 122.It Fl s 123Expand each target filename to a list, replacing the 124.Ql \&.o 125suffix with each element of 126.Ar suffixes . 127The list of suffixes may be space or comma separated. 128.It Fl v 129print debugging output. 130.El 131.Sh FILES 132.Bl -tag -width .depend -compact 133.It Pa .depend 134File containing list of dependencies. 135.El 136.Sh SEE ALSO 137.Xr cc 1 , 138.Xr cpp 1 , 139.Xr make 1 140.Sh HISTORY 141The 142.Nm 143command appeared in 144.Bx 4.3 Tahoe . 145.Sh BUGS 146Some characters special to 147.Xr make 1 , 148most notably the comment character, are not escaped correctly if they 149appear in file names. 150This can lead to unparseable output or silently cause dependencies to 151be lost. 152.\" (This problem is actually in gcc -M.) 153