Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Add support for .dinclude
details: https://anonhg.NetBSD.org/src/rev/f5c4e6cb3cac
branches: trunk
changeset: 343640:f5c4e6cb3cac
user: sjg <sjg%NetBSD.org@localhost>
date: Thu Feb 18 05:02:49 2016 +0000
description:
Add support for .dinclude
Like .sinclude missing file will be ignored.
Like .depend stale dependencies will be ignored.
Allows better implementation of auto depend.
Reviewed by: christos
Requested by: Bryan Drewery at FreeBSD.
diffstat:
usr.bin/make/make.1 | 12 ++++++++++--
usr.bin/make/parse.c | 19 ++++++++++++-------
2 files changed, 22 insertions(+), 9 deletions(-)
diffs (127 lines):
diff -r 82caa733cded -r f5c4e6cb3cac usr.bin/make/make.1
--- a/usr.bin/make/make.1 Thu Feb 18 05:01:39 2016 +0000
+++ b/usr.bin/make/make.1 Thu Feb 18 05:02:49 2016 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $
+.\" $NetBSD: make.1,v 1.250 2016/02/18 05:02:49 sjg Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
-.Dd June 4, 2015
+.Dd February 17, 2015
.Dt MAKE 1
.Os
.Sh NAME
@@ -1530,12 +1530,20 @@
.Nm
.Ql include file ...
is also accepted.
+.Pp
If the include statement is written as
.Cm .-include
or as
.Cm .sinclude
then errors locating and/or opening include files are ignored.
.Pp
+If the include statement is written as
+.Cm .dinclude
+not only are errors locating and/or opening include files ignored,
+but stale dependencies within the included file will be ignored
+just like
+.Va .MAKE.DEPENDFILE .
+.Pp
Conditional expressions are also preceded by a single dot as the first
character of a line.
The possible conditionals are as follows:
diff -r 82caa733cded -r f5c4e6cb3cac usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Thu Feb 18 05:01:39 2016 +0000
+++ b/usr.bin/make/parse.c Thu Feb 18 05:02:49 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.209 2016/01/17 17:45:21 christos Exp $ */
+/* $NetBSD: parse.c,v 1.210 2016/02/18 05:02:49 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.209 2016/01/17 17:45:21 christos Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.210 2016/02/18 05:02:49 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: parse.c,v 1.209 2016/01/17 17:45:21 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.210 2016/02/18 05:02:49 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -157,6 +157,7 @@
int lineno; /* current line number in file */
int first_lineno; /* line number of start of text */
int cond_depth; /* 'if' nesting when file opened */
+ Boolean depending; /* state of doing_depend on EOF */
char *P_str; /* point to base of string buffer */
char *P_ptr; /* point to next char of string buffer */
char *P_end; /* point to the end of string buffer */
@@ -2139,7 +2140,7 @@
*/
static void
-Parse_include_file(char *file, Boolean isSystem, int silent)
+Parse_include_file(char *file, Boolean isSystem, Boolean depinc, int silent)
{
struct loadedfile *lf;
char *fullname; /* full pathname of file */
@@ -2239,6 +2240,9 @@
/* Start reading from this file next */
Parse_SetInput(fullname, 0, -1, loadedfile_nextbuf, lf);
curFile->lf = lf;
+ curFile->depending = doing_depend; /* restore this on EOF */
+ if (depinc)
+ doing_depend = depinc; /* only turn it on */
}
static void
@@ -2288,7 +2292,7 @@
*/
file = Var_Subst(NULL, file, VAR_CMD, FALSE, TRUE, FALSE);
- Parse_include_file(file, endc == '>', silent);
+ Parse_include_file(file, endc == '>', (*line == 'd'), silent);
free(file);
}
@@ -2532,7 +2536,7 @@
else
done = 1;
- Parse_include_file(file, FALSE, silent);
+ Parse_include_file(file, FALSE, FALSE, silent);
}
free(all_files);
}
@@ -2610,6 +2614,7 @@
assert(curFile->nextbuf != NULL);
+ doing_depend = curFile->depending; /* restore this */
/* get next input buffer, if any */
ptr = curFile->nextbuf(curFile->nextbuf_arg, &len);
curFile->P_ptr = ptr;
@@ -2972,7 +2977,7 @@
continue;
}
if (strncmp(cp, "include", 7) == 0 ||
- ((cp[0] == 's' || cp[0] == '-') &&
+ ((cp[0] == 'd' || cp[0] == 's' || cp[0] == '-') &&
strncmp(&cp[1], "include", 7) == 0)) {
ParseDoInclude(cp);
continue;
Home |
Main Index |
Thread Index |
Old Index