Module Name: src
Committed By: sjg
Date: Sun Mar 31 05:49:51 UTC 2013
Modified Files:
src/usr.bin/make: make.1 meta.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/usr.bin/make/make.1
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/meta.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.212 src/usr.bin/make/make.1:1.213
--- src/usr.bin/make/make.1:1.212 Sat Mar 23 05:31:29 2013
+++ src/usr.bin/make/make.1 Sun Mar 31 05:49:51 2013
@@ -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 @@ targets.
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 .
Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.28 src/usr.bin/make/meta.c:1.29
--- src/usr.bin/make/meta.c:1.28 Sat Mar 23 23:39:47 2013
+++ src/usr.bin/make/meta.c Sun Mar 31 05:49:51 2013
@@ -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 @@ meta_oodate(GNode *gn, Boolean oodate)
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 @@ meta_oodate(GNode *gn, Boolean oodate)
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))