add .INCLUDEDFROM{FILE,DIR}
This commit is contained in:
parent
2296f9ab5c
commit
6ee57b9ada
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: make.1,v 1.226 2013/11/07 18:50:46 dholland Exp $
|
||||
.\" $NetBSD: make.1,v 1.227 2014/01/10 16:12:52 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -638,6 +638,10 @@ target is to be transformed (the
|
|||
source); also known as
|
||||
.Ql Va \&\*[Lt] .
|
||||
It is not defined in explicit rules.
|
||||
.It Va .INCLUDEDFROMDIR
|
||||
The directory of the file this Makefile was included from.
|
||||
.It Va .INCLUDEDFROMFILE
|
||||
The filename of the file this Makefile was included from.
|
||||
.It Va .MEMBER
|
||||
The name of the archive member.
|
||||
.It Va .OODATE
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.193 2014/01/10 16:12:52 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,14 +69,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.193 2014/01/10 16:12:52 christos Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.193 2014/01/10 16:12:52 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -361,6 +361,7 @@ static int ParseAddCmd(void *, void *);
|
|||
static void ParseHasCommands(void *);
|
||||
static void ParseDoInclude(char *);
|
||||
static void ParseSetParseFile(const char *);
|
||||
static void ParseSetIncludedFile(void);
|
||||
#ifdef SYSVINCLUDE
|
||||
static void ParseTraditionalInclude(char *);
|
||||
#endif
|
||||
|
@ -845,7 +846,8 @@ ParseLinkSrc(void *pgnp, void *cgnp)
|
|||
(void)Lst_AtEnd(cgn->parents, pgn);
|
||||
pgn->unmade += 1;
|
||||
if (DEBUG(PARSE)) {
|
||||
fprintf(debug_file, "# ParseLinkSrc: added child %s - %s\n", pgn->name, cgn->name);
|
||||
fprintf(debug_file, "# %s: added child %s - %s\n", __func__,
|
||||
pgn->name, cgn->name);
|
||||
Targ_PrintNode(pgn, 0);
|
||||
Targ_PrintNode(cgn, 0);
|
||||
}
|
||||
|
@ -1020,8 +1022,8 @@ ParseDoSrc(int tOp, const char *src)
|
|||
(void)Lst_AtEnd(predecessor->order_succ, gn);
|
||||
(void)Lst_AtEnd(gn->order_pred, predecessor);
|
||||
if (DEBUG(PARSE)) {
|
||||
fprintf(debug_file, "# ParseDoSrc: added Order dependency %s - %s\n",
|
||||
predecessor->name, gn->name);
|
||||
fprintf(debug_file, "# %s: added Order dependency %s - %s\n",
|
||||
__func__, predecessor->name, gn->name);
|
||||
Targ_PrintNode(predecessor, 0);
|
||||
Targ_PrintNode(gn, 0);
|
||||
}
|
||||
|
@ -2164,6 +2166,7 @@ Parse_include_file(char *file, Boolean isSystem, int silent)
|
|||
/* load it */
|
||||
lf = loadfile(fullname, fd);
|
||||
|
||||
ParseSetIncludedFile();
|
||||
/* Start reading from this file next */
|
||||
Parse_SetInput(fullname, 0, -1, loadedfile_nextbuf, lf);
|
||||
curFile->lf = lf;
|
||||
|
@ -2221,6 +2224,41 @@ ParseDoInclude(char *line)
|
|||
}
|
||||
|
||||
|
||||
/*-
|
||||
*---------------------------------------------------------------------
|
||||
* ParseSetIncludedFile --
|
||||
* Set the .INCLUDEDFROMFILE variable to the contents of .PARSEFILE
|
||||
* and the .INCLUDEDFROMDIR variable to the contents of .PARSEDIR
|
||||
*
|
||||
* Results:
|
||||
* None
|
||||
*
|
||||
* Side Effects:
|
||||
* The .INCLUDEDFROMFILE variable is overwritten by the contents
|
||||
* of .PARSEFILE and the .INCLUDEDFROMDIR variable is overwriten
|
||||
* but the contents of .PARSEDIR
|
||||
*---------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
ParseSetIncludedFile(void)
|
||||
{
|
||||
char *pf, *fp = NULL;
|
||||
char *pd, *dp = NULL;
|
||||
|
||||
pf = Var_Value(".PARSEFILE", VAR_GLOBAL, &fp);
|
||||
Var_Set(".INCLUDEDFROMFILE", pf, VAR_GLOBAL, 0);
|
||||
pd = Var_Value(".PARSEDIR", VAR_GLOBAL, &dp);
|
||||
Var_Set(".INCLUDEDFROMDIR", pd, VAR_GLOBAL, 0);
|
||||
|
||||
if (DEBUG(PARSE))
|
||||
fprintf(debug_file, "%s: ${.INCLUDEDFROMDIR} = `%s' "
|
||||
"${.INCLUDEDFROMFILE} = `%s'\n", __func__, pd, pf);
|
||||
|
||||
if (fp)
|
||||
free(fp);
|
||||
if (dp)
|
||||
free(dp);
|
||||
}
|
||||
/*-
|
||||
*---------------------------------------------------------------------
|
||||
* ParseSetParseFile --
|
||||
|
@ -2256,8 +2294,8 @@ ParseSetParseFile(const char *filename)
|
|||
Var_Set(".PARSEFILE", pf = slash + 1, VAR_GLOBAL, 0);
|
||||
}
|
||||
if (DEBUG(PARSE))
|
||||
fprintf(debug_file, "ParseSetParseFile: ${.PARSEDIR} = `%s' "
|
||||
"${.PARSEFILE} = `%s'\n", pd, pf);
|
||||
fprintf(debug_file, "%s: ${.PARSEDIR} = `%s' ${.PARSEFILE} = `%s'\n",
|
||||
__func__, pd, pf);
|
||||
free(dirname);
|
||||
}
|
||||
|
||||
|
@ -2319,8 +2357,8 @@ Parse_SetInput(const char *name, int line, int fd,
|
|||
ParseTrackInput(name);
|
||||
|
||||
if (DEBUG(PARSE))
|
||||
fprintf(debug_file, "Parse_SetInput: file %s, line %d, fd %d, nextbuf %p, arg %p\n",
|
||||
name, line, fd, nextbuf, arg);
|
||||
fprintf(debug_file, "%s: file %s, line %d, fd %d, nextbuf %p, arg %p\n",
|
||||
__func__, name, line, fd, nextbuf, arg);
|
||||
|
||||
if (fd == -1 && nextbuf == NULL)
|
||||
/* sanity */
|
||||
|
@ -2392,7 +2430,7 @@ ParseTraditionalInclude(char *line)
|
|||
char *all_files;
|
||||
|
||||
if (DEBUG(PARSE)) {
|
||||
fprintf(debug_file, "ParseTraditionalInclude: %s\n", file);
|
||||
fprintf(debug_file, "%s: %s\n", __func__, file);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2451,7 +2489,7 @@ ParseGmakeExport(char *line)
|
|||
char *value;
|
||||
|
||||
if (DEBUG(PARSE)) {
|
||||
fprintf(debug_file, "ParseGmakeExport: %s\n", variable);
|
||||
fprintf(debug_file, "%s: %s\n", __func__, variable);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2531,6 +2569,7 @@ ParseEOF(void)
|
|||
/* We've run out of input */
|
||||
Var_Delete(".PARSEDIR", VAR_GLOBAL);
|
||||
Var_Delete(".PARSEFILE", VAR_GLOBAL);
|
||||
Var_Delete(".INCLUDED_FROM", VAR_GLOBAL);
|
||||
return DONE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue