Remove -n for ignoring system headers. Instead add finer grain shell
macros and document them. Prompted by: bde
This commit is contained in:
parent
84e77be3da
commit
3e147c2c70
@ -39,7 +39,7 @@
|
||||
.Nd construct Makefile dependency list
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl anp
|
||||
.Op Fl ap
|
||||
.Op Fl f Ar file
|
||||
.Op Ar flags
|
||||
.Ar file ...
|
||||
@ -60,6 +60,15 @@ depend:
|
||||
where the macro SRCS is the list of C source files and the macro
|
||||
CFLAGS is the list of flags for the C compiler.
|
||||
.Pp
|
||||
The user has the ability to change the preprocessor and preprocessor options
|
||||
used. For instance, to use Gcc as the preprocessor and to ignore system
|
||||
headers, one would use
|
||||
.Bd -literal -offset indent
|
||||
depend:
|
||||
env MKDEP_CPP="gcc -E" MKDEP_CPP_OPTS=-MM mkdep \\
|
||||
${CFLAGS} ${SRCS}
|
||||
.Ed
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl a
|
||||
@ -71,8 +80,6 @@ may be run from a single Makefile.
|
||||
Write the include file dependencies to
|
||||
.Ar file ,
|
||||
instead of the default ``.depend''.
|
||||
.It Fl n
|
||||
Don't make dependencies on system headers. I.e. anything in <>'s.
|
||||
.It Fl p
|
||||
Cause
|
||||
.Nm
|
||||
@ -88,6 +95,16 @@ directly from its C module rather than using an intermediate
|
||||
module.
|
||||
This is useful for programs whose source is contained in a single
|
||||
module.
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width MKDEP_CPP_OPTS
|
||||
.It Ev CC
|
||||
Specifies the C compiler to use. The specified compiler is expected to have
|
||||
options consistant with the Gnu C compiler.
|
||||
.It Ev MKDEP_CPP
|
||||
Specifies the preprocessor to use. The default is "${CC} -E".
|
||||
.It Ev MKDEP_CPP_OPTS
|
||||
Specifie the non-CFLAGS options for the preprocessor. The default is
|
||||
"-M".
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr cc 1 ,
|
||||
|
@ -32,11 +32,10 @@
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93
|
||||
# $Id: mkdep.gcc.sh,v 1.15 1998/08/29 07:55:55 obrien Exp $
|
||||
# $Id: mkdep.gcc.sh,v 1.14 1998/08/24 10:16:39 cracauer Exp $
|
||||
|
||||
D=.depend # default dependency file is .depend
|
||||
append=0
|
||||
nosyshdrs=0
|
||||
pflag=
|
||||
|
||||
while :
|
||||
@ -51,11 +50,6 @@ while :
|
||||
D=$2
|
||||
shift; shift ;;
|
||||
|
||||
# -n does not make dependencies on system headers
|
||||
-n)
|
||||
nosyshdrs=1
|
||||
shift ;;
|
||||
|
||||
# the -p flag produces "program: program.c" style dependencies
|
||||
# so .o's don't get produced
|
||||
-p)
|
||||
@ -78,16 +72,13 @@ trap 'rm -f $TMP' 0
|
||||
# For C sources, mkdep must use exactly the same cpp and predefined flags
|
||||
# as the compiler would. This is easily arranged by letting the compiler
|
||||
# pick the cpp. mkdep must be told the cpp to use for exceptional cases.
|
||||
MKDEP_CPP=${MKDEP_CPP-"cc -E"}
|
||||
|
||||
case $nosyshdrs in
|
||||
0) CC_MKDEP_OPT="-M";;
|
||||
*) CC_MKDEP_OPT="-MM -w";;
|
||||
esac
|
||||
CC=${CC-"cc"}
|
||||
MKDEP_CPP=${MKDEP_CPP-"${CC} -E"}
|
||||
MKDEP_CPP_OPTS=${MKDEP_CPP_OPTS-"-M"};
|
||||
|
||||
echo "# $@" > $TMP # store arguments for debugging
|
||||
|
||||
if $MKDEP_CPP $CC_MKDEP_OPT "$@" >> $TMP; then :
|
||||
if $MKDEP_CPP $MKDEP_CPP_OPTS "$@" >> $TMP; then :
|
||||
else
|
||||
echo 'mkdep: compile failed' >&2
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user