From: espie Date: Mon, 17 Apr 2000 23:54:47 +0000 (+0000) Subject: Record location in target node as well. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9c3b4ebbcadea58ef6ed6d90c78c995a913fb69d;p=openbsd Record location in target node as well. Indicate what went wrong for commands like @exit 1 --- diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index 94d78dfa9d6..a139c3cc437 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat.c,v 1.23 2000/03/26 16:21:32 espie Exp $ */ +/* $OpenBSD: compat.c,v 1.24 2000/04/17 23:54:47 espie Exp $ */ /* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: compat.c,v 1.23 2000/03/26 16:21:32 espie Exp $"; +static char rcsid[] = "$OpenBSD: compat.c,v 1.24 2000/04/17 23:54:47 espie Exp $"; #endif #endif /* not lint */ @@ -604,7 +604,13 @@ CompatMake (gnp, pgnp) } else if (keepgoing) { pgn->make = FALSE; } else { - printf ("\n\nStop in %s.\n", Var_Value(".CURDIR", gn)); + if (gn->lineno) + printf("\n\nStop in %s (line %lu of %s).\n", + Var_Value(".CURDIR", gn), + (unsigned long)gn->lineno, + gn->fname); + else + printf("\n\nStop in %s.\n", Var_Value(".CURDIR", gn)); exit (1); } } else if (gn->made == ERROR) { diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index 14c76caebf0..c7e3e82d5f1 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -1,4 +1,4 @@ -/* $OpenBSD: make.h,v 1.17 2000/02/02 13:47:48 espie Exp $ */ +/* $OpenBSD: make.h,v 1.18 2000/04/17 23:54:47 espie Exp $ */ /* $NetBSD: make.h,v 1.15 1997/03/10 21:20:00 christos Exp $ */ /* @@ -161,6 +161,8 @@ typedef struct GNode { Lst preds; /* Nodes that must be made before this one */ Lst context; /* The local variables */ + unsigned long lineno; /* First line number of commands. */ + const char * fname; /* File name of commands. */ Lst commands; /* Creation commands */ struct _Suff *suffix; /* Suffix for the node (determined by diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 309f20b43cc..8045284d392 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.38 2000/04/17 23:45:24 espie Exp $ */ +/* $OpenBSD: parse.c,v 1.39 2000/04/17 23:54:47 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: parse.c,v 1.38 2000/04/17 23:45:24 espie Exp $"; +static char rcsid[] = "$OpenBSD: parse.c,v 1.39 2000/04/17 23:54:47 espie Exp $"; #endif #endif /* not lint */ @@ -1592,8 +1592,13 @@ ParseAddCmd(gnp, cmd) { GNode *gn = (GNode *) gnp; /* if target already supplied, ignore commands */ - if (!(gn->type & OP_HAS_COMMANDS)) + if (!(gn->type & OP_HAS_COMMANDS)) { Lst_AtEnd(gn->commands, cmd); + if (!gn->lineno) { + gn->lineno = Parse_Getlineno(); + gn->fname = Parse_Getfilename(); + } + } return(0); }