Add -d option, so lint can be used safely when we're not building "in

place" (e.g., when DESTDIR is set).  This causes the lint driver to
pass -nostdinc -idirafter <dir> to cpp, causing it to ignore
/usr/include and look somewhere else instead..
This commit is contained in:
sommerfe 1998-03-24 23:25:31 +00:00
parent e31461b53c
commit bf7d5c8de3
2 changed files with 22 additions and 6 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: lint.1,v 1.6 1997/07/10 08:00:58 mikel Exp $
.\" $NetBSD: lint.1,v 1.7 1998/03/24 23:25:31 sommerfe Exp $
.\"
.\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
.\" Copyright (c) 1994, 1995 Jochen Pohl
@ -44,6 +44,7 @@
.Op Fl D Ns Ar name Ns Op =def
.Op Fl U Ns Ar name
.Op Fl I Ns Ar directory
.Op Fl d Ns Ar directory
.Op Fl L Ns Ar directory
.Op Fl l Ns Ar library
.Op Fl o Ns Ar outputfile
@ -53,8 +54,9 @@
.Op Fl s Ns | Ns Fl t
.Fl C Ns Ar library
.Op Fl D Ns Ar name Ns Op =def
.Op Fl I Ns Ar directory
.Op Fl U Ns Ar name
.Op Fl I Ns Ar directory
.Op Fl d Ns Ar directory
.Ar
.Sh DESCRIPTION
.Nm
@ -301,6 +303,10 @@ is defined as 1.
Add
.Ar directory
to the list of directories in which to search for include files.
.It Fl d Ns Ar directory
Use
.Ar directory
instead of /usr/include as the default place to find include files.
.It Fl l Ns Ar library
Include the lint library
.Pa llib-l Ns Ar library Ns Pa \&.ln .

View File

@ -1,4 +1,4 @@
/* $NetBSD: xlint.c,v 1.6 1998/02/22 15:40:41 christos Exp $ */
/* $NetBSD: xlint.c,v 1.7 1998/03/24 23:25:31 sommerfe Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: xlint.c,v 1.6 1998/02/22 15:40:41 christos Exp $");
__RCSID("$NetBSD: xlint.c,v 1.7 1998/03/24 23:25:31 sommerfe Exp $");
#endif
#include <sys/param.h>
@ -96,7 +96,7 @@ static char **libs;
static char **libsrchpath;
/* flags */
static int iflag, oflag, Cflag, sflag, tflag, Fflag;
static int iflag, oflag, Cflag, sflag, tflag, Fflag, dflag;
/* print the commands executed to run the stages of compilation */
static int Vflag;
@ -332,6 +332,7 @@ main(argc, argv)
appcstrg(&cppflags, "-Wcomment");
appcstrg(&cppflags, "-D__NetBSD__");
appcstrg(&cppflags, "-Dlint"); /* XXX don't def. with -s */
appdef(&cppflags, "lint");
appdef(&cppflags, "unix");
@ -363,7 +364,7 @@ main(argc, argv)
argv += optind;
optind = 0;
c = getopt(argc, argv, "abceghil:no:prstuvxzC:D:FHI:L:U:V");
c = getopt(argc, argv, "abcd:eghil:no:prstuvxzC:D:FHI:L:U:V");
switch (c) {
@ -447,6 +448,15 @@ main(argc, argv)
freelst(&deflibs);
break;
case 'd':
if (dflag)
usage();
dflag = 1;
appcstrg(&cppflags, "-nostdinc");
appcstrg(&cppflags, "-idirafter");
appstrg(&cppflags, optarg);
break;
case 'D':
case 'I':
case 'U':