If the -m option is used, make will check for the existence of the

directory specified, and add it to sysIncPath only if it exists.
However, afterwards make tested for the presence of a -m option by
checking to see if sysIncPath was an empty list, and assumed that
the -m option was not used if it was empty. This obviously breaks
if -m specified a non-existent directory. So I have added a flag
that is set if the -m option is used, and I test that instead.
This commit is contained in:
cjs 1997-05-08 05:19:46 +00:00
parent fd9b64b81a
commit 90423c173a

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */
/* $NetBSD: main.c,v 1.35 1997/05/08 05:19:46 cjs Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -48,7 +48,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
static char rcsid[] = "$NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.35 1997/05/08 05:19:46 cjs Exp $";
#endif
#endif /* not lint */
@ -132,6 +132,7 @@ Boolean ignoreErrors; /* -i flag */
Boolean beSilent; /* -s flag */
Boolean oldVars; /* variable substitution style */
Boolean checkEnvFirst; /* -e flag */
Boolean mkIncPath; /* -m flag */
static Boolean jobsRunning; /* TRUE if the jobs might be running */
static void MainParseArgs __P((int, char **));
@ -288,6 +289,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {
Var_Append(MAKEFLAGS, "-k", VAR_GLOBAL);
break;
case 'm':
mkIncPath = TRUE;
Dir_AddDir(sysIncPath, optarg);
Var_Append(MAKEFLAGS, "-m", VAR_GLOBAL);
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
@ -653,7 +655,7 @@ main(argc, argv)
* add the directories from the DEFSYSPATH (more than one may be given
* as dir1:...:dirn) to the system include path.
*/
if (Lst_IsEmpty(sysIncPath)) {
if (!mkIncPath) {
for (start = syspath; *start != '\0'; start = cp) {
for (cp = start; *cp != '\0' && *cp != ':'; cp++)
continue;