Mon May 10 15:54:21 2010 UTC ()
PrintOnError: run .ERROR last, so even if it causes problems we
still print MAKE_PRINT_VAR_ON_ERROR.


(sjg)
diff -r1.185 -r1.186 src/usr.bin/make/main.c

cvs diff -r1.185 -r1.186 src/usr.bin/make/main.c (expand / switch to unified diff)

--- src/usr.bin/make/main.c 2010/05/05 14:10:39 1.185
+++ src/usr.bin/make/main.c 2010/05/10 15:54:21 1.186
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.185 2010/05/05 14:10:39 christos Exp $ */ 1/* $NetBSD: main.c,v 1.186 2010/05/10 15:54:21 sjg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -59,39 +59,39 @@ @@ -59,39 +59,39 @@
59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE. 68 * SUCH DAMAGE.
69 */ 69 */
70 70
71#ifndef MAKE_NATIVE 71#ifndef MAKE_NATIVE
72static char rcsid[] = "$NetBSD: main.c,v 1.185 2010/05/05 14:10:39 christos Exp $"; 72static char rcsid[] = "$NetBSD: main.c,v 1.186 2010/05/10 15:54:21 sjg Exp $";
73#else 73#else
74#include <sys/cdefs.h> 74#include <sys/cdefs.h>
75#ifndef lint 75#ifndef lint
76__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ 76__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
77 The Regents of the University of California. All rights reserved."); 77 The Regents of the University of California. All rights reserved.");
78#endif /* not lint */ 78#endif /* not lint */
79 79
80#ifndef lint 80#ifndef lint
81#if 0 81#if 0
82static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; 82static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
83#else 83#else
84__RCSID("$NetBSD: main.c,v 1.185 2010/05/05 14:10:39 christos Exp $"); 84__RCSID("$NetBSD: main.c,v 1.186 2010/05/10 15:54:21 sjg Exp $");
85#endif 85#endif
86#endif /* not lint */ 86#endif /* not lint */
87#endif 87#endif
88 88
89/*- 89/*-
90 * main.c -- 90 * main.c --
91 * The main file for this entire program. Exit routines etc 91 * The main file for this entire program. Exit routines etc
92 * reside here. 92 * reside here.
93 * 93 *
94 * Utility functions defined in this file: 94 * Utility functions defined in this file:
95 * Main_ParseArgLine Takes a line of arguments, breaks them and 95 * Main_ParseArgLine Takes a line of arguments, breaks them and
96 * treats them as if they were given when first 96 * treats them as if they were given when first
97 * invoked. Used by the parse module to implement 97 * invoked. Used by the parse module to implement
@@ -1892,43 +1892,42 @@ PrintOnError(GNode *gn, const char *s) @@ -1892,43 +1892,42 @@ PrintOnError(GNode *gn, const char *s)
1892 if (s) 1892 if (s)
1893 printf("%s", s); 1893 printf("%s", s);
1894  1894
1895 printf("\n%s: stopped in %s\n", progname, curdir); 1895 printf("\n%s: stopped in %s\n", progname, curdir);
1896 1896
1897 if (en) 1897 if (en)
1898 return; /* we've been here! */ 1898 return; /* we've been here! */
1899 if (gn) { 1899 if (gn) {
1900 /* 1900 /*
1901 * We can print this even if there is no .ERROR target. 1901 * We can print this even if there is no .ERROR target.
1902 */ 1902 */
1903 Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL, 0); 1903 Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL, 0);
1904 } 1904 }
 1905 strncpy(tmp, "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}",
 1906 sizeof(tmp) - 1);
 1907 cp = Var_Subst(NULL, tmp, VAR_GLOBAL, 0);
 1908 if (cp) {
 1909 if (*cp)
 1910 printf("%s", cp);
 1911 free(cp);
 1912 }
1905 /* 1913 /*
1906 * See if there is a .ERROR target, and run it if so. 1914 * Finally, see if there is a .ERROR target, and run it if so.
1907 */ 1915 */
1908 en = Targ_FindNode(".ERROR", TARG_NOCREATE); 1916 en = Targ_FindNode(".ERROR", TARG_NOCREATE);
1909 if (en) { 1917 if (en) {
1910 en->type |= OP_SPECIAL; 1918 en->type |= OP_SPECIAL;
1911 Compat_Make(en, en); 1919 Compat_Make(en, en);
1912 } 1920 }
1913  
1914 strncpy(tmp, "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}", 
1915 sizeof(tmp) - 1); 
1916 cp = Var_Subst(NULL, tmp, VAR_GLOBAL, 0); 
1917 if (cp) { 
1918 if (*cp) 
1919 printf("%s", cp); 
1920 free(cp); 
1921 } 
1922} 1921}
1923 1922
1924void 1923void
1925Main_ExportMAKEFLAGS(Boolean first) 1924Main_ExportMAKEFLAGS(Boolean first)
1926{ 1925{
1927 static int once = 1; 1926 static int once = 1;
1928 char tmp[64]; 1927 char tmp[64];
1929 char *s; 1928 char *s;
1930 1929
1931 if (once != first) 1930 if (once != first)
1932 return; 1931 return;
1933 once = 0; 1932 once = 0;
1934  1933