Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Refine the effect of .OODATE on command compari...
details: https://anonhg.NetBSD.org/src/rev/3ee8cb7623bd
branches: trunk
changeset: 785822:3ee8cb7623bd
user: sjg <sjg%NetBSD.org@localhost>
date: Sun Mar 31 05:49:51 2013 +0000
description:
Refine the effect of .OODATE on command comparison.
Rather than apply it to the whole script, just the current command line
is affected. This allows a trick like ${.OODATE:M.NOMETA_CMP}
to cause command comparison to be supressed for one command only.
diffstat:
usr.bin/make/make.1 | 18 ++++++++++++++++--
usr.bin/make/meta.c | 26 ++++++++++++++------------
2 files changed, 30 insertions(+), 14 deletions(-)
diffs (87 lines):
diff -r 93db3f20fdd8 -r 3ee8cb7623bd usr.bin/make/make.1
--- a/usr.bin/make/make.1 Sat Mar 30 19:05:20 2013 +0000
+++ b/usr.bin/make/make.1 Sun Mar 31 05:49:51 2013 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.212 2013/03/23 05:31:29 sjg Exp $
+.\" $NetBSD: make.1,v 1.213 2013/03/31 05:49:51 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 March 22, 2013
+.Dd March 30, 2013
.Dt MAKE 1
.Os
.Sh NAME
@@ -1764,6 +1764,20 @@
Ignore differences in commands when deciding if target is out of date.
This is useful if the command contains a value which always changes.
If the number of commands change, though, the target will still be out of date.
+The same effect applies to any command line that uses the variable
+.Va .OODATE ,
+which can be used for that purpose even when not otherwise needed or desired:
+.Bd -literal -offset indent
+
+skip-compare-for-some:
+ @echo this will be compared
+ @echo this will not ${.OODATE:M.NOMETA_CMP}
+ @echo this will also be compared
+
+.Ed
+The
+.Cm \&:M
+pattern suppresses any expansion of the unwanted variable.
.It Ic .NOPATH
Do not search for the target in the directories specified by
.Ic .PATH .
diff -r 93db3f20fdd8 -r 3ee8cb7623bd usr.bin/make/meta.c
--- a/usr.bin/make/meta.c Sat Mar 30 19:05:20 2013 +0000
+++ b/usr.bin/make/meta.c Sun Mar 31 05:49:51 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.28 2013/03/23 23:39:47 sjg Exp $ */
+/* $NetBSD: meta.c,v 1.29 2013/03/31 05:49:51 sjg Exp $ */
/*
* Implement 'meta' mode.
@@ -1213,17 +1213,19 @@
oodate = TRUE;
} else {
char *cmd = (char *)Lst_Datum(ln);
+ Boolean hasOODATE = FALSE;
- if (!needOODATE) {
- if (strstr(cmd, "$?"))
- needOODATE = TRUE;
- else if ((cp = strstr(cmd, ".OODATE"))) {
- /* check for $[{(].OODATE[)}] */
- if (cp > cmd + 2 && cp[-2] == '$')
- needOODATE = TRUE;
- }
- if (needOODATE && DEBUG(META))
- fprintf(debug_file, "%s: %d: cannot compare commands using .OODATE\n", fname, lineno);
+ if (strstr(cmd, "$?"))
+ hasOODATE = TRUE;
+ else if ((cp = strstr(cmd, ".OODATE"))) {
+ /* check for $[{(].OODATE[:)}] */
+ if (cp > cmd + 2 && cp[-2] == '$')
+ hasOODATE = TRUE;
+ }
+ if (hasOODATE) {
+ needOODATE = TRUE;
+ if (DEBUG(META))
+ fprintf(debug_file, "%s: %d: cannot compare command using .OODATE\n", fname, lineno);
}
cmd = Var_Subst(NULL, cmd, gn, TRUE);
@@ -1252,7 +1254,7 @@
if (buf[x - 1] == '\n')
buf[x - 1] = '\0';
}
- if (!needOODATE &&
+ if (!hasOODATE &&
!(gn->type & OP_NOMETA_CMP) &&
strcmp(p, cmd) != 0) {
if (DEBUG(META))
Home |
Main Index |
Thread Index |
Old Index