xref: /minix3/usr.bin/mkdep/mkdep.1 (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc.\"	$NetBSD: mkdep.1,v 1.18 2013/03/05 01:59:56 christos Exp $
206617e7fSArun Thomas.\"
306617e7fSArun Thomas.\" Copyright (c) 1987, 1990, 1993
406617e7fSArun Thomas.\"	The Regents of the University of California.  All rights reserved.
506617e7fSArun Thomas.\"
606617e7fSArun Thomas.\" Redistribution and use in source and binary forms, with or without
706617e7fSArun Thomas.\" modification, are permitted provided that the following conditions
806617e7fSArun Thomas.\" are met:
906617e7fSArun Thomas.\" 1. Redistributions of source code must retain the above copyright
1006617e7fSArun Thomas.\"    notice, this list of conditions and the following disclaimer.
1106617e7fSArun Thomas.\" 2. Redistributions in binary form must reproduce the above copyright
1206617e7fSArun Thomas.\"    notice, this list of conditions and the following disclaimer in the
1306617e7fSArun Thomas.\"    documentation and/or other materials provided with the distribution.
1406617e7fSArun Thomas.\" 3. Neither the name of the University nor the names of its contributors
1506617e7fSArun Thomas.\"    may be used to endorse or promote products derived from this software
1606617e7fSArun Thomas.\"    without specific prior written permission.
1706617e7fSArun Thomas.\"
1806617e7fSArun Thomas.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1906617e7fSArun Thomas.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2006617e7fSArun Thomas.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2106617e7fSArun Thomas.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2206617e7fSArun Thomas.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2306617e7fSArun Thomas.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2406617e7fSArun Thomas.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2506617e7fSArun Thomas.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2606617e7fSArun Thomas.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2706617e7fSArun Thomas.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2806617e7fSArun Thomas.\" SUCH DAMAGE.
2906617e7fSArun Thomas.\"
3006617e7fSArun Thomas.\"     @(#)mkdep.1	8.1 (Berkeley) 6/6/93
3106617e7fSArun Thomas.\"
32*84d9c625SLionel Sambuc.Dd March 4, 2013
3306617e7fSArun Thomas.Dt MKDEP 1
3406617e7fSArun Thomas.Os
3506617e7fSArun Thomas.Sh NAME
3606617e7fSArun Thomas.Nm mkdep
3706617e7fSArun Thomas.Nd construct Makefile dependency list
3806617e7fSArun Thomas.Sh SYNOPSIS
3906617e7fSArun Thomas.Nm
40*84d9c625SLionel Sambuc.Op Fl aDdiopqv
4106617e7fSArun Thomas.Op Fl f Ar file
42*84d9c625SLionel Sambuc.Op Fl P Ar prefix
4306617e7fSArun Thomas.Op Fl s Ar suffixes
4406617e7fSArun Thomas.Li --
4506617e7fSArun Thomas.Op Ar flags
4606617e7fSArun Thomas.Ar file ...
4706617e7fSArun Thomas.Sh DESCRIPTION
4806617e7fSArun Thomas.Nm
4906617e7fSArun Thomastakes a set of flags for the C compiler and a list
5006617e7fSArun Thomasof C source files as arguments and constructs a set of include
5106617e7fSArun Thomasfile dependencies which are written into the file ``.depend''.
5206617e7fSArun ThomasAn example of its use in a Makefile might be:
5306617e7fSArun Thomas.Bd -literal -offset indent
5406617e7fSArun ThomasCFLAGS= -O -I../include
5506617e7fSArun ThomasSRCS= file1.c file2.c
5606617e7fSArun Thomas
5706617e7fSArun Thomasdepend:
5806617e7fSArun Thomas	mkdep -- ${CFLAGS} ${SRCS}
5906617e7fSArun Thomas.Ed
6006617e7fSArun Thomas.Pp
6106617e7fSArun Thomaswhere the macro SRCS is the list of C source files and the macro
6206617e7fSArun ThomasCFLAGS is the list of flags for the C compiler.
6306617e7fSArun Thomas.Pp
6406617e7fSArun ThomasThe options are as follows:
6506617e7fSArun Thomas.Bl -tag -width Ds
6606617e7fSArun Thomas.It Fl a
6706617e7fSArun ThomasAppend to the output file,
6806617e7fSArun Thomasso that multiple
6906617e7fSArun Thomas.Nm Ns 's
7006617e7fSArun Thomasmay be run from a single Makefile.
7106617e7fSArun Thomas.It Fl D
7206617e7fSArun ThomasPost process (as
7306617e7fSArun Thomas.Fl d )
7406617e7fSArun Thomasbut read the list of filenames from stdin.
7506617e7fSArun Thomas.It Fl d
7606617e7fSArun ThomasPost process and merge previously created (for example by
7706617e7fSArun Thomas.Dq cc -MD x.c )
7806617e7fSArun Thomasdepend files into a single file.
7906617e7fSArun Thomas.It Fl f
8006617e7fSArun ThomasWrite the include file dependencies to
8106617e7fSArun Thomas.Ar file ,
8206617e7fSArun Thomasinstead of the default ``.depend''.
83*84d9c625SLionel Sambuc.It Fl i
84*84d9c625SLionel SambucWhen
85*84d9c625SLionel Sambuc.Fl d
86*84d9c625SLionel Sambucor
87*84d9c625SLionel Sambuc.Fl D
88*84d9c625SLionel Sambucis used, instead of inlining the contents of the files to the resulting
89*84d9c625SLionel Sambucdepend file, use include statements to include the source dependency files.
9006617e7fSArun Thomas.It Fl o
91*84d9c625SLionel SambucAdd an additional .OPTIONAL line for each dependent file.
92*84d9c625SLionel Sambuc.It Fl P
93*84d9c625SLionel SambucPrepend the string given in
94*84d9c625SLionel Sambuc.Ar prefix
95*84d9c625SLionel Sambucto every target filename.
96*84d9c625SLionel SambucThis is useful for programs that have source files in multiple subdirectories
97*84d9c625SLionel Sambucand a single Makefile that references all of them explicitly (without using
98*84d9c625SLionel Sambucthe VPATH functionality because there can be files with the same name in
99*84d9c625SLionel Sambuceach subdirectory).
10006617e7fSArun Thomas.It Fl p
10106617e7fSArun ThomasCause
10206617e7fSArun Thomas.Nm
10306617e7fSArun Thomasto produce dependencies of the form:
10406617e7fSArun Thomas.Bd -literal -offset indent
10506617e7fSArun Thomasprogram: program.c
10606617e7fSArun Thomas.Ed
10706617e7fSArun Thomas.Pp
10806617e7fSArun Thomasso that subsequent makes will produce
10906617e7fSArun Thomas.Ar program
11006617e7fSArun Thomasdirectly from its C module rather than using an intermediate
11106617e7fSArun Thomas.Pa \&.o
11206617e7fSArun Thomasmodule.
11306617e7fSArun ThomasThis is useful for programs whose source is contained in a single
11406617e7fSArun Thomasmodule.
11506617e7fSArun Thomas.Fl p
11606617e7fSArun Thomasis equivalent to specifying a null suffix with
11706617e7fSArun Thomas.Fl s .
11806617e7fSArun Thomas.It Fl q
11906617e7fSArun ThomasDo not print a warning for inaccessible files when
12006617e7fSArun Thomas.Fl d
12106617e7fSArun Thomasis given.
12206617e7fSArun Thomas.It Fl s
12306617e7fSArun ThomasExpand each target filename to a list, replacing the
12406617e7fSArun Thomas.Ql \&.o
12506617e7fSArun Thomassuffix with each element of
12606617e7fSArun Thomas.Ar suffixes .
12706617e7fSArun ThomasThe list of suffixes may be space or comma separated.
128*84d9c625SLionel Sambuc.It Fl v
129*84d9c625SLionel Sambucprint debugging output.
13006617e7fSArun Thomas.El
13106617e7fSArun Thomas.Sh FILES
13206617e7fSArun Thomas.Bl -tag -width .depend -compact
13306617e7fSArun Thomas.It Pa .depend
13406617e7fSArun ThomasFile containing list of dependencies.
13506617e7fSArun Thomas.El
13606617e7fSArun Thomas.Sh SEE ALSO
13706617e7fSArun Thomas.Xr cc 1 ,
13806617e7fSArun Thomas.Xr cpp 1 ,
13906617e7fSArun Thomas.Xr make 1
14006617e7fSArun Thomas.Sh HISTORY
14106617e7fSArun ThomasThe
14206617e7fSArun Thomas.Nm
14306617e7fSArun Thomascommand appeared in
14406617e7fSArun Thomas.Bx 4.3 Tahoe .
14506617e7fSArun Thomas.Sh BUGS
14606617e7fSArun ThomasSome characters special to
14706617e7fSArun Thomas.Xr make 1 ,
14806617e7fSArun Thomasmost notably the comment character, are not escaped correctly if they
14906617e7fSArun Thomasappear in file names.
15006617e7fSArun ThomasThis can lead to unparseable output or silently cause dependencies to
15106617e7fSArun Thomasbe lost.
15206617e7fSArun Thomas.\" (This problem is actually in gcc -M.)
153