Subject: make: absolute path for Makefile in errors.
To: None <tech-toolchain@netbsd.org>
From: Simon J. Gerraty <sjg@quick.com.au>
List: tech-toolchain
Date: 01/02/2001 01:42:56
The following patch results in an error message like:
===> Validating dependencies for openssh-2.3.0p1
"/u3/NetBSD/current/pkgsrc/security/openssl/Makefile", line 89: Need an operator
"/u3/NetBSD/current/pkgsrc/security/openssl/Makefile", line 93: Need an operator
"/u3/NetBSD/current/pkgsrc/security/openssl/Makefile", line 98: Need an operator
Rather than:
===> Validating dependencies for openssh-2.3.0p1
"Makefile", line 89: Need an operator
"Makefile", line 93: Need an operator
"Makefile", line 98: Need an operator
and obviously makes it much easier to find and fix the problem - a
merge conflict.
anyone object or have a better fix?
--sjg
Index: parse.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/parse.c,v
retrieving revision 1.54
diff -u -p -r1.54 parse.c
--- parse.c 2000/12/05 17:07:01 1.54
+++ parse.c 2001/01/02 09:34:15
@@ -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);