mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-27 16:39:08 +00:00
New variable `.MAKEFILE_LIST', useful for tracing, debugging and dependency tracking.
Use make -V .MAKEFILE_LIST | tr \ \\n | awk '$0==".." {l--; next} {l++; printf "%*s%s\n", l, " ", $0}' to print a tree of all included makefiles. Approved by: joerg MFC after: 1 week
This commit is contained in:
parent
7929aa036c
commit
f695b5ceca
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131456
@ -32,7 +32,7 @@
|
|||||||
.\" @(#)make.1 8.8 (Berkeley) 6/13/95
|
.\" @(#)make.1 8.8 (Berkeley) 6/13/95
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd April 12, 2004
|
.Dd July 2, 2004
|
||||||
.Dt MAKE 1
|
.Dt MAKE 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -460,7 +460,7 @@ In addition,
|
|||||||
.Nm
|
.Nm
|
||||||
sets or knows about the following internal variables or environment
|
sets or knows about the following internal variables or environment
|
||||||
variables:
|
variables:
|
||||||
.Bl -tag -width MAKEFLAGS
|
.Bl -tag -width MAKEFILE_LIST
|
||||||
.It Va \&$
|
.It Va \&$
|
||||||
A single dollar sign
|
A single dollar sign
|
||||||
.Ql \&$ ,
|
.Ql \&$ ,
|
||||||
@ -529,6 +529,19 @@ utility sets
|
|||||||
.Va .OBJDIR
|
.Va .OBJDIR
|
||||||
to the canonical path given by
|
to the canonical path given by
|
||||||
.Xr getcwd 3 .
|
.Xr getcwd 3 .
|
||||||
|
.It Va .MAKEFILE_LIST
|
||||||
|
As
|
||||||
|
.Nm
|
||||||
|
reads various makefiles, including the default files and any
|
||||||
|
obtained from the command line and
|
||||||
|
.Ql Ic \&.include
|
||||||
|
directives, their names will be automatically appended to the
|
||||||
|
.Va .MAKEFILE_LIST
|
||||||
|
variable.
|
||||||
|
They are added right before
|
||||||
|
.Nm
|
||||||
|
begins to parse them, so that the name of the current makefile is the
|
||||||
|
last word in this variable.
|
||||||
.It Va .MAKEFLAGS
|
.It Va .MAKEFLAGS
|
||||||
The environment variable
|
The environment variable
|
||||||
.Ev MAKEFLAGS
|
.Ev MAKEFLAGS
|
||||||
@ -1230,6 +1243,11 @@ default
|
|||||||
.Ev MAKEOBJDIRPREFIX
|
.Ev MAKEOBJDIRPREFIX
|
||||||
directory.
|
directory.
|
||||||
.El
|
.El
|
||||||
|
.Sh EXAMPLES
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Li "make \-V .MAKEFILE_LIST | tr \e\ \e\en"
|
||||||
|
Lists all included makefiles in order visited.
|
||||||
|
.El
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
The determination of
|
The determination of
|
||||||
.Va .OBJDIR
|
.Va .OBJDIR
|
||||||
|
@ -1777,6 +1777,8 @@ ParseDoInclude (char *file)
|
|||||||
* Pop to previous file
|
* Pop to previous file
|
||||||
*/
|
*/
|
||||||
(void) ParseEOF(0);
|
(void) ParseEOF(0);
|
||||||
|
} else {
|
||||||
|
Var_Append(".MAKEFILE_LIST", fullname, VAR_GLOBAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1919,6 +1921,8 @@ ParseTraditionalInclude (char *file)
|
|||||||
* Pop to previous file
|
* Pop to previous file
|
||||||
*/
|
*/
|
||||||
(void) ParseEOF(1);
|
(void) ParseEOF(1);
|
||||||
|
} else {
|
||||||
|
Var_Append(".MAKEFILE_LIST", fullname, VAR_GLOBAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1945,13 +1949,16 @@ ParseEOF (int opened)
|
|||||||
IFile *ifile; /* the state on the top of the includes stack */
|
IFile *ifile; /* the state on the top of the includes stack */
|
||||||
|
|
||||||
if (Lst_IsEmpty (includes)) {
|
if (Lst_IsEmpty (includes)) {
|
||||||
|
Var_Append(".MAKEFILE_LIST", "..", VAR_GLOBAL);
|
||||||
return (DONE);
|
return (DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ifile = (IFile *) Lst_DeQueue (includes);
|
ifile = (IFile *) Lst_DeQueue (includes);
|
||||||
free (curFile.fname);
|
free (curFile.fname);
|
||||||
if (opened && curFile.F)
|
if (opened && curFile.F) {
|
||||||
(void) fclose (curFile.F);
|
(void) fclose (curFile.F);
|
||||||
|
Var_Append(".MAKEFILE_LIST", "..", VAR_GLOBAL);
|
||||||
|
}
|
||||||
if (curFile.p) {
|
if (curFile.p) {
|
||||||
free(curFile.p->str);
|
free(curFile.p->str);
|
||||||
free(curFile.p);
|
free(curFile.p);
|
||||||
@ -2379,6 +2386,8 @@ Parse_File(char *name, FILE *stream)
|
|||||||
curFile.lineno = 0;
|
curFile.lineno = 0;
|
||||||
fatals = 0;
|
fatals = 0;
|
||||||
|
|
||||||
|
Var_Append(".MAKEFILE_LIST", name, VAR_GLOBAL);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
while ((line = ParseReadLine ()) != NULL) {
|
while ((line = ParseReadLine ()) != NULL) {
|
||||||
if (*line == '.') {
|
if (*line == '.') {
|
||||||
|
Loading…
Reference in New Issue
Block a user