summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-06-13 11:55:57 +0000
committerpeter <peter@FreeBSD.org>1998-06-13 11:55:57 +0000
commit1f5c254c67e08f1f6d39a304b4b6c403033e40ae (patch)
treeffc7ab5d7ee8280a40872ad81ab36a56c34f6b4b /usr.bin/make
parent885f9e9d51aad3937cd0b5958dc4547208187eb3 (diff)
downloadFreeBSD-src-1f5c254c67e08f1f6d39a304b4b6c403033e40ae.zip
FreeBSD-src-1f5c254c67e08f1f6d39a304b4b6c403033e40ae.tar.gz
Make -V expand it's arguments. This means that instead of 'make -V OBJS'
printing something useless (to a shell) like: ${SRCS:N*.h:R:S/$/.o/g} it will instead print the actual ${OBJS} value.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index f2bbfbc..efcfcfd 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -47,7 +47,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#endif
static const char rcsid[] =
- "$Id: main.c,v 1.22 1997/08/27 06:31:27 jkh Exp $";
+ "$Id: main.c,v 1.23 1997/09/29 03:53:51 imp Exp $";
#endif /* not lint */
/*-
@@ -163,6 +163,7 @@ MainParseArgs(argc, argv)
{
extern int optind;
extern char *optarg;
+ char *p;
int c;
optind = 1; /* since we're called more than once */
@@ -185,7 +186,10 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
break;
case 'V':
printVars = TRUE;
- (void)Lst_AtEnd(variables, (ClientData)optarg);
+ (void)asprintf(&p, "${%s}", optarg);
+ if (!p)
+ Punt("make: cannot allocate memory.");
+ (void)Lst_AtEnd(variables, (ClientData)p);
Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
break;
@@ -746,12 +750,10 @@ main(argc, argv)
for (ln = Lst_First(variables); ln != NILLNODE;
ln = Lst_Succ(ln)) {
- char *value = Var_Value((char *)Lst_Datum(ln),
- VAR_GLOBAL, &p1);
+ char *value = Var_Subst(NULL, (char *)Lst_Datum(ln),
+ VAR_GLOBAL, FALSE);
printf("%s\n", value ? value : "");
- if (p1)
- free(p1);
}
}
OpenPOWER on IntegriCloud