Fix PR/2118; apply sysincludes patch.

This commit is contained in:
christos 1996-03-06 00:15:17 +00:00
parent 1b4f4ed21d
commit 9779dee0b1
6 changed files with 85 additions and 42 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: tutorial.ms,v 1.2 1995/06/14 15:20:31 christos Exp $
.\" $NetBSD: tutorial.ms,v 1.3 1996/03/06 00:15:31 christos Exp $
.\" Copyright (c) 1988, 1989 by Adam de Boor
.\" Copyright (c) 1989 by Berkeley Softworks
.\" Copyright (c) 1988, 1989, 1993
@ -1271,6 +1271,15 @@ administrator. If locking is on,
will turn it off, and vice versa. Note that this locking will not
prevent \fIyou\fP from invoking PMake twice in the same place \*- if
you own the lock file, PMake will warn you about it but continue to execute.
.IP "\fB\-m\fP \fIdirectory\fP"
.Ix 0 def flags -m
Tells PMake another place to search for included makefiles via the <...>
style. Several
.B \-m
options can be given to form a search path. If this construct is used the
default system makefile search path is completely overridden.
To be explained in chapter 3, section 3.2.
.Rm 2 3.2
.IP \fB\-n\fP
.Ix 0 def flags -n
This flag tells PMake not to execute the commands needed to update the
@ -1911,11 +1920,15 @@ or this
.DE
The difference between the two is where PMake searches for the file:
the first way, PMake will look for
the file only in the system makefile directory (to find out what that
directory is, give PMake the
the file only in the system makefile directory (or directories)
(to find out what that directory is, give PMake the
.B \-h
flag).
.Ix 0 ref flags -h
The system makefile directory search path can be overridden via the
.B \-m
option.
.Ix 0 ref flags -m
For files in double-quotes, the search is more complex:
.RS
.IP 1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.24 1996/02/04 22:20:49 christos Exp $ */
/* $NetBSD: main.c,v 1.25 1996/03/06 00:15:17 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -48,7 +48,7 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 5.25 (Berkeley) 4/1/91";
#else
static char rcsid[] = "$NetBSD: main.c,v 1.24 1996/02/04 22:20:49 christos Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.25 1996/03/06 00:15:17 christos Exp $";
#endif
#endif /* not lint */
@ -161,9 +161,9 @@ MainParseArgs(argc, argv)
optind = 1; /* since we're called more than once */
#ifdef REMOTE
# define OPTFLAGS "BD:I:L:PSd:ef:ij:knqrst"
# define OPTFLAGS "BD:I:L:PSd:ef:ij:km:nqrst"
#else
# define OPTFLAGS "BD:I:PSd:ef:ij:knqrst"
# define OPTFLAGS "BD:I:PSd:ef:ij:km:nqrst"
#endif
rearg: while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {
switch(c) {
@ -274,6 +274,11 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {
keepgoing = TRUE;
Var_Append(MAKEFLAGS, "-k", VAR_GLOBAL);
break;
case 'm':
Dir_AddDir(sysIncPath, optarg);
Var_Append(MAKEFLAGS, "-m", VAR_GLOBAL);
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
break;
case 'n':
noExecute = TRUE;
Var_Append(MAKEFLAGS, "-n", VAR_GLOBAL);
@ -396,6 +401,10 @@ main(argc, argv)
char cdpath[MAXPATHLEN + 1];
struct utsname utsname;
char *machine = getenv("MACHINE");
Lst sysMkPath; /* Path of sys.mk */
char *cp = NULL, *start;
/* avoid faults on read-only strings */
static char syspath[] = _PATH_DEFSYSPATH;
#ifdef RLIMIT_NOFILE
/*
@ -598,13 +607,41 @@ main(argc, argv)
} else
Var_Set(".TARGETS", "", VAR_GLOBAL);
/*
* Read in the built-in rules first, followed by the specified makefile,
* if it was (makefile != (char *) NULL), or the default Makefile and
* makefile, in that order, if it wasn't.
* If no user-supplied system path was given (through the -m option)
* add the directories from the DEFSYSPATH (more than one may be given
* as dir1:...:dirn) to the system include path.
*/
if (!noBuiltins && !ReadMakefile(_PATH_DEFSYSMK))
Fatal("make: no system rules (%s).", _PATH_DEFSYSMK);
if (Lst_IsEmpty(sysIncPath)) {
for (start = syspath; *start != '\0'; start = cp) {
for (cp = start; *cp != '\0' && *cp != ':'; cp++)
continue;
if (*cp == '\0') {
Dir_AddDir(sysIncPath, start);
} else {
*cp++ = '\0';
Dir_AddDir(sysIncPath, start);
}
}
}
/*
* Read in the built-in rules first, followed by the specified
* makefile, if it was (makefile != (char *) NULL), or the default
* Makefile and makefile, in that order, if it wasn't.
*/
if (!noBuiltins) {
LstNode ln;
sysMkPath = Lst_Init (FALSE);
Dir_Expand (_PATH_DEFSYSMK, sysIncPath, sysMkPath);
if (Lst_IsEmpty(sysMkPath))
Fatal("make: no system rules (%s).", _PATH_DEFSYSMK);
ln = Lst_Find(sysMkPath, (ClientData)NULL, ReadMakefile);
if (ln != NILLNODE)
Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
}
if (!Lst_IsEmpty(makefiles)) {
LstNode ln;
@ -742,7 +779,7 @@ static Boolean
ReadMakefile(fname)
char *fname; /* makefile to read */
{
extern Lst parseIncPath, sysIncPath;
extern Lst parseIncPath;
FILE *stream;
char *name, path[MAXPATHLEN + 1];
@ -987,7 +1024,7 @@ usage()
{
(void)fprintf(stderr,
"usage: make [-eiknqrst] [-D variable] [-d flags] [-f makefile ]\n\
[-I directory] [-j max_jobs] [variable=value]\n");
[-I directory] [-j max_jobs] [-m directory] [variable=value]\n");
exit(2);
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.12 1995/12/16 05:03:09 christos Exp $
.\" $NetBSD: make.1,v 1.13 1996/03/06 00:15:20 christos Exp $
.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
@ -47,6 +47,7 @@
.Op Fl I Ar directory
.Bk -words
.Op Fl j Ar max_jobs
.Op Fl m Ar directory
.Ek
.Op Ar variable=value
.Op Ar target ...
@ -130,8 +131,9 @@ standard input is read.
Multiple makefile's may be specified, and are read in the order specified.
.It Fl I Ar directory
Specify a directory in which to search for makefiles and included makefiles.
The system makefile directory is automatically included as part of this
list.
The system makefile directory (or directories, see the
.Fl m
option) is automatically included as part of this list.
.It Fl i
Ignore non-zero exit of shell commands in the makefile.
Equivalent to specifying
@ -146,6 +148,14 @@ flag is also specified.
.It Fl k
Continue processing after errors are encountered, but only on those targets
that do not depend on the target whose creation caused the error.
.It Fl m Ar directory
Specify a directory in which to search for sys.mk and makefiles included
via the <...> style. Multiple directories can be added to form a search path.
This path will override the default system include path: /usr/share/mk.
Furthermore the system include path will be appended to the search path used
for "..."-style inclusions (see the
.Fl I
option).
.It Fl n
Display the commands that would have been executed, but do not actually
execute them.

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.8 1996/02/04 22:20:53 christos Exp $ */
/* $NetBSD: make.h,v 1.9 1996/03/06 00:15:21 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -326,6 +326,8 @@ extern time_t now; /* The time at the start of this whole
extern Boolean oldVars; /* Do old-style variable substitution */
extern Lst sysIncPath; /* The system include path. */
/*
* debug control:
* There is one bit per module. It is up to the module what debug

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.20 1996/02/17 13:28:09 christos Exp $ */
/* $NetBSD: parse.c,v 1.21 1996/03/06 00:15:23 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 5.18 (Berkeley) 2/19/91";
#else
static char rcsid[] = "$NetBSD: parse.c,v 1.20 1996/02/17 13:28:09 christos Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.21 1996/03/06 00:15:23 christos Exp $";
#endif
#endif /* not lint */
@ -2645,30 +2645,11 @@ Parse_File(name, stream)
void
Parse_Init ()
{
char *cp = NULL, *start;
/* avoid faults on read-only strings */
static char syspath[] = _PATH_DEFSYSPATH;
mainNode = NILGNODE;
parseIncPath = Lst_Init (FALSE);
sysIncPath = Lst_Init (FALSE);
includes = Lst_Init (FALSE);
targCmds = Lst_Init (FALSE);
/*
* Add the directories from the DEFSYSPATH (more than one may be given
* as dir1:...:dirn) to the system include path.
*/
for (start = syspath; *start != '\0'; start = cp) {
for (cp = start; *cp != '\0' && *cp != ':'; cp++)
continue;
if (*cp == '\0') {
Dir_AddDir(sysIncPath, start);
} else {
*cp++ = '\0';
Dir_AddDir(sysIncPath, start);
}
}
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: pathnames.h,v 1.3 1995/06/14 15:19:52 christos Exp $ */
/* $NetBSD: pathnames.h,v 1.4 1996/03/06 00:15:26 christos Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@ -33,10 +33,10 @@
* SUCH DAMAGE.
*
* from: @(#)pathnames.h 5.2 (Berkeley) 6/1/90
* $Id: pathnames.h,v 1.3 1995/06/14 15:19:52 christos Exp $
* $Id: pathnames.h,v 1.4 1996/03/06 00:15:26 christos Exp $
*/
#define _PATH_OBJDIR "obj"
#define _PATH_DEFSHELLDIR "/bin"
#define _PATH_DEFSYSMK "/usr/share/mk/sys.mk"
#define _PATH_DEFSYSMK "sys.mk"
#define _PATH_DEFSYSPATH "/usr/share/mk"