1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

*** empty log message ***

This commit is contained in:
Peter Wemm 2000-09-25 18:44:30 +00:00
parent 33cd46fe61
commit 34c46f2d3d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66365
2 changed files with 28 additions and 12 deletions

View File

@ -116,6 +116,7 @@ Boolean allPrecious; /* .PRECIOUS given on line by itself */
static Boolean noBuiltins; /* -r flag */
static Lst makefiles; /* ordered list of makefiles to read */
static Boolean printVars; /* print value of one or more vars */
static Boolean expandVars; /* fully expand printed variables */
static Lst variables; /* list of variables to print */
int maxJobs; /* -j argument */
static Boolean forceJobs; /* -j argument given */
@ -167,9 +168,9 @@ MainParseArgs(argc, argv)
optind = 1; /* since we're called more than once */
#ifdef REMOTE
# define OPTFLAGS "BD:E:I:L:PSV:d:ef:ij:km:nqrstv"
# define OPTFLAGS "BD:E:I:L:PSV:Xd:ef:ij:km:nqrstv"
#else
# define OPTFLAGS "BD:E:I:PSV:d:ef:ij:km:nqrstv"
# define OPTFLAGS "BD:E:I:PSV:Xd:ef:ij:km:nqrstv"
#endif
rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
switch(c) {
@ -185,15 +186,13 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
break;
case 'V':
printVars = TRUE;
p = malloc(strlen(optarg) + 1 + 3);
if (!p)
Punt("make: cannot allocate memory.");
/* This sprintf is safe, because of the malloc above */
(void)sprintf(p, "${%s}", optarg);
(void)Lst_AtEnd(variables, (ClientData)p);
(void)Lst_AtEnd(variables, (ClientData)optarg);
Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
break;
case 'X':
expandVars = FALSE;
break;
case 'B':
compatMake = TRUE;
Var_Append(MAKEFLAGS, "-B", VAR_GLOBAL);
@ -621,6 +620,7 @@ main(argc, argv)
makefiles = Lst_Init(FALSE);
envFirstVars = Lst_Init(FALSE);
printVars = FALSE;
expandVars = TRUE;
variables = Lst_Init(FALSE);
beSilent = FALSE; /* Print commands as executed */
ignoreErrors = FALSE; /* Pay attention to non-zero returns */
@ -828,10 +828,21 @@ main(argc, argv)
for (ln = Lst_First(variables); ln != NILLNODE;
ln = Lst_Succ(ln)) {
char *value = Var_Subst(NULL, (char *)Lst_Datum(ln),
VAR_GLOBAL, FALSE);
char *value;
if (expandVars) {
p1 = malloc(strlen((char *)Lst_Datum(ln)) + 1 + 3);
if (!p1)
Punt("make: cannot allocate memory.");
/* This sprintf is safe, because of the malloc above */
(void)sprintf(p1, "${%s}", (char *)Lst_Datum(ln));
value = Var_Subst(NULL, p1, VAR_GLOBAL, FALSE);
} else {
value = Var_Value((char *)Lst_Datum(ln),
VAR_GLOBAL, &p1);
}
printf("%s\n", value ? value : "");
if (p1)
free(p1);
}
}

View File

@ -40,7 +40,7 @@
.Nd maintain program dependencies
.Sh SYNOPSIS
.Nm make
.Op Fl BPSeiknqrstv
.Op Fl BPSXeiknqrstv
.Op Fl D Ar variable
.Op Fl d Ar flags
.Op Fl E Ar variable
@ -217,6 +217,11 @@ with a blank line for each null or undefined variable.
.It Fl v
Be extra verbose.
For multi-job makes, this will cause file banners to be generated.
.It Fl X
When using the
.Fl V
option to print the values of variables,
do not recursively expand the values.
.It Ar variable Ns No = Ns Ar value
Set the value of the variable
.Ar variable