summaryrefslogtreecommitdiff
path: root/usr.bin/make/parse.c
diff options
context:
space:
mode:
authorsjg <sjg@NetBSD.org>2001-01-07 06:08:33 +0000
committersjg <sjg@NetBSD.org>2001-01-07 06:08:33 +0000
commit85be2f6526f76aa153a06fc9762dec8658ec5b18 (patch)
tree853deea6e8ff82742a6c98918be286998cfdfe29 /usr.bin/make/parse.c
parent744c0120682c8f679c6f592d3a9fae8d53b3c1d9 (diff)
Always try an give the absolute pathname of the Makefile that we got an error in.
Use .PARSEDIR if set and not '.', otherwise .CURDIR to qualify the Makefile's path.
Diffstat (limited to 'usr.bin/make/parse.c')
-rw-r--r--usr.bin/make/parse.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index cc1369d3569..fd829cd3821 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.54 2000/12/05 17:07:01 sommerfeld Exp $ */
+/* $NetBSD: parse.c,v 1.55 2001/01/07 06:08:33 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -39,14 +39,14 @@
*/
#ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: parse.c,v 1.54 2000/12/05 17:07:01 sommerfeld Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.55 2001/01/07 06:08:33 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.54 2000/12/05 17:07:01 sommerfeld Exp $");
+__RCSID("$NetBSD: parse.c,v 1.55 2001/01/07 06:08:33 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -337,7 +337,21 @@ ParseVErrorInternal(va_alist)
va_dcl
#endif
{
- (void)fprintf(stderr, "\"%s\", line %d: ", cfname, (int) clineno);
+ if (*cfname != '/') {
+ char *cp, *dir;
+
+ /*
+ * Nothing is more anoying than not knowing which Makefile
+ * is the culprit.
+ */
+ dir = Var_Value(".PARSEDIR", VAR_GLOBAL, &cp);
+ if (*dir == '\0' ||
+ (*dir == '.' && dir[1] == '\0'))
+ dir = Var_Value(".CURDIR", VAR_GLOBAL, &cp);
+
+ (void)fprintf(stderr, "\"%s/%s\", line %d: ", dir, cfname, (int) clineno);
+ } else
+ (void)fprintf(stderr, "\"%s\", line %d: ", cfname, (int) clineno);
if (type == PARSE_WARNING)
(void)fprintf(stderr, "warning: ");
(void)vfprintf(stderr, fmt, ap);