Add the new .NOPATH feature which can be used to disable .PATH search
for particular targets, i.e. .depend, objects, etc. (from Christos).
This commit is contained in:
parent
386c8864bc
commit
bf6930a26c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.c,v 1.16 1997/05/06 20:59:42 mycroft Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.17 1997/05/08 21:24:41 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.16 1997/05/06 20:59:42 mycroft Exp $";
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.17 1997/05/08 21:24:41 gwr Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -181,6 +181,7 @@ static int hits, /* Found in directory cache */
|
||||
bigmisses; /* Sought by itself */
|
||||
|
||||
static Path *dot; /* contents of current directory */
|
||||
static Path *cur; /* contents of current directory, if not dot */
|
||||
static Hash_Table mtimes; /* Results of doing a last-resort stat in
|
||||
* Dir_FindFile -- if we have to go to the
|
||||
* system to find the file, we might as well
|
||||
@ -212,7 +213,8 @@ static int DirPrintDir __P((ClientData, ClientData));
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
Dir_Init ()
|
||||
Dir_Init (cdname)
|
||||
const char *cdname;
|
||||
{
|
||||
dirSearchPath = Lst_Init (FALSE);
|
||||
openDirectories = Lst_Init (FALSE);
|
||||
@ -224,14 +226,22 @@ Dir_Init ()
|
||||
* we need to remove "." from openDirectories and what better time to
|
||||
* do it than when we have to fetch the thing anyway?
|
||||
*/
|
||||
Dir_AddDir (openDirectories, ".");
|
||||
dot = (Path *) Lst_DeQueue (openDirectories);
|
||||
dot = Dir_AddDir (NULL, ".");
|
||||
|
||||
/*
|
||||
* We always need to have dot around, so we increment its reference count
|
||||
* to make sure it's not destroyed.
|
||||
*/
|
||||
dot->refCount += 1;
|
||||
|
||||
if (cdname != NULL) {
|
||||
/*
|
||||
* Our build directory is not the same as our source directory.
|
||||
* Keep this one around too.
|
||||
*/
|
||||
cur = Dir_AddDir (NULL, cdname);
|
||||
cur->refCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -249,6 +259,10 @@ Dir_Init ()
|
||||
void
|
||||
Dir_End()
|
||||
{
|
||||
if (cur) {
|
||||
cur->refCount -= 1;
|
||||
Dir_Destroy((ClientData) cur);
|
||||
}
|
||||
dot->refCount -= 1;
|
||||
Dir_Destroy((ClientData) dot);
|
||||
Dir_ClearPath(dirSearchPath);
|
||||
@ -631,7 +645,7 @@ Dir_Expand (word, path, expansions)
|
||||
if (*dp == '/')
|
||||
*dp = '\0';
|
||||
path = Lst_Init(FALSE);
|
||||
Dir_AddDir(path, dirpath);
|
||||
(void) Dir_AddDir(path, dirpath);
|
||||
DirExpandInt(cp+1, path, expansions);
|
||||
Lst_Destroy(path, NOFREE);
|
||||
}
|
||||
@ -720,14 +734,24 @@ Dir_FindFile (name, path)
|
||||
* This is so there are no conflicts between what the user specifies
|
||||
* (fish.c) and what pmake finds (./fish.c).
|
||||
*/
|
||||
if ((!hasSlash || (cp - name == 2 && *name == '.')) &&
|
||||
(Hash_FindEntry (&dot->files, cp) != (Hash_Entry *)NULL)) {
|
||||
if ((!hasSlash || (cp - name == 2 && *name == '.'))) {
|
||||
if (Hash_FindEntry (&dot->files, cp) != (Hash_Entry *)NULL) {
|
||||
if (DEBUG(DIR)) {
|
||||
printf("in '.'\n");
|
||||
}
|
||||
hits += 1;
|
||||
dot->hits += 1;
|
||||
return (estrdup (name));
|
||||
}
|
||||
if (cur &&
|
||||
Hash_FindEntry (&cur->files, cp) != (Hash_Entry *)NULL) {
|
||||
if (DEBUG(DIR)) {
|
||||
printf("in ${.CURDIR} = %s\n", cur->name);
|
||||
}
|
||||
hits += 1;
|
||||
cur->hits += 1;
|
||||
return str_concat (cur->name, cp, STR_ADDSLASH);
|
||||
}
|
||||
}
|
||||
|
||||
if (Lst_Open (path) == FAILURE) {
|
||||
@ -871,7 +895,7 @@ Dir_FindFile (name, path)
|
||||
*/
|
||||
cp = strrchr (file, '/');
|
||||
*cp = '\0';
|
||||
Dir_AddDir (path, file);
|
||||
(void) Dir_AddDir (path, file);
|
||||
*cp = '/';
|
||||
}
|
||||
|
||||
@ -929,7 +953,7 @@ Dir_FindFile (name, path)
|
||||
*/
|
||||
#ifdef notdef
|
||||
cp[-1] = '\0';
|
||||
Dir_AddDir (path, name);
|
||||
(void) Dir_AddDir (path, name);
|
||||
cp[-1] = '/';
|
||||
|
||||
bigmisses += 1;
|
||||
@ -1001,7 +1025,7 @@ Dir_MTime (gn)
|
||||
if (gn->type & OP_ARCHV) {
|
||||
return Arch_MTime (gn);
|
||||
} else if (gn->path == (char *)NULL) {
|
||||
if (gn->type & OP_PHONY)
|
||||
if (gn->type & (OP_PHONY|OP_NOPATH))
|
||||
fullName = NULL;
|
||||
else
|
||||
fullName = Dir_FindFile (gn->name, dirSearchPath);
|
||||
@ -1058,14 +1082,14 @@ Dir_MTime (gn)
|
||||
* read and hashed.
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
Path *
|
||||
Dir_AddDir (path, name)
|
||||
Lst path; /* the path to which the directory should be
|
||||
* added */
|
||||
char *name; /* the name of the directory to add */
|
||||
const char *name; /* the name of the directory to add */
|
||||
{
|
||||
LstNode ln; /* node in case Path structure is found */
|
||||
register Path *p; /* pointer to new Path structure */
|
||||
register Path *p = NULL; /* pointer to new Path structure */
|
||||
DIR *d; /* for reading directory */
|
||||
register struct dirent *dp; /* entry in directory */
|
||||
|
||||
@ -1110,12 +1134,14 @@ Dir_AddDir (path, name)
|
||||
}
|
||||
(void) closedir (d);
|
||||
(void)Lst_AtEnd (openDirectories, (ClientData)p);
|
||||
(void)Lst_AtEnd (path, (ClientData)p);
|
||||
if (path != NULL)
|
||||
(void)Lst_AtEnd (path, (ClientData)p);
|
||||
}
|
||||
if (DEBUG(DIR)) {
|
||||
printf("done\n");
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/*-
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.h,v 1.4 1996/11/06 17:59:05 christos Exp $ */
|
||||
/* $NetBSD: dir.h,v 1.5 1997/05/08 21:24:42 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -54,13 +54,13 @@ typedef struct Path {
|
||||
Hash_Table files; /* Hash table of files in directory */
|
||||
} Path;
|
||||
|
||||
void Dir_Init __P((void));
|
||||
void Dir_Init __P((const char *));
|
||||
void Dir_End __P((void));
|
||||
Boolean Dir_HasWildcards __P((char *));
|
||||
void Dir_Expand __P((char *, Lst, Lst));
|
||||
char *Dir_FindFile __P((char *, Lst));
|
||||
int Dir_MTime __P((GNode *));
|
||||
void Dir_AddDir __P((Lst, char *));
|
||||
Path *Dir_AddDir __P((Lst, const char *));
|
||||
char *Dir_MakeFlags __P((char *, Lst));
|
||||
void Dir_ClearPath __P((Lst));
|
||||
void Dir_Concat __P((Lst, Lst));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.35 1997/05/08 05:19:46 cjs Exp $ */
|
||||
/* $NetBSD: main.c,v 1.36 1997/05/08 21:24:44 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -48,7 +48,7 @@ static char copyright[] =
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.35 1997/05/08 05:19:46 cjs Exp $";
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.36 1997/05/08 21:24:44 gwr Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -290,7 +290,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {
|
||||
break;
|
||||
case 'm':
|
||||
mkIncPath = TRUE;
|
||||
Dir_AddDir(sysIncPath, optarg);
|
||||
(void) Dir_AddDir(sysIncPath, optarg);
|
||||
Var_Append(MAKEFLAGS, "-m", VAR_GLOBAL);
|
||||
Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
|
||||
break;
|
||||
@ -584,15 +584,18 @@ main(argc, argv)
|
||||
* for the reading of inclusion paths and variable settings on the
|
||||
* command line
|
||||
*/
|
||||
Dir_Init(); /* Initialize directory structures so -I flags
|
||||
* can be processed correctly */
|
||||
|
||||
/*
|
||||
* Initialize directory structures so -I flags can be processed
|
||||
* correctly, if we have a different objdir, then let the directory
|
||||
* know our curdir.
|
||||
*/
|
||||
Dir_Init(curdir != objdir ? curdir : NULL);
|
||||
Parse_Init(); /* Need to initialize the paths of #include
|
||||
* directories */
|
||||
Var_Init(); /* As well as the lists of variables for
|
||||
* parsing arguments */
|
||||
str_init();
|
||||
if (objdir != curdir)
|
||||
Dir_AddDir(dirSearchPath, curdir);
|
||||
str_init();
|
||||
Var_Set(".CURDIR", curdir, VAR_GLOBAL);
|
||||
Var_Set(".OBJDIR", objdir, VAR_GLOBAL);
|
||||
|
||||
@ -660,10 +663,10 @@ main(argc, argv)
|
||||
for (cp = start; *cp != '\0' && *cp != ':'; cp++)
|
||||
continue;
|
||||
if (*cp == '\0') {
|
||||
Dir_AddDir(sysIncPath, start);
|
||||
(void) Dir_AddDir(sysIncPath, start);
|
||||
} else {
|
||||
*cp++ = '\0';
|
||||
Dir_AddDir(sysIncPath, start);
|
||||
(void) Dir_AddDir(sysIncPath, start);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -735,7 +738,7 @@ main(argc, argv)
|
||||
savec = *cp;
|
||||
*cp = '\0';
|
||||
/* Add directory to search path */
|
||||
Dir_AddDir(dirSearchPath, path);
|
||||
(void) Dir_AddDir(dirSearchPath, path);
|
||||
*cp = savec;
|
||||
path = cp + 1;
|
||||
} while (savec == ':');
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.19 1997/05/06 22:29:43 mycroft Exp $
|
||||
.\" $NetBSD: make.1,v 1.20 1997/05/08 21:24:45 gwr Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -932,6 +932,11 @@ no effect.
|
||||
.\" .It Ic .NOTPARALLEL
|
||||
.\" The named targets are executed in non parallel mode. If no targets are
|
||||
.\" specified, then all targets are executed in non parallel mode.
|
||||
.It Ic .NOPATH
|
||||
Apply the
|
||||
.Ic .NOPATH
|
||||
attribute to any specified sources. Targets with this attribute do not
|
||||
are not being looked up in the search path.
|
||||
.It Ic .NOTPARALLEL
|
||||
Disable parallel mode.
|
||||
.It Ic .NO_PARALLEL
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make.h,v 1.16 1997/05/02 14:24:28 christos Exp $ */
|
||||
/* $NetBSD: make.h,v 1.17 1997/05/08 21:24:46 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -210,6 +210,7 @@ typedef struct GNode {
|
||||
#define OP_NOTMAIN 0x00008000 /* The node is exempt from normal 'main
|
||||
* target' processing in parse.c */
|
||||
#define OP_PHONY 0x00010000 /* Not a file target; run always */
|
||||
#define OP_NOPATH 0x00020000 /* Don't search for file in the path */
|
||||
/* Attributes applied by PMake */
|
||||
#define OP_TRANSFORM 0x80000000 /* The node is a transformation rule */
|
||||
#define OP_MEMBER 0x40000000 /* Target is a member of an archive */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.31 1997/05/07 13:12:33 mycroft Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.32 1997/05/08 21:24:48 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.31 1997/05/07 13:12:33 mycroft Exp $";
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.32 1997/05/08 21:24:48 gwr Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -163,6 +163,7 @@ typedef enum {
|
||||
Main, /* .MAIN and we don't have anything user-specified to
|
||||
* make */
|
||||
NoExport, /* .NOEXPORT */
|
||||
NoPath, /* .NOPATH */
|
||||
Not, /* Not special */
|
||||
NotParallel, /* .NOTPARALELL */
|
||||
Null, /* .NULL */
|
||||
@ -215,6 +216,7 @@ static struct {
|
||||
{ ".MAKE", Attribute, OP_MAKE },
|
||||
{ ".MAKEFLAGS", MFlags, 0 },
|
||||
{ ".MFLAGS", MFlags, 0 },
|
||||
{ ".NOPATH", NoPath, OP_NOPATH },
|
||||
{ ".NOTMAIN", Attribute, OP_NOTMAIN },
|
||||
{ ".NOTPARALLEL", NotParallel, 0 },
|
||||
{ ".NO_PARALLEL", NotParallel, 0 },
|
||||
@ -653,7 +655,7 @@ ParseAddDir(path, name)
|
||||
ClientData path;
|
||||
ClientData name;
|
||||
{
|
||||
Dir_AddDir((Lst) path, (char *) name);
|
||||
(void) Dir_AddDir((Lst) path, (char *) name);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -835,6 +837,7 @@ ParseDoDependency (line)
|
||||
* use Make_HandleUse to actually
|
||||
* apply the .DEFAULT commands.
|
||||
* .PHONY The list of targets
|
||||
* .NOPATH Don't search for file in the path
|
||||
* .BEGIN
|
||||
* .END
|
||||
* .INTERRUPT Are not to be considered the
|
||||
@ -1542,7 +1545,7 @@ void
|
||||
Parse_AddIncludeDir (dir)
|
||||
char *dir; /* The name of the directory to add */
|
||||
{
|
||||
Dir_AddDir (parseIncPath, dir);
|
||||
(void) Dir_AddDir (parseIncPath, dir);
|
||||
}
|
||||
|
||||
/*-
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: suff.c,v 1.15 1997/05/06 22:06:58 mycroft Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.16 1997/05/08 21:24:50 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.15 1997/05/06 22:06:58 mycroft Exp $";
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.16 1997/05/08 21:24:50 gwr Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -2065,7 +2065,7 @@ sfnd_abort:
|
||||
* on the lhs of a dependency operator or [XXX] it has neither
|
||||
* children or commands) as the old pmake did.
|
||||
*/
|
||||
if ((gn->type & OP_PHONY) == 0) {
|
||||
if ((gn->type & (OP_PHONY|OP_NOPATH)) == 0) {
|
||||
gn->path = Dir_FindFile(gn->name,
|
||||
(targ == NULL ? dirSearchPath :
|
||||
targ->suff->searchPath));
|
||||
|
Loading…
Reference in New Issue
Block a user