mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-01 14:14:56 +00:00
Import bmake-20240520
Intersting/relevant changes since bmake-20240508 ChangeLog since bmake-20240508 2024-05-20 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): Merge with NetBSD make, pick up o dir.c: in FindFile restore last search of .CURDIR even for includes, as a number of existing makefiles are broken otherwise. 2024-05-19 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240519 Merge with NetBSD make, pick up o dir.c: Add Dir_FindInclude, FindFile without looking in .CURDIR. Also fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty. o main.c: no need to set .DOTLAST in sysIncPath
This commit is contained in:
parent
3c2ab5fddc
commit
29efb3dcae
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2024-05-20 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION):
|
||||
Merge with NetBSD make, pick up
|
||||
o dir.c: in FindFile restore last search of .CURDIR even for
|
||||
includes, as a number of existing makefiles are broken otherwise.
|
||||
|
||||
2024-05-19 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240519
|
||||
Merge with NetBSD make, pick up
|
||||
o dir.c: Add Dir_FindInclude, FindFile without looking in .CURDIR.
|
||||
Also fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty.
|
||||
o main.c: no need to set .DOTLAST in sysIncPath
|
||||
|
||||
2024-05-07 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240508
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1,2 +1,2 @@
|
|||
# keep this compatible with sh and make
|
||||
_MAKE_VERSION=20240508
|
||||
_MAKE_VERSION=20240520
|
||||
|
|
51
dir.c
51
dir.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.c,v 1.286 2023/12/29 18:53:24 rillig Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.290 2024/05/20 19:14:12 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -132,7 +132,7 @@
|
|||
#include "job.h"
|
||||
|
||||
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
|
||||
MAKE_RCSID("$NetBSD: dir.c,v 1.286 2023/12/29 18:53:24 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: dir.c,v 1.290 2024/05/20 19:14:12 sjg Exp $");
|
||||
|
||||
/*
|
||||
* A search path is a list of CachedDir structures. A CachedDir has in it the
|
||||
|
@ -566,10 +566,12 @@ void
|
|||
Dir_SetSYSPATH(void)
|
||||
{
|
||||
CachedDirListNode *ln;
|
||||
|
||||
SearchPath *path = Lst_IsEmpty(&sysIncPath->dirs)
|
||||
? defSysIncPath : sysIncPath;
|
||||
|
||||
Var_ReadOnly(".SYSPATH", false);
|
||||
Global_Delete(".SYSPATH");
|
||||
for (ln = sysIncPath->dirs.first; ln != NULL; ln = ln->next) {
|
||||
for (ln = path->dirs.first; ln != NULL; ln = ln->next) {
|
||||
CachedDir *dir = ln->datum;
|
||||
Global_Append(".SYSPATH", dir->name);
|
||||
}
|
||||
|
@ -1142,15 +1144,16 @@ FindFileAbsolute(SearchPath *path, bool seenDotLast,
|
|||
* Input:
|
||||
* name the file to find
|
||||
* path the directories to search, or NULL
|
||||
* isinclude if true, do not search .CURDIR at all
|
||||
*
|
||||
* Results:
|
||||
* The freshly allocated path to the file, or NULL.
|
||||
*/
|
||||
char *
|
||||
Dir_FindFile(const char *name, SearchPath *path)
|
||||
static char *
|
||||
FindFile(const char *name, SearchPath *path, bool isinclude)
|
||||
{
|
||||
char *file; /* the current filename to check */
|
||||
bool seenDotLast = false; /* true if we should search dot last */
|
||||
bool seenDotLast = isinclude; /* true if we should search dot last */
|
||||
struct cached_stat cst;
|
||||
const char *trailing_dot = ".";
|
||||
const char *base = str_basename(name);
|
||||
|
@ -1163,7 +1166,7 @@ Dir_FindFile(const char *name, SearchPath *path)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (path->dirs.first != NULL) {
|
||||
if (!seenDotLast && path->dirs.first != NULL) {
|
||||
CachedDir *dir = path->dirs.first->datum;
|
||||
if (dir == dotLast) {
|
||||
seenDotLast = true;
|
||||
|
@ -1244,6 +1247,38 @@ Dir_FindFile(const char *name, SearchPath *path)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the file with the given name along the given search path.
|
||||
*
|
||||
* Input:
|
||||
* name the file to find
|
||||
* path the directories to search, or NULL
|
||||
*
|
||||
* Results:
|
||||
* The freshly allocated path to the file, or NULL.
|
||||
*/
|
||||
char *
|
||||
Dir_FindFile(const char *name, SearchPath *path)
|
||||
{
|
||||
return FindFile(name, path, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the include file with the given name along the given search path.
|
||||
*
|
||||
* Input:
|
||||
* name the file to find
|
||||
* path the directories to search, or NULL
|
||||
*
|
||||
* Results:
|
||||
* The freshly allocated path to the file, or NULL.
|
||||
*/
|
||||
char *
|
||||
Dir_FindInclude(const char *name, SearchPath *path)
|
||||
{
|
||||
return FindFile(name, path, true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Search for 'needle' starting at the directory 'here' and then working our
|
||||
|
|
3
dir.h
3
dir.h
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.h,v 1.47 2023/01/24 00:24:02 sjg Exp $ */
|
||||
/* $NetBSD: dir.h,v 1.48 2024/05/19 20:09:40 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -86,6 +86,7 @@ void Dir_SetSYSPATH(void);
|
|||
bool Dir_HasWildcards(const char *) MAKE_ATTR_USE;
|
||||
void SearchPath_Expand(SearchPath *, const char *, StringList *);
|
||||
char *Dir_FindFile(const char *, SearchPath *) MAKE_ATTR_USE;
|
||||
char *Dir_FindInclude(const char *, SearchPath *) MAKE_ATTR_USE;
|
||||
char *Dir_FindHereOrAbove(const char *, const char *) MAKE_ATTR_USE;
|
||||
void Dir_UpdateMTime(GNode *, bool);
|
||||
CachedDir *SearchPath_Add(SearchPath *, const char *);
|
||||
|
|
6
getopt.c
6
getopt.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getopt.c,v 1.29 2014/06/05 22:00:22 christos Exp $ */
|
||||
/* $NetBSD: getopt.c,v 1.30 2024/01/19 18:41:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
|
@ -58,8 +58,8 @@ int
|
|||
getopt(int nargc, char * const nargv[], const char *ostr)
|
||||
{
|
||||
extern char *__progname;
|
||||
static const char *place = EMSG; /* option letter processing */
|
||||
char *oli; /* option letter list index */
|
||||
static const char *place = EMSG; /* option letter processing */
|
||||
const char *oli; /* option letter list index */
|
||||
|
||||
#ifndef BSD4_4
|
||||
if (!__progname) {
|
||||
|
|
6
main.c
6
main.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.615 2024/05/07 18:26:22 sjg Exp $ */
|
||||
/* $NetBSD: main.c,v 1.616 2024/05/19 17:55:54 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -111,7 +111,7 @@
|
|||
#include "trace.h"
|
||||
|
||||
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.615 2024/05/07 18:26:22 sjg Exp $");
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.616 2024/05/19 17:55:54 sjg Exp $");
|
||||
#if defined(MAKE_NATIVE)
|
||||
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
|
||||
"The Regents of the University of California. "
|
||||
|
@ -1174,8 +1174,6 @@ InitDefSysIncPath(char *syspath)
|
|||
else
|
||||
syspath = bmake_strdup(syspath);
|
||||
|
||||
/* do NOT search .CURDIR first for .include <makefile> */
|
||||
SearchPath_Add(defSysIncPath, ".DOTLAST");
|
||||
for (start = syspath; *start != '\0'; start = p) {
|
||||
for (p = start; *p != '\0' && *p != ':'; p++)
|
||||
continue;
|
||||
|
|
6
parse.c
6
parse.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: parse.c,v 1.722 2024/04/27 17:33:46 rillig Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.723 2024/05/19 20:09:40 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -121,7 +121,7 @@
|
|||
#include "pathnames.h"
|
||||
|
||||
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: parse.c,v 1.722 2024/04/27 17:33:46 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: parse.c,v 1.723 2024/05/19 20:09:40 sjg Exp $");
|
||||
|
||||
/* Detects a multiple-inclusion guard in a makefile. */
|
||||
typedef enum {
|
||||
|
@ -1269,7 +1269,7 @@ IncludeFile(const char *file, bool isSystem, bool depinc, bool silent)
|
|||
if (fullname == NULL) {
|
||||
SearchPath *path = Lst_IsEmpty(&sysIncPath->dirs)
|
||||
? defSysIncPath : sysIncPath;
|
||||
fullname = Dir_FindFile(file, path);
|
||||
fullname = Dir_FindInclude(file, path);
|
||||
}
|
||||
|
||||
if (fullname == NULL) {
|
||||
|
|
|
@ -2,7 +2,7 @@ Expanding "depsrc-phony-pr-15164-*-wildcard"...
|
|||
Expanding "deptgt-phony-pr-15164-*-wildcard"...
|
||||
Searching for .depend ...
|
||||
failed.
|
||||
Searching for .depend ...[dot last]...
|
||||
Searching for .depend ...
|
||||
. ...
|
||||
failed.
|
||||
Wildcard expanding "all"...
|
||||
|
|
Loading…
Reference in a new issue