mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-01 14:14:56 +00:00
Import bmake-20240430
Intersting/relevant changes since bmake-20240309 ChangeLog since bmake-20240309 2024-04-30 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240430 Merge with NetBSD make, pick up o main.c: ensure '.include <makefile>' respects MAKESYSPATH. Dir_FindFile will search .CURDIR first unless ".DOTLAST" is seen. 2024-04-28 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240428 Merge with NetBSD make, pick up o simplify freeing of lists o arch.c: trim pointless comments o var.c: delay variable assignments until actually needed don't reallocate memory after evaluating an expression, result is almost always short-lived. 2024-04-26 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240426 Merge with NetBSD make, pick up o job.c: in debug output, print the directory in which a job failed at same time as failed target so it is more easily found in build log. 2024-04-24 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240424 Merge with NetBSD make, pick up o clean up comments, code and tests 2024-04-23 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240422 Merge with NetBSD make, pick up o var.c: avoid LazyBuf for :*time modifiers. LazyBuf's are not nul terminated so not suitable for passing to functions that expect that. These modifiers are used sparingly so an extra allocation is not a problem. 2024-04-20 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240420 Merge with NetBSD make, pick up o provide more context information for parse/evaluate errors 2024-04-14 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240414 Merge with NetBSD make, pick up o parse.c: print -dp debug info earlier so we see which .if or .for line is being parsed. 2024-04-04 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240404 Merge with NetBSD make, pick up o fix some unit tests for Cygwin o parse.c: exit immediately after reading a null byte from a makefile * fix generation of bmake.cat1 2024-03-19 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20240314 Add/Improve support for Cygwin o uname -s output isn't useful so allow configure to set FORCE_MAKE_OS - to force the value of .MAKE.OS and use Cygwin which matches uname -o o fix some unit-tests for Cygwin * configure.in: use_makefile=no for Cygwin et al. NOTE: bmake does not support Cygwin and likely never will, mk/ChangeLog since bmake-20240309 2024-04-24 Simon J Gerraty <sjg@beast.crufty.net> * meta.autodep.mk: do not override start_utc 2024-04-18 Simon J Gerraty <sjg@beast.crufty.net> * sys.dirdeps.mk: set defaults for DEP_* at level 0 too. These help when first include of Makefile.depend happens in a leaf dir. * install-mk (MK_VERSION): 20240414 2024-04-09 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240408 * init.mk: allow for _ as well as . to join V and Q from QUALIFIED_VAR_LIST and VAR_QUALIFIER_LIST. * progs.mk: avoid overlap between PROG_VARS and init.mk's QUALIFIED_VAR_LIST since PROG would also match its VAR_QUALIFIER_LIST, libs.mk does not have the same issue. * subdir.mk: _SUBDIRUSE for realinstall should run install remove include of ${.CURDIR}/Makefile.inc that can be done via local.subdir.mk where needed * own.mk: do not conflict with man.mk 2024-03-19 Simon J Gerraty <sjg@beast.crufty.net> * install-mk (MK_VERSION): 20240314 * add sys/Cygwin.mk from Christian Franke
This commit is contained in:
parent
368b06ce6b
commit
507951f550
75
ChangeLog
75
ChangeLog
|
@ -1,3 +1,74 @@
|
|||
2024-04-30 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240430
|
||||
Merge with NetBSD make, pick up
|
||||
o main.c: ensure '.include <makefile>' respects MAKESYSPATH.
|
||||
Dir_FindFile will search .CURDIR first unless ".DOTLAST" is seen.
|
||||
|
||||
2024-04-28 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240428
|
||||
Merge with NetBSD make, pick up
|
||||
o simplify freeing of lists
|
||||
o arch.c: trim pointless comments
|
||||
o var.c: delay variable assignments until actually needed
|
||||
don't reallocate memory after evaluating an expression, result is
|
||||
almost always short-lived.
|
||||
|
||||
2024-04-26 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240426
|
||||
Merge with NetBSD make, pick up
|
||||
o job.c: in debug output, print the directory in which a job
|
||||
failed at same time as failed target so it is more easily found in
|
||||
build log.
|
||||
|
||||
2024-04-24 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240424
|
||||
Merge with NetBSD make, pick up
|
||||
o clean up comments, code and tests
|
||||
|
||||
2024-04-23 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240422
|
||||
Merge with NetBSD make, pick up
|
||||
o var.c: avoid LazyBuf for :*time modifiers.
|
||||
LazyBuf's are not nul terminated so not suitable for passing to
|
||||
functions that expect that. These modifiers are used sparingly so
|
||||
an extra allocation is not a problem.
|
||||
|
||||
2024-04-20 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240420
|
||||
Merge with NetBSD make, pick up
|
||||
o provide more context information for parse/evaluate errors
|
||||
|
||||
2024-04-14 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240414
|
||||
Merge with NetBSD make, pick up
|
||||
o parse.c: print -dp debug info earlier so we see which
|
||||
.if or .for line is being parsed.
|
||||
|
||||
2024-04-04 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240404
|
||||
Merge with NetBSD make, pick up
|
||||
o fix some unit tests for Cygwin
|
||||
o parse.c: exit immediately after reading a null byte from a makefile
|
||||
|
||||
* fix generation of bmake.cat1
|
||||
|
||||
2024-03-19 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION (_MAKE_VERSION): 20240314
|
||||
Add/Improve support for Cygwin
|
||||
o uname -s output isn't useful so allow configure to
|
||||
set FORCE_MAKE_OS - to force the value of .MAKE.OS
|
||||
and use Cygwin which matches uname -o
|
||||
o fix some unit-tests for Cygwin
|
||||
|
||||
2024-03-10 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* boot-strap: tests can take a long time; use a cookie to
|
||||
|
@ -2175,10 +2246,10 @@
|
|||
|
||||
* VERSION (_MAKE_VERSION): 20200418
|
||||
|
||||
* configure.in: use_makefile=no for cygwin et al.
|
||||
* configure.in: use_makefile=no for Cygwin et al.
|
||||
case insensitive filesystems just don't work if both
|
||||
makefile and Makefile exist.
|
||||
NOTE: bmake does not support cygwin and likely never will,
|
||||
NOTE: bmake does not support Cygwin and likely never will,
|
||||
but if brave souls want to try it - help them out.
|
||||
|
||||
2020-04-02 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
|
6
Makefile
6
Makefile
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.126 2024/03/10 17:46:44 sjg Exp $
|
||||
# $Id: Makefile,v 1.127 2024/03/19 16:03:23 sjg Exp $
|
||||
|
||||
PROG= bmake
|
||||
|
||||
|
@ -48,7 +48,7 @@ CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE
|
|||
CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
|
||||
COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
|
||||
|
||||
.for x in FORCE_MACHINE FORCE_MACHINE_ARCH
|
||||
.for x in FORCE_MAKE_OS FORCE_MACHINE FORCE_MACHINE_ARCH
|
||||
.ifdef $x
|
||||
COPTS.main.c+= "-D$x=\"${$x}\""
|
||||
.endif
|
||||
|
@ -90,7 +90,7 @@ OS := ${.MAKE.OS:U${uname -s:L:sh}}
|
|||
# are we 4.4BSD ?
|
||||
isBSD44:=${BSD44_LIST:M${OS}}
|
||||
|
||||
.if ${isBSD44} == "" && ${OS:NCYGWIN*:NDarwin:NLinux} != ""
|
||||
.if ${isBSD44} == "" && ${OS:NCygwin:NDarwin:NLinux} != ""
|
||||
MANTARGET?= cat
|
||||
.if ${MACHINE} == "sun386"
|
||||
# even I don't have one of these anymore :-)
|
||||
|
|
|
@ -5,6 +5,7 @@ _MAKE_VERSION?=@_MAKE_VERSION@
|
|||
prefix?= @prefix@
|
||||
srcdir= @srcdir@
|
||||
CC= @CC@
|
||||
@force_make_os@MAKE_OS?= @make_os@
|
||||
@force_machine@MACHINE?= @machine@
|
||||
@force_machine_arch@MACHINE_ARCH?= @machine_arch@
|
||||
DEFAULT_SYS_PATH?= @default_sys_path@
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1,2 +1,2 @@
|
|||
# keep this compatible with sh and make
|
||||
_MAKE_VERSION=20240309
|
||||
_MAKE_VERSION=20240430
|
||||
|
|
250
arch.c
250
arch.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $ */
|
||||
/* $NetBSD: arch.c,v 1.217 2024/04/27 20:41:32 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -147,7 +147,7 @@ struct ar_hdr {
|
|||
#include "dir.h"
|
||||
|
||||
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
|
||||
MAKE_RCSID("$NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: arch.c,v 1.217 2024/04/27 20:41:32 rillig Exp $");
|
||||
|
||||
typedef struct List ArchList;
|
||||
typedef struct ListNode ArchListNode;
|
||||
|
@ -155,7 +155,7 @@ typedef struct ListNode ArchListNode;
|
|||
static ArchList archives; /* The archives we've already examined */
|
||||
|
||||
typedef struct Arch {
|
||||
char *name; /* Name of archive */
|
||||
char *name;
|
||||
HashTable members; /* All the members of the archive described
|
||||
* by <name, struct ar_hdr *> key/value pairs */
|
||||
char *fnametab; /* Extended name table strings */
|
||||
|
@ -199,12 +199,10 @@ static int ArchSVR4Entry(Arch *, char *, size_t, FILE *);
|
|||
|
||||
#ifdef CLEANUP
|
||||
static void
|
||||
ArchFree(void *ap)
|
||||
ArchFree(Arch *a)
|
||||
{
|
||||
Arch *a = ap;
|
||||
HashIter hi;
|
||||
|
||||
/* Free memory from hash entries */
|
||||
HashIter_Init(&hi, &a->members);
|
||||
while (HashIter_Next(&hi) != NULL)
|
||||
free(hi.entry->value);
|
||||
|
@ -217,32 +215,22 @@ ArchFree(void *ap)
|
|||
#endif
|
||||
|
||||
/* Return "archive(member)". */
|
||||
static char *
|
||||
MAKE_ATTR_NOINLINE static char *
|
||||
FullName(const char *archive, const char *member)
|
||||
{
|
||||
size_t len1 = strlen(archive);
|
||||
size_t len3 = strlen(member);
|
||||
char *result = bmake_malloc(len1 + 1 + len3 + 1 + 1);
|
||||
memcpy(result, archive, len1);
|
||||
memcpy(result + len1, "(", 1);
|
||||
memcpy(result + len1 + 1, member, len3);
|
||||
memcpy(result + len1 + 1 + len3, ")", 1 + 1);
|
||||
return result;
|
||||
Buffer buf;
|
||||
Buf_Init(&buf);
|
||||
Buf_AddStr(&buf, archive);
|
||||
Buf_AddStr(&buf, "(");
|
||||
Buf_AddStr(&buf, member);
|
||||
Buf_AddStr(&buf, ")");
|
||||
return Buf_DoneData(&buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse an archive specification such as "archive.a(member1 member2.${EXT})",
|
||||
* adding nodes for the expanded members to gns. Nodes are created as
|
||||
* necessary.
|
||||
*
|
||||
* Input:
|
||||
* pp The start of the specification.
|
||||
* gns The list on which to place the nodes.
|
||||
* scope The scope in which to expand variables.
|
||||
*
|
||||
* Output:
|
||||
* return True if it was a valid specification.
|
||||
* *pp Points to the first non-space after the archive spec.
|
||||
* adding nodes for the expanded members to gns. If successful, advance pp
|
||||
* beyond the archive specification and any trailing whitespace.
|
||||
*/
|
||||
bool
|
||||
Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
|
||||
|
@ -323,12 +311,6 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the specification ends without a closing parenthesis,
|
||||
* chances are there's something wrong (like a missing
|
||||
* backslash), so it's better to return failure than allow
|
||||
* such things to happen
|
||||
*/
|
||||
if (*cp == '\0') {
|
||||
Parse_Error(PARSE_FATAL,
|
||||
"No closing parenthesis "
|
||||
|
@ -336,9 +318,6 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we didn't move anywhere, we must be done
|
||||
*/
|
||||
if (cp == mem.str)
|
||||
break;
|
||||
|
||||
|
@ -375,8 +354,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
|
|||
/*
|
||||
* Must contain dynamic sources, so we can't
|
||||
* deal with it now. Just create an ARCHV node
|
||||
* for the thing and let SuffExpandChildren
|
||||
* handle it.
|
||||
* and let SuffExpandChildren handle it.
|
||||
*/
|
||||
gn = Targ_GetNode(fullName);
|
||||
gn->type |= OP_ARCHV;
|
||||
|
@ -413,13 +391,6 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
|
|||
gn = Targ_GetNode(fullname);
|
||||
free(fullname);
|
||||
|
||||
/*
|
||||
* We've found the node, but have to make sure the
|
||||
* rest of the world knows it's an archive member,
|
||||
* without having to constantly check for parentheses,
|
||||
* so we type the thing with the OP_ARCHV bit before
|
||||
* we place it on the end of the provided list.
|
||||
*/
|
||||
gn->type |= OP_ARCHV;
|
||||
Lst_Append(gns, gn);
|
||||
}
|
||||
|
@ -431,23 +402,13 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
|
|||
FStr_Done(&lib);
|
||||
|
||||
cp++; /* skip the ')' */
|
||||
/* We promised that pp would be set up at the next non-space. */
|
||||
cpp_skip_whitespace(&cp);
|
||||
*pp += cp - *pp;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Locate a member of an archive, given the path of the archive and the path
|
||||
* of the desired member.
|
||||
*
|
||||
* Input:
|
||||
* archive Path to the archive
|
||||
* member Name of member; only its basename is used.
|
||||
* addToCache True if archive should be cached if not already so.
|
||||
*
|
||||
* Results:
|
||||
* The ar_hdr for the member, or NULL.
|
||||
* Locate a member in an archive.
|
||||
*
|
||||
* See ArchFindMember for an almost identical copy of this code.
|
||||
*/
|
||||
|
@ -459,15 +420,11 @@ ArchStatMember(const char *archive, const char *member, bool addToCache)
|
|||
size_t size; /* Size of archive member */
|
||||
char magic[SARMAG];
|
||||
ArchListNode *ln;
|
||||
Arch *ar; /* Archive descriptor */
|
||||
struct ar_hdr arh; /* archive-member header for reading archive */
|
||||
Arch *ar;
|
||||
struct ar_hdr arh;
|
||||
char memName[MAXPATHLEN + 1];
|
||||
/* Current member name while hashing. */
|
||||
|
||||
/*
|
||||
* Because of space constraints and similar things, files are archived
|
||||
* using their basename, not the entire path.
|
||||
*/
|
||||
member = str_basename(member);
|
||||
|
||||
for (ln = archives.first; ln != NULL; ln = ln->next) {
|
||||
|
@ -499,11 +456,8 @@ ArchStatMember(const char *archive, const char *member, bool addToCache)
|
|||
|
||||
if (!addToCache) {
|
||||
/*
|
||||
* Caller doesn't want the thing cached, just use
|
||||
* ArchFindMember to read the header for the member out and
|
||||
* close down the stream again. Since the archive is not to be
|
||||
* cached, we assume there's no need to allocate extra room
|
||||
* for the header we're returning, so just declare it static.
|
||||
* Since the archive is not to be cached, assume there's no
|
||||
* need to allocate the header, so just declare it static.
|
||||
*/
|
||||
static struct ar_hdr sarh;
|
||||
|
||||
|
@ -515,18 +469,10 @@ ArchStatMember(const char *archive, const char *member, bool addToCache)
|
|||
return &sarh;
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't have this archive on the list yet, so we want to find out
|
||||
* everything that's in it and cache it so we can get at it quickly.
|
||||
*/
|
||||
arch = fopen(archive, "r");
|
||||
if (arch == NULL)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* We use the ARMAG string to make sure this is an archive we
|
||||
* can handle...
|
||||
*/
|
||||
if (fread(magic, SARMAG, 1, arch) != 1 ||
|
||||
strncmp(magic, ARMAG, SARMAG) != 0) {
|
||||
(void)fclose(arch);
|
||||
|
@ -543,17 +489,9 @@ ArchStatMember(const char *archive, const char *member, bool addToCache)
|
|||
while (fread(&arh, sizeof arh, 1, arch) == 1) {
|
||||
char *nameend;
|
||||
|
||||
/* If the header is bogus, there's no way we can recover. */
|
||||
if (strncmp(arh.AR_FMAG, ARFMAG, sizeof arh.AR_FMAG) != 0)
|
||||
goto badarch;
|
||||
goto bad_archive;
|
||||
|
||||
/*
|
||||
* We need to advance the stream's pointer to the start of the
|
||||
* next header. Files are padded with newlines to an even-byte
|
||||
* boundary, so we need to extract the size of the file from
|
||||
* the 'size' field of the header and round it up during the
|
||||
* seek.
|
||||
*/
|
||||
arh.AR_SIZE[sizeof arh.AR_SIZE - 1] = '\0';
|
||||
size = (size_t)strtol(arh.AR_SIZE, NULL, 10);
|
||||
|
||||
|
@ -572,7 +510,7 @@ ArchStatMember(const char *archive, const char *member, bool addToCache)
|
|||
/* svr4 magic mode; handle it */
|
||||
switch (ArchSVR4Entry(ar, memName, size, arch)) {
|
||||
case -1: /* Invalid data */
|
||||
goto badarch;
|
||||
goto bad_archive;
|
||||
case 0: /* List of files entry */
|
||||
continue;
|
||||
default: /* Got the entry */
|
||||
|
@ -596,12 +534,12 @@ ArchStatMember(const char *archive, const char *member, bool addToCache)
|
|||
memName + sizeof AR_EFMT1 - 1);
|
||||
|
||||
if (elen > MAXPATHLEN)
|
||||
goto badarch;
|
||||
goto bad_archive;
|
||||
if (fread(memName, elen, 1, arch) != 1)
|
||||
goto badarch;
|
||||
goto bad_archive;
|
||||
memName[elen] = '\0';
|
||||
if (fseek(arch, -(long)elen, SEEK_CUR) != 0)
|
||||
goto badarch;
|
||||
goto bad_archive;
|
||||
if (DEBUG(ARCH) || DEBUG(MAKE))
|
||||
debug_printf(
|
||||
"ArchStatMember: "
|
||||
|
@ -617,21 +555,18 @@ ArchStatMember(const char *archive, const char *member, bool addToCache)
|
|||
HashTable_Set(&ar->members, memName, cached_hdr);
|
||||
}
|
||||
|
||||
/* Files are padded with newlines to an even-byte boundary. */
|
||||
if (fseek(arch, ((long)size + 1) & ~1, SEEK_CUR) != 0)
|
||||
goto badarch;
|
||||
goto bad_archive;
|
||||
}
|
||||
|
||||
fclose(arch);
|
||||
|
||||
Lst_Append(&archives, ar);
|
||||
|
||||
/*
|
||||
* Now that the archive has been read and cached, we can look into
|
||||
* the addToCache table to find the desired member's header.
|
||||
*/
|
||||
return HashTable_FindValue(&ar->members, member);
|
||||
|
||||
badarch:
|
||||
bad_archive:
|
||||
fclose(arch);
|
||||
HashTable_Done(&ar->members);
|
||||
free(ar->fnametab);
|
||||
|
@ -736,37 +671,27 @@ ArchiveMember_HasName(const struct ar_hdr *hdr,
|
|||
* In archives created by GNU binutils 2.27, the member names end
|
||||
* with a slash.
|
||||
*/
|
||||
if (ar_name[namelen] == '/' &&
|
||||
(namelen == ar_name_len || ar_name[namelen + 1] == ' '))
|
||||
if (ar_name[namelen] == '/' && ar_name[namelen + 1] == ' ')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Locate a member of an archive, given the path of the archive and the path
|
||||
* of the desired member.
|
||||
* Load the header of an archive member. The mode is "r" for read-only
|
||||
* access, "r+" for read-write access.
|
||||
*
|
||||
* Input:
|
||||
* archive Path to the archive
|
||||
* member Name of member. If it is a path, only the last
|
||||
* component is used.
|
||||
* out_arh Archive header to be filled in
|
||||
* mode "r" for read-only access, "r+" for read-write access
|
||||
*
|
||||
* Output:
|
||||
* return The archive file, positioned at the start of the
|
||||
* member's struct ar_hdr, or NULL if the member doesn't
|
||||
* exist.
|
||||
* *out_arh The current struct ar_hdr for member.
|
||||
* Upon successful return, the archive file is positioned at the start of the
|
||||
* member's struct ar_hdr. In case of a failure or if the member doesn't
|
||||
* exist, return NULL.
|
||||
*
|
||||
* See ArchStatMember for an almost identical copy of this code.
|
||||
*/
|
||||
static FILE *
|
||||
ArchFindMember(const char *archive, const char *member, struct ar_hdr *out_arh,
|
||||
const char *mode)
|
||||
ArchFindMember(const char *archive, const char *member,
|
||||
struct ar_hdr *out_arh, const char *mode)
|
||||
{
|
||||
FILE *arch; /* Stream to archive */
|
||||
FILE *arch;
|
||||
int size; /* Size of archive member */
|
||||
char magic[SARMAG];
|
||||
size_t len;
|
||||
|
@ -775,32 +700,20 @@ ArchFindMember(const char *archive, const char *member, struct ar_hdr *out_arh,
|
|||
if (arch == NULL)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* We use the ARMAG string to make sure this is an archive we
|
||||
* can handle...
|
||||
*/
|
||||
if (fread(magic, SARMAG, 1, arch) != 1 ||
|
||||
strncmp(magic, ARMAG, SARMAG) != 0) {
|
||||
fclose(arch);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Because of space constraints and similar things, files are archived
|
||||
* using their basename, not the entire path.
|
||||
*/
|
||||
/* Files are archived using their basename, not the entire path. */
|
||||
member = str_basename(member);
|
||||
|
||||
len = strlen(member);
|
||||
|
||||
while (fread(out_arh, sizeof *out_arh, 1, arch) == 1) {
|
||||
|
||||
if (strncmp(out_arh->AR_FMAG, ARFMAG,
|
||||
sizeof out_arh->AR_FMAG) != 0) {
|
||||
/*
|
||||
* The header is bogus, so the archive is bad
|
||||
* and there's no way we can recover...
|
||||
*/
|
||||
fclose(arch);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -811,14 +724,6 @@ ArchFindMember(const char *archive, const char *member, struct ar_hdr *out_arh,
|
|||
(int)sizeof out_arh->ar_date, out_arh->ar_date);
|
||||
|
||||
if (ArchiveMember_HasName(out_arh, member, len)) {
|
||||
/*
|
||||
* To make life easier for callers that want to update
|
||||
* the archive, we reposition the file at the start of
|
||||
* the header we just read before we return the
|
||||
* stream. In a more general situation, it might be
|
||||
* better to leave the file at the actual member,
|
||||
* rather than its header, but not here.
|
||||
*/
|
||||
if (fseek(arch, -(long)sizeof *out_arh, SEEK_CUR) !=
|
||||
0) {
|
||||
fclose(arch);
|
||||
|
@ -870,15 +775,10 @@ ArchFindMember(const char *archive, const char *member, struct ar_hdr *out_arh,
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This isn't the member we're after, so we need to advance the
|
||||
* stream's pointer to the start of the next header. Files are
|
||||
* padded with newlines to an even-byte boundary, so we need to
|
||||
* extract the size of the file from the 'size' field of the
|
||||
* header and round it up during the seek.
|
||||
*/
|
||||
/* Advance to the next member. */
|
||||
out_arh->AR_SIZE[sizeof out_arh->AR_SIZE - 1] = '\0';
|
||||
size = (int)strtol(out_arh->AR_SIZE, NULL, 10);
|
||||
/* Files are padded with newlines to an even-byte boundary. */
|
||||
if (fseek(arch, (size + 1) & ~1L, SEEK_CUR) != 0) {
|
||||
fclose(arch);
|
||||
return NULL;
|
||||
|
@ -890,17 +790,9 @@ ArchFindMember(const char *archive, const char *member, struct ar_hdr *out_arh,
|
|||
}
|
||||
|
||||
/*
|
||||
* Touch a member of an archive, on disk.
|
||||
* The GNode's modification time is left as-is.
|
||||
*
|
||||
* The st_mtime of the entire archive is also changed.
|
||||
* For a library, it may be required to run ranlib after this.
|
||||
*
|
||||
* Input:
|
||||
* gn Node of member to touch
|
||||
*
|
||||
* Results:
|
||||
* The 'time' field of the member's header is updated.
|
||||
* Update the ar_date of the member of an archive, on disk but not in the
|
||||
* GNode. Update the st_mtime of the entire archive as well. For a library,
|
||||
* it may be required to run ranlib after this.
|
||||
*/
|
||||
void
|
||||
Arch_Touch(GNode *gn)
|
||||
|
@ -1015,9 +907,6 @@ Arch_UpdateMemberMTime(GNode *gn)
|
|||
* TARGET variable for this node to be the node's name. Otherwise,
|
||||
* we set the TARGET variable to be the full path of the library,
|
||||
* as returned by Dir_FindFile.
|
||||
*
|
||||
* Input:
|
||||
* gn Node of library to find
|
||||
*/
|
||||
void
|
||||
Arch_FindLib(GNode *gn, SearchPath *path)
|
||||
|
@ -1059,20 +948,18 @@ RanlibOODate(const GNode *gn MAKE_ATTR_UNUSED)
|
|||
}
|
||||
|
||||
/*
|
||||
* Decide if a node with the OP_LIB attribute is out-of-date. Called from
|
||||
* GNode_IsOODate to make its life easier.
|
||||
* Decide if a node with the OP_LIB attribute is out-of-date.
|
||||
* The library is cached if it hasn't been already.
|
||||
*
|
||||
* There are several ways for a library to be out-of-date that are
|
||||
* not available to ordinary files. In addition, there are ways
|
||||
* that are open to regular files that are not available to
|
||||
* libraries.
|
||||
* There are several ways for a library to be out-of-date that are not
|
||||
* available to ordinary files. In addition, there are ways that are open to
|
||||
* regular files that are not available to libraries.
|
||||
*
|
||||
* A library that is only used as a source is never
|
||||
* considered out-of-date by itself. This does not preclude the
|
||||
* library's modification time from making its parent be out-of-date.
|
||||
* A library will be considered out-of-date for any of these reasons,
|
||||
* given that it is a target on a dependency line somewhere:
|
||||
* A library that is only used as a source is never considered out-of-date by
|
||||
* itself. This does not preclude the library's modification time from making
|
||||
* its parent be out-of-date. A library will be considered out-of-date for
|
||||
* any of these reasons, given that it is a target on a dependency line
|
||||
* somewhere:
|
||||
*
|
||||
* Its modification time is less than that of one of its sources
|
||||
* (gn->mtime < gn->youngestChild->mtime).
|
||||
|
@ -1092,18 +979,16 @@ bool
|
|||
Arch_LibOODate(GNode *gn)
|
||||
{
|
||||
|
||||
if (gn->type & OP_PHONY) {
|
||||
if (gn->type & OP_PHONY)
|
||||
return true;
|
||||
} else if (!GNode_IsTarget(gn) && Lst_IsEmpty(&gn->children)) {
|
||||
if (!GNode_IsTarget(gn) && Lst_IsEmpty(&gn->children))
|
||||
return false;
|
||||
} else if ((!Lst_IsEmpty(&gn->children) && gn->youngestChild == NULL) ||
|
||||
if ((!Lst_IsEmpty(&gn->children) && gn->youngestChild == NULL) ||
|
||||
(gn->mtime > now) ||
|
||||
(gn->youngestChild != NULL &&
|
||||
gn->mtime < gn->youngestChild->mtime)) {
|
||||
gn->mtime < gn->youngestChild->mtime))
|
||||
return true;
|
||||
} else {
|
||||
return RanlibOODate(gn);
|
||||
}
|
||||
return RanlibOODate(gn);
|
||||
}
|
||||
|
||||
/* Initialize the archives module. */
|
||||
|
@ -1118,26 +1003,25 @@ void
|
|||
Arch_End(void)
|
||||
{
|
||||
#ifdef CLEANUP
|
||||
Lst_DoneCall(&archives, ArchFree);
|
||||
ArchListNode *ln;
|
||||
|
||||
for (ln = archives.first; ln != NULL; ln = ln->next)
|
||||
ArchFree(ln->datum);
|
||||
Lst_Done(&archives);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
Arch_IsLib(GNode *gn)
|
||||
{
|
||||
static const char armag[] = "!<arch>\n";
|
||||
char buf[sizeof armag - 1];
|
||||
char buf[8];
|
||||
int fd;
|
||||
bool isLib;
|
||||
|
||||
if ((fd = open(gn->path, O_RDONLY)) == -1)
|
||||
return false;
|
||||
|
||||
if (read(fd, buf, sizeof buf) != sizeof buf) {
|
||||
(void)close(fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
isLib = read(fd, buf, sizeof buf) == sizeof buf
|
||||
&& memcmp(buf, "!<arch>\n", sizeof buf) == 0;
|
||||
(void)close(fd);
|
||||
|
||||
return memcmp(buf, armag, sizeof buf) == 0;
|
||||
return isLib;
|
||||
}
|
||||
|
|
2585
bmake.cat1
2585
bmake.cat1
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 89 KiB |
31
buf.c
31
buf.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: buf.c,v 1.57 2023/12/19 19:33:39 rillig Exp $ */
|
||||
/* $NetBSD: buf.c,v 1.58 2024/04/28 15:10:19 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -75,7 +75,7 @@
|
|||
#include "make.h"
|
||||
|
||||
/* "@(#)buf.c 8.1 (Berkeley) 6/6/93" */
|
||||
MAKE_RCSID("$NetBSD: buf.c,v 1.57 2023/12/19 19:33:39 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: buf.c,v 1.58 2024/04/28 15:10:19 rillig Exp $");
|
||||
|
||||
/* Make space in the buffer for adding at least 16 more bytes. */
|
||||
void
|
||||
|
@ -187,30 +187,3 @@ Buf_DoneData(Buffer *buf)
|
|||
|
||||
return data;
|
||||
}
|
||||
|
||||
#ifndef BUF_COMPACT_LIMIT
|
||||
# define BUF_COMPACT_LIMIT 128 /* worthwhile saving */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return the data from the buffer.
|
||||
* Leave the buffer itself in an indeterminate state.
|
||||
*
|
||||
* If the buffer size is much greater than its content,
|
||||
* a new buffer will be allocated and the old one freed.
|
||||
*/
|
||||
char *
|
||||
Buf_DoneDataCompact(Buffer *buf)
|
||||
{
|
||||
#if BUF_COMPACT_LIMIT > 0
|
||||
if (buf->cap - buf->len >= BUF_COMPACT_LIMIT) {
|
||||
/* We trust realloc to be smart */
|
||||
char *data = bmake_realloc(buf->data, buf->len + 1);
|
||||
buf->data = NULL;
|
||||
data[buf->len] = '\0'; /* XXX: unnecessary */
|
||||
Buf_Done(buf);
|
||||
return data;
|
||||
}
|
||||
#endif
|
||||
return Buf_DoneData(buf);
|
||||
}
|
||||
|
|
3
buf.h
3
buf.h
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: buf.h,v 1.49 2023/12/19 19:33:39 rillig Exp $ */
|
||||
/* $NetBSD: buf.h,v 1.50 2024/04/28 15:10:19 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -124,6 +124,5 @@ void Buf_Init(Buffer *);
|
|||
void Buf_InitSize(Buffer *, size_t);
|
||||
void Buf_Done(Buffer *);
|
||||
char *Buf_DoneData(Buffer *) MAKE_ATTR_USE;
|
||||
char *Buf_DoneDataCompact(Buffer *) MAKE_ATTR_USE;
|
||||
|
||||
#endif
|
||||
|
|
6
compat.c
6
compat.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: compat.c,v 1.254 2024/03/10 02:53:37 sjg Exp $ */
|
||||
/* $NetBSD: compat.c,v 1.255 2024/04/20 10:18:55 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -94,7 +94,7 @@
|
|||
#include "pathnames.h"
|
||||
|
||||
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: compat.c,v 1.254 2024/03/10 02:53:37 sjg Exp $");
|
||||
MAKE_RCSID("$NetBSD: compat.c,v 1.255 2024/04/20 10:18:55 rillig Exp $");
|
||||
|
||||
static GNode *curTarg = NULL;
|
||||
static pid_t compatChild;
|
||||
|
@ -237,7 +237,9 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
|
|||
errCheck = !(gn->type & OP_IGNORE);
|
||||
doIt = false;
|
||||
|
||||
EvalStack_Push(gn->name, NULL, NULL);
|
||||
cmdStart = Var_Subst(cmd, gn, VARE_WANTRES);
|
||||
EvalStack_Pop();
|
||||
/* TODO: handle errors */
|
||||
|
||||
if (cmdStart[0] == '\0') {
|
||||
|
|
19
cond.c
19
cond.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cond.c,v 1.362 2024/02/07 07:21:22 rillig Exp $ */
|
||||
/* $NetBSD: cond.c,v 1.363 2024/04/23 22:51:28 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -91,7 +91,7 @@
|
|||
#include "dir.h"
|
||||
|
||||
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
|
||||
MAKE_RCSID("$NetBSD: cond.c,v 1.362 2024/02/07 07:21:22 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: cond.c,v 1.363 2024/04/23 22:51:28 rillig Exp $");
|
||||
|
||||
/*
|
||||
* Conditional expressions conform to this grammar:
|
||||
|
@ -424,13 +424,12 @@ CondParser_StringExpr(CondParser *par, const char *start,
|
|||
* Parse a string from an expression or an optionally quoted string,
|
||||
* on the left-hand and right-hand sides of comparisons.
|
||||
*
|
||||
* Results:
|
||||
* Returns the string without any enclosing quotes, or NULL on error.
|
||||
* Sets out_quoted if the leaf was a quoted string literal.
|
||||
* Return the string without any enclosing quotes, or NULL on error.
|
||||
* Sets out_quoted if the leaf was a quoted string literal.
|
||||
*/
|
||||
static void
|
||||
static FStr
|
||||
CondParser_Leaf(CondParser *par, bool doEval, bool unquotedOK,
|
||||
FStr *out_str, bool *out_quoted)
|
||||
bool *out_quoted)
|
||||
{
|
||||
Buffer buf;
|
||||
FStr str;
|
||||
|
@ -492,7 +491,7 @@ CondParser_Leaf(CondParser *par, bool doEval, bool unquotedOK,
|
|||
buf.data = NULL;
|
||||
return_str:
|
||||
Buf_Done(&buf);
|
||||
*out_str = str;
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -602,7 +601,7 @@ CondParser_Comparison(CondParser *par, bool doEval)
|
|||
ComparisonOp op;
|
||||
bool lhsQuoted, rhsQuoted;
|
||||
|
||||
CondParser_Leaf(par, doEval, par->leftUnquotedOK, &lhs, &lhsQuoted);
|
||||
lhs = CondParser_Leaf(par, doEval, par->leftUnquotedOK, &lhsQuoted);
|
||||
if (lhs.str == NULL)
|
||||
goto done_lhs;
|
||||
|
||||
|
@ -622,7 +621,7 @@ CondParser_Comparison(CondParser *par, bool doEval)
|
|||
goto done_lhs;
|
||||
}
|
||||
|
||||
CondParser_Leaf(par, doEval, true, &rhs, &rhsQuoted);
|
||||
rhs = CondParser_Leaf(par, doEval, true, &rhsQuoted);
|
||||
t = rhs.str == NULL ? TOK_ERROR
|
||||
: !doEval ? TOK_FALSE
|
||||
: EvalCompare(par, lhs.str, lhsQuoted, op, rhs.str, rhsQuoted);
|
||||
|
|
40
configure
vendored
40
configure
vendored
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.71 for bmake 20240212.
|
||||
# Generated by GNU Autoconf 2.71 for bmake 20240314.
|
||||
#
|
||||
# Report bugs to <sjg@NetBSD.org>.
|
||||
#
|
||||
|
@ -610,8 +610,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='bmake'
|
||||
PACKAGE_TARNAME='bmake'
|
||||
PACKAGE_VERSION='20240212'
|
||||
PACKAGE_STRING='bmake 20240212'
|
||||
PACKAGE_VERSION='20240314'
|
||||
PACKAGE_STRING='bmake 20240314'
|
||||
PACKAGE_BUGREPORT='sjg@NetBSD.org'
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
@ -664,6 +664,8 @@ force_machine_arch
|
|||
machine_arch
|
||||
force_machine
|
||||
machine
|
||||
force_make_os
|
||||
make_os
|
||||
egrep
|
||||
LIBOBJS
|
||||
bmake_path_max
|
||||
|
@ -1291,7 +1293,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures bmake 20240212 to adapt to many kinds of systems.
|
||||
\`configure' configures bmake 20240314 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1353,7 +1355,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of bmake 20240212:";;
|
||||
short | recursive ) echo "Configuration of bmake 20240314:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1463,7 +1465,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
bmake configure 20240212
|
||||
bmake configure 20240314
|
||||
generated by GNU Autoconf 2.71
|
||||
|
||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
|
@ -1970,7 +1972,7 @@ cat >config.log <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by bmake $as_me 20240212, which was
|
||||
It was created by bmake $as_me 20240314, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
|
@ -2784,10 +2786,21 @@ no) ;;
|
|||
esac
|
||||
fi
|
||||
|
||||
FORCE_MAKE_OS=
|
||||
make_os=
|
||||
case "$OS" in
|
||||
CYGWIN*|Darwin|MINGW*) use_makefile=no;;
|
||||
CYGWIN*)
|
||||
use_makefile=no
|
||||
OS=Cygwin
|
||||
FORCE_MAKE_OS=$OS
|
||||
;;
|
||||
Darwin|MINGW*) use_makefile=no;;
|
||||
*) use_makefile=yes;;
|
||||
esac
|
||||
if test "x$FORCE_MAKE_OS" != x; then
|
||||
force_make_os=FORCE_
|
||||
make_os=${FORCE_MAKE_OS}
|
||||
fi
|
||||
|
||||
# Check whether --with-makefile was given.
|
||||
if test ${with_makefile+y}
|
||||
|
@ -2871,9 +2884,12 @@ Minix) CPPFLAGS="${CPPFLAGS} -D_NETBSD_SOURCE"
|
|||
;;
|
||||
SCO_SV) # /bin/sh is not usable
|
||||
ALT_DEF_SHELLS="/bin/lsh /usr/bin/bash /bin/ksh"
|
||||
CPPFLAGS="${CPPFLAGS} -DFORCE_USE_SHELL"
|
||||
FORCE_USE_SHELL=1
|
||||
;;
|
||||
esac
|
||||
if test "x$FORCE_USE_SHELL" != x; then
|
||||
CPPFLAGS="${CPPFLAGS} -DFORCE_USE_SHELL"
|
||||
fi
|
||||
# Not everyone groks TZ=Europe/Berlin
|
||||
# which is used by the localtime tests
|
||||
echo $ECHO_N "checking whether system has timezone Europe/Berlin... $ECHO_C" >&6
|
||||
|
@ -7076,6 +7092,8 @@ esac
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
bm_outfiles="Makefile.config unit-tests/Makefile.config make-bootstrap.sh"
|
||||
if test $use_makefile = yes; then
|
||||
bm_outfiles="makefile $bm_outfiles"
|
||||
|
@ -7594,7 +7612,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by bmake $as_me 20240212, which was
|
||||
This file was extended by bmake $as_me 20240314, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -7658,7 +7676,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
bmake config.status 20240212
|
||||
bmake config.status 20240314
|
||||
configured by $0, generated by GNU Autoconf 2.71,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
|
25
configure.in
25
configure.in
|
@ -1,11 +1,11 @@
|
|||
dnl
|
||||
dnl RCSid:
|
||||
dnl $Id: configure.in,v 1.103 2024/02/16 17:54:38 sjg Exp $
|
||||
dnl $Id: configure.in,v 1.105 2024/03/19 19:08:20 sjg Exp $
|
||||
dnl
|
||||
dnl Process this file with autoconf to produce a configure script
|
||||
dnl
|
||||
AC_PREREQ([2.71])
|
||||
AC_INIT([bmake],[20240212],[sjg@NetBSD.org])
|
||||
AC_INIT([bmake],[20240314],[sjg@NetBSD.org])
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
||||
dnl make srcdir absolute
|
||||
|
@ -61,10 +61,22 @@ no) ;;
|
|||
*) use_defshell $with_defshell;;
|
||||
esac])
|
||||
dnl
|
||||
dnl sometimes uname -s output is not useful
|
||||
FORCE_MAKE_OS=
|
||||
make_os=
|
||||
case "$OS" in
|
||||
CYGWIN*|Darwin|MINGW*) use_makefile=no;;
|
||||
CYGWIN*)
|
||||
use_makefile=no
|
||||
OS=Cygwin
|
||||
FORCE_MAKE_OS=$OS
|
||||
;;
|
||||
Darwin|MINGW*) use_makefile=no;;
|
||||
*) use_makefile=yes;;
|
||||
esac
|
||||
if test "x$FORCE_MAKE_OS" != x; then
|
||||
force_make_os=FORCE_
|
||||
make_os=${FORCE_MAKE_OS}
|
||||
fi
|
||||
AC_ARG_WITH(makefile,
|
||||
[ --without-makefile disable use of generated makefile],
|
||||
[case "${withval}" in
|
||||
|
@ -141,9 +153,12 @@ Minix) CPPFLAGS="${CPPFLAGS} -D_NETBSD_SOURCE"
|
|||
;;
|
||||
SCO_SV) # /bin/sh is not usable
|
||||
ALT_DEF_SHELLS="/bin/lsh /usr/bin/bash /bin/ksh"
|
||||
CPPFLAGS="${CPPFLAGS} -DFORCE_USE_SHELL"
|
||||
FORCE_USE_SHELL=1
|
||||
;;
|
||||
esac
|
||||
if test "x$FORCE_USE_SHELL" != x; then
|
||||
CPPFLAGS="${CPPFLAGS} -DFORCE_USE_SHELL"
|
||||
fi
|
||||
dnl
|
||||
# Not everyone groks TZ=Europe/Berlin
|
||||
# which is used by the localtime tests
|
||||
|
@ -549,6 +564,8 @@ bmake) egrep=egrep;;
|
|||
esac
|
||||
dnl
|
||||
AC_SUBST(egrep)
|
||||
AC_SUBST(make_os)
|
||||
AC_SUBST(force_make_os)
|
||||
AC_SUBST(machine)
|
||||
AC_SUBST(force_machine)
|
||||
AC_SUBST(machine_arch)
|
||||
|
|
15
for.c
15
for.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: for.c,v 1.178 2024/01/21 15:02:17 rillig Exp $ */
|
||||
/* $NetBSD: for.c,v 1.179 2024/04/01 12:33:27 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, The Regents of the University of California.
|
||||
|
@ -58,7 +58,7 @@
|
|||
#include "make.h"
|
||||
|
||||
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
|
||||
MAKE_RCSID("$NetBSD: for.c,v 1.178 2024/01/21 15:02:17 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: for.c,v 1.179 2024/04/01 12:33:27 rillig Exp $");
|
||||
|
||||
|
||||
typedef struct ForLoop {
|
||||
|
@ -196,11 +196,7 @@ ForLoop_ParseItems(ForLoop *f, const char *p)
|
|||
cpp_skip_whitespace(&p);
|
||||
|
||||
items = Var_Subst(p, SCOPE_GLOBAL, VARE_WANTRES);
|
||||
if (items == var_Error) {
|
||||
/* TODO: Make this part of the code reachable. */
|
||||
Parse_Error(PARSE_FATAL, "Error in .for loop items");
|
||||
return false;
|
||||
}
|
||||
/* TODO: handle errors */
|
||||
|
||||
f->items = Substring_Words(items, false);
|
||||
free(items);
|
||||
|
@ -490,12 +486,11 @@ ForLoop_SubstBody(ForLoop *f, unsigned int firstItem, Buffer *body)
|
|||
p += 2;
|
||||
ForLoop_SubstVarLong(f, firstItem, body,
|
||||
&p, endc, &mark);
|
||||
} else if (p[1] != '\0') {
|
||||
} else {
|
||||
ForLoop_SubstVarShort(f, firstItem, body,
|
||||
p + 1, &mark);
|
||||
p += 2;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Buf_AddRange(body, mark, end);
|
||||
|
|
11
job.c
11
job.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: job.c,v 1.467 2024/03/10 02:53:37 sjg Exp $ */
|
||||
/* $NetBSD: job.c,v 1.470 2024/04/27 20:41:32 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -154,7 +154,7 @@
|
|||
#include "trace.h"
|
||||
|
||||
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: job.c,v 1.467 2024/03/10 02:53:37 sjg Exp $");
|
||||
MAKE_RCSID("$NetBSD: job.c,v 1.470 2024/04/27 20:41:32 rillig Exp $");
|
||||
|
||||
/*
|
||||
* A shell defines how the commands are run. All commands for a target are
|
||||
|
@ -914,7 +914,9 @@ JobWriteCommand(Job *job, ShellWriter *wr, StringListNode *ln, const char *ucmd)
|
|||
|
||||
run = GNode_ShouldExecute(job->node);
|
||||
|
||||
EvalStack_Push(job->node->name, NULL, NULL);
|
||||
xcmd = Var_Subst(ucmd, job->node, VARE_WANTRES);
|
||||
EvalStack_Pop();
|
||||
/* TODO: handle errors */
|
||||
xcmdStart = xcmd;
|
||||
|
||||
|
@ -1041,7 +1043,9 @@ JobSaveCommands(Job *job)
|
|||
* variables such as .TARGET, .IMPSRC. It is not intended to
|
||||
* expand the other variables as well; see deptgt-end.mk.
|
||||
*/
|
||||
EvalStack_Push(job->node->name, NULL, NULL);
|
||||
expanded_cmd = Var_Subst(cmd, job->node, VARE_WANTRES);
|
||||
EvalStack_Pop();
|
||||
/* TODO: handle errors */
|
||||
Lst_Append(&Targ_GetEndNode()->commands, expanded_cmd);
|
||||
}
|
||||
|
@ -1071,6 +1075,7 @@ DebugFailedJob(const Job *job)
|
|||
|
||||
debug_printf("\n");
|
||||
debug_printf("*** Failed target: %s\n", job->node->name);
|
||||
debug_printf("*** In directory: %s\n", curdir);
|
||||
debug_printf("*** Failed commands:\n");
|
||||
for (ln = job->node->commands.first; ln != NULL; ln = ln->next) {
|
||||
const char *cmd = ln->datum;
|
||||
|
@ -1767,7 +1772,7 @@ JobStart(GNode *gn, bool special)
|
|||
* itself.
|
||||
*/
|
||||
static char *
|
||||
PrintFilteredOutput(char *p, char *endp) /* XXX: should all be const */
|
||||
PrintFilteredOutput(char *p, const char *endp) /* XXX: p should be const */
|
||||
{
|
||||
char *ep; /* XXX: should be const */
|
||||
|
||||
|
|
8
lst.c
8
lst.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lst.c,v 1.107 2023/12/29 20:43:58 rillig Exp $ */
|
||||
/* $NetBSD: lst.c,v 1.108 2024/04/27 17:33:46 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include "make.h"
|
||||
|
||||
MAKE_RCSID("$NetBSD: lst.c,v 1.107 2023/12/29 20:43:58 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: lst.c,v 1.108 2024/04/27 17:33:46 rillig Exp $");
|
||||
|
||||
static ListNode *
|
||||
LstNodeNew(ListNode *prev, ListNode *next, void *datum)
|
||||
|
@ -60,13 +60,13 @@ Lst_Done(List *list)
|
|||
}
|
||||
|
||||
void
|
||||
Lst_DoneCall(List *list, LstFreeProc freeProc)
|
||||
Lst_DoneFree(List *list)
|
||||
{
|
||||
ListNode *ln, *next;
|
||||
|
||||
for (ln = list->first; ln != NULL; ln = next) {
|
||||
next = ln->next;
|
||||
freeProc(ln->datum);
|
||||
free(ln->datum);
|
||||
free(ln);
|
||||
}
|
||||
}
|
||||
|
|
11
lst.h
11
lst.h
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lst.h,v 1.104 2023/12/29 20:43:58 rillig Exp $ */
|
||||
/* $NetBSD: lst.h,v 1.105 2024/04/27 17:33:46 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -103,13 +103,10 @@ struct List {
|
|||
ListNode *last;
|
||||
};
|
||||
|
||||
/* Free the datum of a node, called before freeing the node itself. */
|
||||
typedef void LstFreeProc(void *);
|
||||
|
||||
/* Free the list nodes, but not the list itself. */
|
||||
/* Free the list nodes. */
|
||||
void Lst_Done(List *);
|
||||
/* Free the list nodes, freeing the node data using the given function. */
|
||||
void Lst_DoneCall(List *, LstFreeProc);
|
||||
/* Free the list nodes, as well as each node's datum. */
|
||||
void Lst_DoneFree(List *);
|
||||
|
||||
#define LST_INIT { NULL, NULL }
|
||||
|
||||
|
|
18
main.c
18
main.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $ */
|
||||
/* $NetBSD: main.c,v 1.614 2024/04/30 16:13:33 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.612 2024/03/10 02:53:37 sjg Exp $");
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.614 2024/04/30 16:13:33 sjg Exp $");
|
||||
#if defined(MAKE_NATIVE)
|
||||
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
|
||||
"The Regents of the University of California. "
|
||||
|
@ -1174,6 +1174,8 @@ 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;
|
||||
|
@ -1217,7 +1219,7 @@ ReadBuiltinRules(void)
|
|||
Fatal("%s: cannot open %s.",
|
||||
progname, (const char *)sysMkFiles.first->datum);
|
||||
|
||||
Lst_DoneCall(&sysMkFiles, free);
|
||||
Lst_DoneFree(&sysMkFiles);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1359,7 +1361,11 @@ main_Init(int argc, char **argv)
|
|||
/* Just in case MAKEOBJDIR wants us to do something tricky. */
|
||||
Targ_Init();
|
||||
Var_Init();
|
||||
#ifdef FORCE_MAKE_OS
|
||||
Global_Set_ReadOnly(".MAKE.OS", FORCE_MAKE_OS);
|
||||
#else
|
||||
Global_Set_ReadOnly(".MAKE.OS", utsname.sysname);
|
||||
#endif
|
||||
Global_Set("MACHINE", machine);
|
||||
Global_Set("MACHINE_ARCH", machine_arch);
|
||||
#ifdef MAKE_VERSION
|
||||
|
@ -1582,9 +1588,9 @@ static void
|
|||
main_CleanUp(void)
|
||||
{
|
||||
#ifdef CLEANUP
|
||||
Lst_DoneCall(&opts.variables, free);
|
||||
Lst_DoneCall(&opts.makefiles, free);
|
||||
Lst_DoneCall(&opts.create, free);
|
||||
Lst_DoneFree(&opts.variables);
|
||||
Lst_DoneFree(&opts.makefiles);
|
||||
Lst_DoneFree(&opts.create);
|
||||
#endif
|
||||
|
||||
if (DEBUG(GRAPH2))
|
||||
|
|
|
@ -19,6 +19,7 @@ MAKE_VERSION=@_MAKE_VERSION@
|
|||
MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \
|
||||
-D@force_machine@MACHINE=\"@machine@\" \
|
||||
-D@force_machine_arch@MACHINE_ARCH=\"@machine_arch@\" \
|
||||
-D@force_make_os@MAKE_OS=\"@make_os@\" \
|
||||
-D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\""
|
||||
|
||||
|
||||
|
|
22
make.h
22
make.h
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: make.h,v 1.329 2024/03/10 02:53:37 sjg Exp $ */
|
||||
/* $NetBSD: make.h,v 1.332 2024/04/27 20:41:32 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -141,6 +141,12 @@
|
|||
#define MAKE_ATTR_USE /* delete */
|
||||
#endif
|
||||
|
||||
#if MAKE_GNUC_PREREQ(8, 0)
|
||||
#define MAKE_ATTR_NOINLINE __attribute__((__noinline__))
|
||||
#else
|
||||
#define MAKE_ATTR_NOINLINE /* delete */
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L || defined(lint)
|
||||
#define MAKE_INLINE static inline MAKE_ATTR_UNUSED
|
||||
#else
|
||||
|
@ -422,7 +428,7 @@ typedef struct SearchPath {
|
|||
|
||||
/*
|
||||
* A graph node represents a target that can possibly be made, including its
|
||||
* relation to other targets and a lot of other details.
|
||||
* relation to other targets.
|
||||
*/
|
||||
typedef struct GNode {
|
||||
/* The target's name, such as "clean" or "make.c" */
|
||||
|
@ -604,8 +610,8 @@ extern GNode *SCOPE_GLOBAL;
|
|||
extern GNode *SCOPE_CMDLINE;
|
||||
|
||||
/*
|
||||
* Value returned by Var_Parse when an error is encountered. It actually
|
||||
* points to an empty string, so naive callers needn't worry about it.
|
||||
* Value returned by Var_Parse when an error is encountered. It points to an
|
||||
* empty string, so naive callers needn't worry about it.
|
||||
*/
|
||||
extern char var_Error[];
|
||||
|
||||
|
@ -701,11 +707,11 @@ typedef enum PrintVarsMode {
|
|||
|
||||
/* Command line options */
|
||||
typedef struct CmdOpts {
|
||||
/* -B: whether we are make compatible */
|
||||
/* -B: whether to be compatible to traditional make */
|
||||
bool compatMake;
|
||||
|
||||
/*
|
||||
* -d: debug control: There is one bit per module. It is up to the
|
||||
* -d: debug control: There is one flag per module. It is up to the
|
||||
* module what debug information to print.
|
||||
*/
|
||||
DebugFlags debug;
|
||||
|
@ -1046,6 +1052,10 @@ void Global_Append(const char *, const char *);
|
|||
void Global_Delete(const char *);
|
||||
void Global_Set_ReadOnly(const char *, const char *);
|
||||
|
||||
void EvalStack_Push(const char *, const char *, const char *);
|
||||
void EvalStack_Pop(void);
|
||||
const char *EvalStack_Details(void);
|
||||
|
||||
/* util.c */
|
||||
typedef void (*SignalProc)(int);
|
||||
SignalProc bmake_signal(int, SignalProc);
|
||||
|
|
4
meta.c
4
meta.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: meta.c,v 1.207 2023/12/17 09:02:26 rillig Exp $ */
|
||||
/* $NetBSD: meta.c,v 1.208 2024/04/27 17:33:46 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Implement 'meta' mode.
|
||||
|
@ -1602,7 +1602,7 @@ meta_oodate(GNode *gn, bool oodate)
|
|||
}
|
||||
}
|
||||
|
||||
Lst_DoneCall(&missingFiles, free);
|
||||
Lst_DoneFree(&missingFiles);
|
||||
|
||||
if (oodate && needOODATE) {
|
||||
/*
|
||||
|
|
36
mk/ChangeLog
36
mk/ChangeLog
|
@ -1,3 +1,39 @@
|
|||
2024-04-24 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* meta.autodep.mk: do not override start_utc
|
||||
|
||||
2024-04-18 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* sys.dirdeps.mk: set defaults for DEP_* at level 0 too.
|
||||
These help when first include of Makefile.depend happens in a leaf
|
||||
dir.
|
||||
|
||||
* install-mk (MK_VERSION): 20240414
|
||||
|
||||
2024-04-09 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20240408
|
||||
|
||||
* init.mk: allow for _ as well as . to join V
|
||||
and Q from QUALIFIED_VAR_LIST and VAR_QUALIFIER_LIST.
|
||||
|
||||
* progs.mk: avoid overlap between PROG_VARS and
|
||||
init.mk's QUALIFIED_VAR_LIST since PROG would also
|
||||
match its VAR_QUALIFIER_LIST,
|
||||
libs.mk does not have the same issue.
|
||||
|
||||
* subdir.mk: _SUBDIRUSE for realinstall should run install
|
||||
remove include of ${.CURDIR}/Makefile.inc that can be done via
|
||||
local.subdir.mk where needed
|
||||
|
||||
* own.mk: do not conflict with man.mk
|
||||
|
||||
2024-03-19 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20240314
|
||||
|
||||
* add sys/Cygwin.mk from Christian Franke
|
||||
|
||||
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20240309
|
||||
|
|
1
mk/FILES
1
mk/FILES
|
@ -54,6 +54,7 @@ sys.dependfile.mk
|
|||
sys.dirdeps.mk
|
||||
sys.vars.mk
|
||||
sys/AIX.mk
|
||||
sys/Cygwin.mk
|
||||
sys/Darwin.mk
|
||||
sys/Generic.mk
|
||||
sys/HP-UX.mk
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: init.mk,v 1.37 2024/02/25 19:12:13 sjg Exp $
|
||||
# $Id: init.mk,v 1.38 2024/04/09 17:18:24 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2002-2024, Simon J. Gerraty
|
||||
#
|
||||
|
@ -72,7 +72,7 @@ QUALIFIED_VAR_LIST += \
|
|||
# a final :U avoids errors if someone uses :=
|
||||
.for V in ${QUALIFIED_VAR_LIST:O:u:@q@$q $q_LAST@}
|
||||
.for Q in ${VAR_QUALIFIER_LIST:u}
|
||||
$V += ${$V.$Q:U} ${$V.$Q.${COMPILER_TYPE}:U}
|
||||
$V += ${$V_$Q:U${$V.$Q:U}} ${V_$Q_${COMPILER_TYPE}:U${$V.$Q.${COMPILER_TYPE}:U}}
|
||||
.endfor
|
||||
.endfor
|
||||
|
||||
|
|
|
@ -59,9 +59,9 @@
|
|||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
|
||||
# RCSid:
|
||||
# $Id: install-mk,v 1.250 2024/03/10 02:57:17 sjg Exp $
|
||||
# $Id: install-mk,v 1.253 2024/04/18 17:18:31 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1994-2023 Simon J. Gerraty
|
||||
# @(#) Copyright (c) 1994-2024 Simon J. Gerraty
|
||||
#
|
||||
# This file is provided in the hope that it will
|
||||
# be of use. There is absolutely NO WARRANTY.
|
||||
|
@ -74,7 +74,7 @@
|
|||
# sjg@crufty.net
|
||||
#
|
||||
|
||||
MK_VERSION=20240309
|
||||
MK_VERSION=20240414
|
||||
OWNER=
|
||||
GROUP=
|
||||
MODE=444
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: meta.autodep.mk,v 1.62 2024/02/17 17:26:57 sjg Exp $
|
||||
# $Id: meta.autodep.mk,v 1.63 2024/04/24 18:56:41 sjg Exp $
|
||||
|
||||
#
|
||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||
|
@ -308,7 +308,9 @@ CLEANFILES += *.meta filemon.* *.db
|
|||
|
||||
# these make it easy to gather some stats
|
||||
now_utc ?= ${%s:L:localtime}
|
||||
.if !defined(start_utc)
|
||||
start_utc := ${now_utc}
|
||||
.endif
|
||||
|
||||
meta_stats= meta=${empty(.MAKE.META.FILES):?0:${.MAKE.META.FILES:[#]}} \
|
||||
created=${empty(.MAKE.META.CREATED):?0:${.MAKE.META.CREATED:[#]}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: meta.subdir.mk,v 1.14 2024/02/17 17:26:57 sjg Exp $
|
||||
# $Id: meta.subdir.mk,v 1.15 2024/04/19 15:10:22 sjg Exp $
|
||||
|
||||
#
|
||||
# @(#) Copyright (c) 2010, Simon J. Gerraty
|
||||
|
@ -70,7 +70,6 @@ DIRDEPS := ${DIRDEPS:S,^./,,:S,/./,/,g:${SUBDIRDEPS_FILTER:Uu}}
|
|||
# dirdeps.mk will compute some interesting combinations.
|
||||
.undef ALL_MACHINES
|
||||
|
||||
DEP_RELDIR = ${RELDIR}
|
||||
.include <dirdeps.mk>
|
||||
.endif
|
||||
.endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: own.mk,v 1.47 2024/02/19 00:06:19 sjg Exp $
|
||||
# $Id: own.mk,v 1.48 2024/04/09 21:52:52 sjg Exp $
|
||||
|
||||
# should be set properly in sys.mk
|
||||
_this ?= ${.PARSEFILE:S,bsd.,,}
|
||||
|
@ -136,8 +136,7 @@ INCDIR?= ${INCLUDEDIR}
|
|||
# Define MANZ to have the man pages compressed (gzip)
|
||||
#MANZ= 1
|
||||
|
||||
MANTARGET?= cat
|
||||
MANDIR?= ${prefix}/share/man/${MANTARGET}
|
||||
MANDIR?= ${prefix}/share/man
|
||||
MANGRP?= ${BINGRP}
|
||||
MANOWN?= ${BINOWN}
|
||||
MANMODE?= ${NONBINMODE}
|
||||
|
|
22
mk/progs.mk
22
mk/progs.mk
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: progs.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $
|
||||
# $Id: progs.mk,v 1.18 2024/04/09 17:18:24 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2006, Simon J. Gerraty
|
||||
#
|
||||
|
@ -39,16 +39,26 @@ PROG ?= $t
|
|||
# just one of many
|
||||
PROG_VARS += \
|
||||
BINDIR \
|
||||
CFLAGS \
|
||||
COPTS \
|
||||
CPPFLAGS \
|
||||
CXXFLAGS \
|
||||
DPADD \
|
||||
DPLIBS \
|
||||
LDADD \
|
||||
LDFLAGS \
|
||||
MAN \
|
||||
SRCS
|
||||
|
||||
.ifndef SYS_OS_MK
|
||||
# assume we are not using init.mk, otherwise
|
||||
# we need to avoid overlap with its
|
||||
# QUALIFIED_VAR_LIST which includes these and its
|
||||
# VAR_QUALIFIER_LIST includes .TARGET which
|
||||
# would match PROG
|
||||
PROG_VARS += \
|
||||
CFLAGS \
|
||||
COPTS \
|
||||
CPPFLAGS \
|
||||
LDFLAGS \
|
||||
SRCS \
|
||||
|
||||
.endif
|
||||
|
||||
.for v in ${PROG_VARS:O:u}
|
||||
.if defined(${v}.${PROG}) || defined(${v}_${PROG})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: subdir.mk,v 1.22 2024/02/19 00:06:19 sjg Exp $
|
||||
# $Id: subdir.mk,v 1.24 2024/04/10 01:47:23 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2002-2024, Simon J. Gerraty
|
||||
#
|
||||
|
@ -37,7 +37,6 @@ __${_this}__: .NOTMAIN
|
|||
_SUBDIRUSE:
|
||||
.elif !commands(_SUBDIRUSE) && !defined(NO_SUBDIR) && !defined(NOSUBDIR)
|
||||
.-include <local.subdir.mk>
|
||||
.-include <${.CURDIR}/Makefile.inc>
|
||||
.if !target(.MAIN)
|
||||
.MAIN: all
|
||||
.endif
|
||||
|
@ -82,7 +81,7 @@ realinstall: beforeinstall _SUBDIRUSE
|
|||
|
||||
# the interface from others
|
||||
# this may require additions to SUBDIR_TAREGTS
|
||||
_SUBDIRUSE: .USE subdir-${.TARGET}
|
||||
_SUBDIRUSE: .USE subdir-${.TARGET:C/-.*//:S/real//:S/.depend/depend/}
|
||||
|
||||
SUBDIR_TARGETS += \
|
||||
all \
|
||||
|
@ -93,7 +92,6 @@ SUBDIR_TARGETS += \
|
|||
depend \
|
||||
lint \
|
||||
obj \
|
||||
realinstall \
|
||||
tags \
|
||||
etags
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: sys.dirdeps.mk,v 1.14 2024/02/25 19:12:13 sjg Exp $
|
||||
# $Id: sys.dirdeps.mk,v 1.15 2024/04/18 17:18:31 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2012-2023, Simon J. Gerraty
|
||||
#
|
||||
|
@ -196,11 +196,10 @@ RELSRCTOP?= ${RELTOP}
|
|||
# just in case
|
||||
.MAKE.DEPENDFILE ?= Makefile.depend
|
||||
|
||||
.if ${.MAKE.LEVEL} > 0
|
||||
# Makefile.depend* also get read at level 1+
|
||||
# and often refer to DEP_MACHINE etc,
|
||||
# so ensure DEP_* (for TARGET_SPEC_VARS anyway) are set
|
||||
.for V in ${TARGET_SPEC_VARS}
|
||||
DEP_$V = ${$V}
|
||||
# Makefile.depend* often refer to DEP_MACHINE etc,
|
||||
# we need defaults for both first include in a leaf dir
|
||||
# and when level > 0
|
||||
# so ensure DEP_* for TARGET_SPEC_VARS and RELDIR are set
|
||||
.for V in ${TARGET_SPEC_VARS} RELDIR
|
||||
DEP_$V ?= ${$V}
|
||||
.endfor
|
||||
.endif
|
||||
|
|
21
mk/sys/Cygwin.mk
Normal file
21
mk/sys/Cygwin.mk
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Minimal adjustments for Cygwin
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
OS ?= Cygwin
|
||||
unix ?= We run ${OS}.
|
||||
|
||||
.ifndef ROOT_GROUP
|
||||
# Cygwin maps local admin SID S-1-5-32-544 to GID 544.
|
||||
# /etc/group does no longer exist in a base installation.
|
||||
ROOT_GROUP != /usr/bin/getent group 544 2>/dev/null
|
||||
ROOT_GROUP := ${ROOT_GROUP:C,:.*$,,}
|
||||
.endif
|
||||
|
||||
.LIBS: .a
|
||||
|
||||
AR ?= ar
|
||||
RANLIB ?= ranlib
|
||||
TSORT ?= tsort -q
|
||||
|
||||
# egrep is deprecated
|
||||
EGREP ?= grep -E
|
6
os.sh
6
os.sh
|
@ -17,7 +17,7 @@
|
|||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
|
||||
# RCSid:
|
||||
# $Id: os.sh,v 1.63 2023/05/22 20:44:47 sjg Exp $
|
||||
# $Id: os.sh,v 1.64 2024/03/19 16:03:23 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1994 Simon J. Gerraty
|
||||
#
|
||||
|
@ -91,6 +91,10 @@ AIX) # everyone loves to be different...
|
|||
PS_AXC=-e
|
||||
SHARE_ARCH=$OS/$OSMAJOR.X
|
||||
;;
|
||||
CYGWIN*) # uname -s not very useful
|
||||
# uname -o produces just Cygwin which is better
|
||||
OS=Cygwin
|
||||
;;
|
||||
Darwin) # this is more explicit (arm64 vs arm)
|
||||
HOST_ARCH=$MACHINE
|
||||
;;
|
||||
|
|
26
parse.c
26
parse.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: parse.c,v 1.717 2024/02/07 06:43:02 rillig Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.722 2024/04/27 17:33:46 rillig 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.717 2024/02/07 06:43:02 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: parse.c,v 1.722 2024/04/27 17:33:46 rillig Exp $");
|
||||
|
||||
/* Detects a multiple-inclusion guard in a makefile. */
|
||||
typedef enum {
|
||||
|
@ -537,6 +537,7 @@ ParseVErrorInternal(FILE *f, bool useVars, const GNode *gn,
|
|||
(void)fprintf(f, "%s: ", progname);
|
||||
|
||||
PrintLocation(f, useVars, gn);
|
||||
fprintf(f, "%s", EvalStack_Details());
|
||||
if (level == PARSE_WARNING)
|
||||
(void)fprintf(f, "warning: ");
|
||||
(void)vfprintf(f, fmt, ap);
|
||||
|
@ -1637,10 +1638,10 @@ ParseDependencySources(char *p, GNodeType targetAttr,
|
|||
* Transformation rules such as '.c.o' are also handled here, see
|
||||
* Suff_AddTransform.
|
||||
*
|
||||
* Upon return, the value of the line is unspecified.
|
||||
* Upon return, the value of expandedLine is unspecified.
|
||||
*/
|
||||
static void
|
||||
ParseDependency(char *line, const char *unexpanded_line)
|
||||
ParseDependency(char *expandedLine, const char *unexpandedLine)
|
||||
{
|
||||
char *p;
|
||||
SearchPathList *paths; /* search paths to alter when parsing a list
|
||||
|
@ -1651,14 +1652,14 @@ ParseDependency(char *line, const char *unexpanded_line)
|
|||
* vice versa */
|
||||
GNodeType op;
|
||||
|
||||
DEBUG1(PARSE, "ParseDependency(%s)\n", line);
|
||||
p = line;
|
||||
DEBUG1(PARSE, "ParseDependency(%s)\n", expandedLine);
|
||||
p = expandedLine;
|
||||
paths = NULL;
|
||||
targetAttr = OP_NONE;
|
||||
special = SP_NOT;
|
||||
|
||||
if (!ParseDependencyTargets(&p, line, &special, &targetAttr, &paths,
|
||||
unexpanded_line))
|
||||
if (!ParseDependencyTargets(&p, expandedLine, &special, &targetAttr,
|
||||
&paths, unexpandedLine))
|
||||
goto out;
|
||||
|
||||
if (!Lst_IsEmpty(targets))
|
||||
|
@ -1666,7 +1667,7 @@ ParseDependency(char *line, const char *unexpanded_line)
|
|||
|
||||
op = ParseDependencyOp(&p);
|
||||
if (op == OP_NONE) {
|
||||
InvalidLineType(line, unexpanded_line);
|
||||
InvalidLineType(expandedLine, unexpandedLine);
|
||||
goto out;
|
||||
}
|
||||
ApplyDependencyOperator(op);
|
||||
|
@ -2384,7 +2385,7 @@ ParseRawLine(IncludedFile *curFile, char **out_line, char **out_line_end,
|
|||
ch = *p;
|
||||
if (ch == '\0' || (ch == '\\' && p[1] == '\0')) {
|
||||
Parse_Error(PARSE_FATAL, "Zero byte read from file");
|
||||
return PRLR_ERROR;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* Treat next character after '\' as literal. */
|
||||
|
@ -2623,6 +2624,7 @@ ReadHighLevelLine(void)
|
|||
if (line == NULL)
|
||||
return NULL;
|
||||
|
||||
DEBUG2(PARSE, "Parsing line %u: %s\n", curFile->lineno, line);
|
||||
if (curFile->guardState != GS_NO
|
||||
&& ((curFile->guardState == GS_START && line[0] != '.')
|
||||
|| curFile->guardState == GS_DONE))
|
||||
|
@ -2945,8 +2947,6 @@ Parse_File(const char *name, int fd)
|
|||
|
||||
do {
|
||||
while ((line = ReadHighLevelLine()) != NULL) {
|
||||
DEBUG2(PARSE, "Parsing line %u: %s\n",
|
||||
CurFile()->lineno, line);
|
||||
ParseLine(line);
|
||||
}
|
||||
} while (ParseEOF());
|
||||
|
@ -2982,7 +2982,7 @@ Parse_End(void)
|
|||
#ifdef CLEANUP
|
||||
HashIter hi;
|
||||
|
||||
Lst_DoneCall(&targCmds, free);
|
||||
Lst_DoneFree(&targCmds);
|
||||
assert(targets == NULL);
|
||||
SearchPath_Free(defSysIncPath);
|
||||
SearchPath_Free(sysIncPath);
|
||||
|
|
30
str.c
30
str.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: str.c,v 1.102 2024/01/05 23:22:06 rillig Exp $ */
|
||||
/* $NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -71,7 +71,7 @@
|
|||
#include "make.h"
|
||||
|
||||
/* "@(#)str.c 5.8 (Berkeley) 6/1/90" */
|
||||
MAKE_RCSID("$NetBSD: str.c,v 1.102 2024/01/05 23:22:06 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $");
|
||||
|
||||
|
||||
static HashTable interned_strings;
|
||||
|
@ -296,26 +296,6 @@ Str_Words(const char *str, bool expand)
|
|||
return words;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX: In the extreme edge case that one of the characters is from the basic
|
||||
* execution character set and the other isn't, the result of the comparison
|
||||
* differs depending on whether plain char is signed or unsigned.
|
||||
*
|
||||
* An example is the character range from \xE4 to 'a', where \xE4 may come
|
||||
* from U+00E4 'Latin small letter A with diaeresis'.
|
||||
*
|
||||
* If char is signed, \xE4 evaluates to -28, the first half of the condition
|
||||
* becomes -28 <= '0' && '0' <= 'a', which evaluates to true.
|
||||
*
|
||||
* If char is unsigned, \xE4 evaluates to 228, the second half of the
|
||||
* condition becomes 'a' <= '0' && '0' <= 228, which evaluates to false.
|
||||
*/
|
||||
static bool
|
||||
in_range(char e1, char c, char e2)
|
||||
{
|
||||
return (e1 <= c && c <= e2) || (e2 <= c && c <= e1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test if a string matches a pattern like "*.[ch]". The pattern matching
|
||||
* characters are '*', '?' and '[]', as in fnmatch(3).
|
||||
|
@ -360,7 +340,11 @@ Str_Match(const char *str, const char *pat)
|
|||
return res;
|
||||
}
|
||||
if (pat[1] == '-') {
|
||||
if (in_range(pat[0], *str, pat[2]))
|
||||
unsigned char e1 = (unsigned char)pat[0];
|
||||
unsigned char c = (unsigned char)*str;
|
||||
unsigned char e2 = (unsigned char)pat[2];
|
||||
if ((e1 <= c && c <= e2)
|
||||
|| (e2 <= c && c <= e1))
|
||||
goto end_of_char_list;
|
||||
pat += 2;
|
||||
}
|
||||
|
|
17
targ.c
17
targ.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: targ.c,v 1.180 2024/03/10 02:53:37 sjg Exp $ */
|
||||
/* $NetBSD: targ.c,v 1.181 2024/04/27 17:33:47 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -107,7 +107,7 @@
|
|||
#include "dir.h"
|
||||
|
||||
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: targ.c,v 1.180 2024/03/10 02:53:37 sjg Exp $");
|
||||
MAKE_RCSID("$NetBSD: targ.c,v 1.181 2024/04/27 17:33:47 rillig Exp $");
|
||||
|
||||
/*
|
||||
* All target nodes that appeared on the left-hand side of one of the
|
||||
|
@ -119,7 +119,7 @@ static HashTable allTargetsByName;
|
|||
#ifdef CLEANUP
|
||||
static GNodeList allNodes = LST_INIT;
|
||||
|
||||
static void GNode_Free(void *);
|
||||
static void GNode_Free(GNode *);
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -131,11 +131,16 @@ Targ_Init(void)
|
|||
void
|
||||
Targ_End(void)
|
||||
{
|
||||
#ifdef CLEANUP
|
||||
GNodeListNode *ln;
|
||||
#endif
|
||||
Targ_Stats();
|
||||
#ifdef CLEANUP
|
||||
Lst_Done(&allTargets);
|
||||
HashTable_Done(&allTargetsByName);
|
||||
Lst_DoneCall(&allNodes, GNode_Free);
|
||||
for (ln = allNodes.first; ln != NULL; ln = ln->next)
|
||||
GNode_Free(ln->datum);
|
||||
Lst_Done(&allNodes);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -212,10 +217,8 @@ GNode_New(const char *name)
|
|||
|
||||
#ifdef CLEANUP
|
||||
static void
|
||||
GNode_Free(void *gnp)
|
||||
GNode_Free(GNode *gn)
|
||||
{
|
||||
GNode *gn = gnp;
|
||||
|
||||
free(gn->name);
|
||||
free(gn->uname);
|
||||
free(gn->path);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# $Id: Makefile,v 1.211 2024/03/10 17:46:44 sjg Exp $
|
||||
# $Id: Makefile,v 1.216 2024/04/30 16:42:50 sjg Exp $
|
||||
#
|
||||
# $NetBSD: Makefile,v 1.342 2024/01/07 02:07:44 sjg Exp $
|
||||
# $NetBSD: Makefile,v 1.344 2024/04/30 16:41:32 sjg Exp $
|
||||
#
|
||||
# Unit tests for make(1)
|
||||
#
|
||||
|
@ -474,20 +474,11 @@ BROKEN_TESTS+= sh-flags
|
|||
BROKEN_TESTS+= varmod-localtime
|
||||
.endif
|
||||
|
||||
.if ${.MAKE.OS:NCYGWIN*} == ""
|
||||
BROKEN_TESTS+= \
|
||||
export \
|
||||
opt-chdir \
|
||||
opt-keep-going-indirect \
|
||||
|
||||
.endif
|
||||
|
||||
|
||||
.if ${.MAKE.OS:NDarwin} == ""
|
||||
BROKEN_TESTS+= shell-ksh
|
||||
.endif
|
||||
|
||||
.if ${.MAKE.OS:MIRIX*} != ""
|
||||
.if ${.MAKE.OS:NIRIX*} == ""
|
||||
BROKEN_TESTS+= \
|
||||
cmd-interrupt \
|
||||
deptgt-interrupt \
|
||||
|
@ -573,6 +564,9 @@ SED_CMDS.directive-include-guard= \
|
|||
-e '/^ParseDependency/d' \
|
||||
-e '/^ParseEOF:/d'
|
||||
SED_CMDS.export= -e '/^[^=_A-Za-z0-9]*=/d'
|
||||
.if ${.MAKE.OS:NCygwin} == ""
|
||||
SED_CMDS.export+= -e '/^WINDIR=/d' -e '/^SYSTEMROOT=/d'
|
||||
.endif
|
||||
SED_CMDS.export-all= ${SED_CMDS.export}
|
||||
SED_CMDS.export-env= ${SED_CMDS.export}
|
||||
SED_CMDS.cmdline= -e 's,uid${.MAKE.UID}/,,'
|
||||
|
@ -625,7 +619,7 @@ SED_CMDS.var-op-shell+= ${STD_SED_CMDS.shell}
|
|||
SED_CMDS.var-op-shell+= -e '/command/s,No such.*,not found,'
|
||||
SED_CMDS.var-op-shell+= ${STD_SED_CMDS.white-space}
|
||||
SED_CMDS.vardebug+= -e 's,${.SHELL},</path/to/shell>,'
|
||||
SED_CMDS.varmod-mtime+= -e "s,': .*,': <ENOENT>,"
|
||||
SED_CMDS.varmod-mtime+= -e "s,\(.*\)': .*,\1': <ENOENT>,"
|
||||
SED_CMDS.varmod-subst-regex+= ${STD_SED_CMDS.regex}
|
||||
SED_CMDS.varparse-errors+= ${STD_SED_CMDS.timestamp}
|
||||
SED_CMDS.varname-dot-make-meta-ignore_filter+= ${SED_CMDS.meta-ignore}
|
||||
|
@ -655,8 +649,9 @@ unexport-env.rawout: export.mk
|
|||
|
||||
# In tests that use the debugging option -dd, ignore debugging output that is
|
||||
# only logged in -DCLEANUP mode.
|
||||
STD_SED_CMDS.dd= -e '/^OpenDirs_Done:/d'
|
||||
STD_SED_CMDS.dd+= -e '/^CachedDir /d'
|
||||
STD_SED_CMDS.dd= -e '/^OpenDirs_Done:/d'
|
||||
STD_SED_CMDS.dd+= -e '/^CachedDir /d'
|
||||
STD_SED_CMDS.dd+= -e 's, ${DEFSYSPATH:U/usr/share/mk} , <defsyspath> ,'
|
||||
|
||||
# Omit details such as process IDs from the output of the -dg1 option.
|
||||
STD_SED_CMDS.dg1= -e '/\#.* \.$$/d'
|
||||
|
@ -762,12 +757,10 @@ TOOL_TR?= tr
|
|||
TOOL_DIFF?= diff
|
||||
DIFF_FLAGS?= -u
|
||||
|
||||
.if defined(.PARSEDIR)
|
||||
# ensure consistent results from sort(1)
|
||||
LC_ALL= C
|
||||
LANG= C
|
||||
.export LANG LC_ALL
|
||||
.endif
|
||||
|
||||
.if ${.MAKE.MODE:Unormal:Mmeta} != ""
|
||||
# we don't need the noise
|
||||
|
|
|
@ -25,4 +25,12 @@ depend-on-existing-member
|
|||
Making remove-archive
|
||||
rm -f libprog.a
|
||||
|
||||
begin library
|
||||
Examining libbad.a...up-to-date.
|
||||
Examining -lbad...up-to-date.
|
||||
Examining libgood.a...library...up-to-date.
|
||||
Examining -lgood...library...up-to-date.
|
||||
Examining library...nonexistent....PHONY node...out-of-date.
|
||||
Examining .END...nonexistent...nonexistent and no sources...out-of-date.
|
||||
end library
|
||||
exit status 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: archive.mk,v 1.12 2021/04/09 14:42:00 christos Exp $
|
||||
# $NetBSD: archive.mk,v 1.13 2024/04/27 20:23:22 rillig Exp $
|
||||
#
|
||||
# Very basic demonstration of handling archives, based on the description
|
||||
# in PSD.doc/tutorial.ms.
|
||||
|
@ -24,6 +24,12 @@ all:
|
|||
@${MAKE} -f ${MAKEFILE} depend-on-existing-member
|
||||
@${MAKE} -f ${MAKEFILE} depend-on-nonexistent-member
|
||||
@${MAKE} -f ${MAKEFILE} remove-archive
|
||||
@${MAKE} -f ${MAKEFILE} set-up-library
|
||||
@${MAKE} -f ${MAKEFILE} -dm library 2>&1 \
|
||||
| sed -n '/^Examining/p' \
|
||||
| sed 's,\.\.\.modified[^.]*,,'
|
||||
@${MAKE} -f ${MAKEFILE} tear-down-library
|
||||
|
||||
|
||||
create-archive: ${ARCHIVE} pre post
|
||||
|
||||
|
@ -58,3 +64,28 @@ pre: .USEBEFORE
|
|||
@echo Making ${.TARGET} ${.OODATE:C,.+,out-of-date,W} ${.OODATE:O}
|
||||
post: .USE
|
||||
@echo
|
||||
|
||||
|
||||
set-up-library: .PHONY
|
||||
@echo "member" > member.txt
|
||||
@echo "not a library" > libbad.a
|
||||
@ar cr libgood.a member.txt
|
||||
@echo "begin library"
|
||||
|
||||
.if make(library)
|
||||
.SUFFIXES: .a
|
||||
.LIBS: .a
|
||||
.endif
|
||||
# The two lines for libgood contain the word "library", the two lines for
|
||||
# libbad don't.
|
||||
#
|
||||
# expect: Examining libbad.a...up-to-date.
|
||||
# expect: Examining -lbad...up-to-date.
|
||||
# expect: Examining libgood.a...library...up-to-date.
|
||||
# expect: Examining -lgood...library...up-to-date.
|
||||
library: .PHONY libbad.a -lbad libgood.a -lgood
|
||||
: Making ${.TARGET} from ${.ALLSRC}
|
||||
|
||||
tear-down-library: .PHONY
|
||||
@echo "end library"
|
||||
@rm member.txt libbad.a libgood.a
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
: undefined--eol
|
||||
make: Unclosed variable "UNCLOSED"
|
||||
: unclosed-variable-
|
||||
make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
|
||||
: unclosed-expression-
|
||||
make: Unclosed expression, expecting '}' for "UNCLOSED"
|
||||
: unclosed-modifier-
|
||||
make: Unknown modifier "Z"
|
||||
make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
|
||||
: unknown-modifier--eol
|
||||
: end-eol
|
||||
exit status 0
|
||||
|
|
|
@ -1,32 +1,39 @@
|
|||
# $NetBSD: cmd-errors-jobs.mk,v 1.2 2022/09/25 12:51:37 rillig Exp $
|
||||
# $NetBSD: cmd-errors-jobs.mk,v 1.4 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Demonstrate how errors in variable expansions affect whether the commands
|
||||
# Demonstrate how errors in expressions affect whether the commands
|
||||
# are actually executed in jobs mode.
|
||||
|
||||
.MAKEFLAGS: -j1
|
||||
|
||||
all: undefined unclosed-variable unclosed-modifier unknown-modifier end
|
||||
all: undefined unclosed-expression unclosed-modifier unknown-modifier end
|
||||
|
||||
# Undefined variables are not an error. They expand to empty strings.
|
||||
# Undefined variables in expressions are not an error. They expand to empty
|
||||
# strings.
|
||||
# expect: : undefined--eol
|
||||
undefined:
|
||||
: $@-${UNDEFINED}-eol
|
||||
|
||||
# XXX: As of 2020-11-01, this command is executed even though it contains
|
||||
# parse errors.
|
||||
unclosed-variable:
|
||||
# XXX: This command is executed even though it contains parse errors.
|
||||
# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
|
||||
# expect: : unclosed-expression-
|
||||
unclosed-expression:
|
||||
: $@-${UNCLOSED
|
||||
|
||||
# XXX: As of 2020-11-01, this command is executed even though it contains
|
||||
# parse errors.
|
||||
# XXX: This command is executed even though it contains parse errors.
|
||||
# expect: make: Unclosed expression, expecting '}' for "UNCLOSED"
|
||||
# expect: : unclosed-modifier-
|
||||
unclosed-modifier:
|
||||
: $@-${UNCLOSED:
|
||||
|
||||
# XXX: As of 2020-11-01, this command is executed even though it contains
|
||||
# parse errors.
|
||||
# XXX: This command is executed even though it contains parse errors.
|
||||
# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
|
||||
# expect: : unknown-modifier--eol
|
||||
unknown-modifier:
|
||||
: $@-${UNKNOWN:Z}-eol
|
||||
|
||||
# expect: : end-eol
|
||||
end:
|
||||
: $@-eol
|
||||
|
||||
# XXX: As of 2020-11-02, despite the parse errors, the exit status is 0.
|
||||
# XXX: Despite the parse errors, the exit status is 0.
|
||||
# expect: exit status 0
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
: undefined
|
||||
make: Unclosed variable "UNCLOSED"
|
||||
: unclosed-variable
|
||||
make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
|
||||
: unclosed-expression
|
||||
make: Unclosed expression, expecting '}' for "UNCLOSED"
|
||||
: unclosed-modifier
|
||||
make: Unknown modifier "Z"
|
||||
make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
|
||||
: unknown-modifier
|
||||
: end
|
||||
exit status 2
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
# $NetBSD: cmd-errors-lint.mk,v 1.1 2020/11/02 20:43:27 rillig Exp $
|
||||
# $NetBSD: cmd-errors-lint.mk,v 1.2 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Demonstrate how errors in variable expansions affect whether the commands
|
||||
# Demonstrate how errors in expressions affect whether the commands
|
||||
# are actually executed.
|
||||
|
||||
.MAKEFLAGS: -dL
|
||||
|
||||
all: undefined unclosed-variable unclosed-modifier unknown-modifier end
|
||||
all: undefined unclosed-expression unclosed-modifier unknown-modifier end
|
||||
|
||||
# Undefined variables are not an error. They expand to empty strings.
|
||||
# Undefined variables in expressions are not an error. They expand to empty
|
||||
# strings.
|
||||
undefined:
|
||||
: $@ ${UNDEFINED}
|
||||
|
||||
# XXX: As of 2020-11-01, this obvious syntax error is not detected.
|
||||
# XXX: As of 2020-11-01, this command is executed even though it contains
|
||||
# parse errors.
|
||||
unclosed-variable:
|
||||
unclosed-expression:
|
||||
: $@ ${UNCLOSED
|
||||
|
||||
# XXX: As of 2020-11-01, this obvious syntax error is not detected.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
: undefined--eol
|
||||
make: Unclosed variable "UNCLOSED"
|
||||
: unclosed-variable-
|
||||
make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
|
||||
: unclosed-expression-
|
||||
make: Unclosed expression, expecting '}' for "UNCLOSED"
|
||||
: unclosed-modifier-
|
||||
make: Unknown modifier "Z"
|
||||
make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
|
||||
: unknown-modifier--eol
|
||||
: end-eol
|
||||
exit status 0
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
# $NetBSD: cmd-errors.mk,v 1.5 2022/09/25 12:51:37 rillig Exp $
|
||||
# $NetBSD: cmd-errors.mk,v 1.6 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Demonstrate how errors in variable expansions affect whether the commands
|
||||
# Demonstrate how errors in expressions affect whether the commands
|
||||
# are actually executed in compat mode.
|
||||
|
||||
all: undefined unclosed-variable unclosed-modifier unknown-modifier end
|
||||
all: undefined unclosed-expression unclosed-modifier unknown-modifier end
|
||||
|
||||
# Undefined variables are not an error. They expand to empty strings.
|
||||
# Undefined variables in expressions are not an error. They expand to empty
|
||||
# strings.
|
||||
undefined:
|
||||
: $@-${UNDEFINED}-eol
|
||||
|
||||
# XXX: As of 2020-11-01, this command is executed even though it contains
|
||||
# parse errors.
|
||||
unclosed-variable:
|
||||
unclosed-expression:
|
||||
: $@-${UNCLOSED
|
||||
|
||||
# XXX: As of 2020-11-01, this command is executed even though it contains
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: cmdline-undefined.mk,v 1.4 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: cmdline-undefined.mk,v 1.5 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Tests for undefined expressions in the command line.
|
||||
# Tests for undefined variables in expressions in the command line.
|
||||
|
||||
all:
|
||||
# When the command line is parsed, variable assignments using the
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: cmdline.mk,v 1.4 2022/06/10 18:58:07 rillig Exp $
|
||||
# $NetBSD: cmdline.mk,v 1.5 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Tests for command line parsing and related special variables.
|
||||
|
||||
|
@ -24,7 +24,7 @@ makeobjdir-direct:
|
|||
@${MAKE_CMD} MAKEOBJDIR=${DIR2} show-objdir
|
||||
|
||||
# The .OBJDIR can be set via the MAKEOBJDIR command line variable,
|
||||
# and that variable could even contain the usual modifiers.
|
||||
# and expressions based on that variable can contain the usual modifiers.
|
||||
# Since the .OBJDIR=MAKEOBJDIR assignment happens very early,
|
||||
# the SUB2 variable in the modifier is not defined yet and is therefore empty.
|
||||
# The SUB1 in the resulting path comes from the environment variable TMPBASE,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: comment.mk,v 1.6 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: comment.mk,v 1.7 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Demonstrate how comments are written in makefiles.
|
||||
|
||||
|
@ -53,9 +53,9 @@ VAR= \# # Both in the assignment.
|
|||
. error
|
||||
.endif
|
||||
|
||||
# Since 2012-03-24 the variable modifier :[#] does not need to be escaped.
|
||||
# To keep the parsing code simple, any "[#" does not start a comment, even
|
||||
# outside of an expression.
|
||||
# Since 2012-03-24 the modifier :[#] does not need to be escaped.
|
||||
# To keep the parsing code simple, the "#" in "[#" does not start a comment,
|
||||
# regardless of the syntactical context it appears in.
|
||||
WORDS= ${VAR:[#]} [#
|
||||
.if ${WORDS} != "1 [#"
|
||||
. error
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: cond-cmp-string.mk,v 1.18 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: cond-cmp-string.mk,v 1.19 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Tests for string comparisons in .if conditions.
|
||||
|
||||
|
@ -20,12 +20,12 @@
|
|||
. error
|
||||
.endif
|
||||
|
||||
# The left-hand side of the comparison requires that any expression
|
||||
# is defined.
|
||||
# An expression that occurs on the left-hand side of the comparison must be
|
||||
# defined.
|
||||
#
|
||||
# The variable named "" is never defined, nevertheless it can be used as a
|
||||
# starting point for expressions. Applying the :U modifier to such
|
||||
# an undefined expression turns it into a defined expression.
|
||||
# starting point for an expression. Applying the :U modifier to such an
|
||||
# undefined expression turns it into a defined expression.
|
||||
#
|
||||
# See ApplyModifier_Defined and DEF_DEFINED.
|
||||
.if ${:Ustr} != "str"
|
||||
|
@ -69,8 +69,9 @@
|
|||
.endif
|
||||
|
||||
# Between 2003-01-01 (maybe even earlier) and 2020-10-30, adding one of the
|
||||
# characters " \t!=><" directly after an expression resulted in a
|
||||
# "Malformed conditional", even though the string was well-formed.
|
||||
# characters " \t!=><" directly after an expression in a string literal
|
||||
# resulted in a "Malformed conditional", even though the string was
|
||||
# well-formed.
|
||||
.if ${:Uword } != "${:Uword} "
|
||||
. error
|
||||
.endif
|
||||
|
@ -94,8 +95,7 @@
|
|||
. error
|
||||
.endif
|
||||
|
||||
# Adding a space at the beginning of the quoted expression works
|
||||
# though.
|
||||
# Adding a space at the beginning of the quoted expression works though.
|
||||
.if ${:U word } != " ${:Uword} "
|
||||
. error
|
||||
.endif
|
||||
|
@ -145,7 +145,7 @@
|
|||
. error
|
||||
.endif
|
||||
|
||||
# Two variables with different values compare unequal.
|
||||
# Two expressions with different values compare unequal.
|
||||
VAR1= value1
|
||||
VAR2= value2
|
||||
.if ${VAR1} != ${VAR2}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
make: "cond-func-defined.mk" line 24: Missing closing parenthesis for defined()
|
||||
make: "cond-func-defined.mk" line 34: Missing closing parenthesis for defined()
|
||||
make: "cond-func-defined.mk" line 47: In .for loops, expressions for the loop variables are
|
||||
make: "cond-func-defined.mk" line 49: substituted at evaluation time. There is no actual variable
|
||||
make: "cond-func-defined.mk" line 51: involved, even if it feels like it.
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
exit status 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: cond-func-defined.mk,v 1.11 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: cond-func-defined.mk,v 1.12 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Tests for the defined() function in .if conditions.
|
||||
|
||||
|
@ -43,12 +43,9 @@ ${:UA B}= variable name with spaces
|
|||
. if defined(var)
|
||||
. error
|
||||
. else
|
||||
# expect+1: In .for loops, expressions for the loop variables are
|
||||
. info In .for loops, expressions for the loop variables are
|
||||
# expect+1: substituted at evaluation time. There is no actual variable
|
||||
. info substituted at evaluation time. There is no actual variable
|
||||
# expect+1: involved, even if it feels like it.
|
||||
. info involved, even if it feels like it.
|
||||
# In .for loops, expressions based on the loop variables are substituted at
|
||||
# evaluation time. There is no actual variable involved, even if the code in
|
||||
# the makefiles looks like it.
|
||||
. endif
|
||||
.endfor
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
make: "cond-token-string.mk" line 15: Unknown modifier "Z"
|
||||
make: "cond-token-string.mk" line 15: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z"
|
||||
make: "cond-token-string.mk" line 15: Malformed conditional ("" != "${:Uvalue:Z}")
|
||||
make: "cond-token-string.mk" line 25: xvalue is not defined.
|
||||
make: "cond-token-string.mk" line 32: Malformed conditional (x${:Uvalue} == "")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: cond-token-string.mk,v 1.9 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: cond-token-string.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for quoted string literals in .if conditions.
|
||||
#
|
||||
|
@ -11,7 +11,7 @@
|
|||
# Cover the code in CondParser_String that frees the memory after parsing
|
||||
# an expression based on an undefined variable.
|
||||
# expect+2: Malformed conditional ("" != "${:Uvalue:Z}")
|
||||
# expect+1: Unknown modifier "Z"
|
||||
# expect+1: while evaluating "${:Uvalue:Z}"": Unknown modifier "Z"
|
||||
.if "" != "${:Uvalue:Z}"
|
||||
. error
|
||||
.else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: depsrc-end.mk,v 1.1 2020/10/23 19:23:01 rillig Exp $
|
||||
# $NetBSD: depsrc-end.mk,v 1.2 2024/04/27 20:41:32 rillig Exp $
|
||||
#
|
||||
# Demonstrate the edge case that .BEGIN depends on .END, which sounds a bit
|
||||
# Demonstrate an edge case in which .BEGIN depends on .END, which sounds a bit
|
||||
# paradox but works since these special nodes are not in the dependency
|
||||
# hierarchy where the cycles are detected.
|
||||
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
: Making test-regular from depsrc-nopath.dir/regular.file
|
||||
: Making test-nopath from nopath.file
|
||||
exit status 0
|
||||
|
|
|
@ -1,8 +1,27 @@
|
|||
# $NetBSD: depsrc-nopath.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
|
||||
# $NetBSD: depsrc-nopath.mk,v 1.3 2024/04/27 20:41:32 rillig Exp $
|
||||
#
|
||||
# Tests for the special source .NOPATH in dependency declarations.
|
||||
|
||||
# TODO: Implementation
|
||||
.if !target(test-*)
|
||||
_!= rm -rf depsrc-nopath.dir
|
||||
_!= mkdir depsrc-nopath.dir
|
||||
_!= touch depsrc-nopath.dir/regular.file
|
||||
_!= touch depsrc-nopath.dir/nopath.file
|
||||
.endif
|
||||
|
||||
all:
|
||||
@:;
|
||||
@${MAKE} -f ${MAKEFILE} test-regular
|
||||
@${MAKE} -f ${MAKEFILE} test-nopath || echo "should have failed"
|
||||
@rm -rf depsrc-nopath.dir
|
||||
|
||||
.PATH: depsrc-nopath.dir
|
||||
|
||||
test-regular: regular.file
|
||||
: Making ${.TARGET} from ${.ALLSRC}
|
||||
test-nopath: nopath.file
|
||||
: Making ${.TARGET} from ${.ALLSRC}
|
||||
|
||||
nopath.file: .NOPATH
|
||||
|
||||
# expect: : Making test-regular from depsrc-nopath.dir/regular.file
|
||||
# expect: : Making test-nopath from nopath.file
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# $NetBSD: depsrc-phony.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
|
||||
# $NetBSD: depsrc-phony.mk,v 1.4 2024/04/27 20:41:32 rillig Exp $
|
||||
#
|
||||
# Tests for the special source .PHONY in dependency declarations,
|
||||
# which executes the commands for the target even if a file of the same
|
||||
# name exists and would be considered up to date.
|
||||
|
||||
# Without the .PHONY, this target would be "up to date".
|
||||
# expect: : depsrc-phony.mk is made.
|
||||
${MAKEFILE}: .PHONY
|
||||
: ${.TARGET:T} is made.
|
||||
|
|
|
@ -2,7 +2,7 @@ Expanding "depsrc-phony-pr-15164-*-wildcard"...
|
|||
Expanding "deptgt-phony-pr-15164-*-wildcard"...
|
||||
Searching for .depend ...
|
||||
failed.
|
||||
Searching for .depend ...
|
||||
Searching for .depend ...[dot last]...
|
||||
. ...
|
||||
failed.
|
||||
Wildcard expanding "all"...
|
||||
|
|
|
@ -8,7 +8,7 @@ ParseDependency(: empty-source)
|
|||
Parsing line 39: : command for empty targets list
|
||||
Parsing line 40: .MAKEFLAGS: -d0
|
||||
ParseDependency(.MAKEFLAGS: -d0)
|
||||
make: "deptgt.mk" line 49: Unknown modifier "Z"
|
||||
make: "deptgt.mk" line 49: while evaluating "${:U:Z}:": Unknown modifier "Z"
|
||||
make: "deptgt.mk" line 52: warning: Extra target 'ordinary' ignored
|
||||
make: "deptgt.mk" line 55: warning: Extra target (ordinary) ignored
|
||||
make: "deptgt.mk" line 58: warning: Special and mundane targets don't mix. Mundane ones ignored
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: deptgt.mk,v 1.16 2023/12/17 09:44:00 rillig Exp $
|
||||
# $NetBSD: deptgt.mk,v 1.17 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for special targets like .BEGIN or .SUFFIXES in dependency
|
||||
# declarations.
|
||||
|
@ -45,7 +45,7 @@ ${:U}: empty-source
|
|||
# expansion would be to use the variable modifier '::=' to modify the
|
||||
# targets. This in turn would be such an extreme and unreliable edge case
|
||||
# that nobody uses it.
|
||||
# expect+1: Unknown modifier "Z"
|
||||
# expect+1: while evaluating "${:U:Z}:": Unknown modifier "Z"
|
||||
$$$$$$$${:U:Z}:
|
||||
|
||||
# expect+1: warning: Extra target 'ordinary' ignored
|
||||
|
|
|
@ -10,6 +10,7 @@ Pattern for ':N' is "*"
|
|||
ModifyWords: split "<>" into 1 word
|
||||
Result of ${UT_VAR:N*} is ""
|
||||
ParseDependency(: )
|
||||
Parsing line 42: .if ${:!echo "\$UT_VAR"!} != "<>"
|
||||
CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<>"
|
||||
Var_Parse: ${:!echo "\$UT_VAR"!} != "<>" (eval-defined)
|
||||
Evaluating modifier ${:!...} on value "" (eval-defined, undefined)
|
||||
|
@ -34,6 +35,7 @@ Result of ${UT_VAR:N*} is ""
|
|||
ParseDependency(: )
|
||||
Parsing line 54: REF= defined
|
||||
Global: REF = defined
|
||||
Parsing line 58: .if ${:!echo "\$UT_VAR"!} != "<defined>"
|
||||
CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<defined>"
|
||||
Var_Parse: ${:!echo "\$UT_VAR"!} != "<defined>" (eval-defined)
|
||||
Evaluating modifier ${:!...} on value "" (eval-defined, undefined)
|
||||
|
|
|
@ -8,7 +8,7 @@ make: "directive-for-errors.mk" line 44: invalid character '$' in .for loop vari
|
|||
make: "directive-for-errors.mk" line 52: no iteration variables in for
|
||||
make: "directive-for-errors.mk" line 64: Wrong number of words (5) in .for substitution list with 3 variables
|
||||
make: "directive-for-errors.mk" line 78: missing `in' in for
|
||||
make: "directive-for-errors.mk" line 89: Unknown modifier "Z"
|
||||
make: "directive-for-errors.mk" line 89: while evaluating "${:U3:Z} 4": Unknown modifier "Z"
|
||||
make: "directive-for-errors.mk" line 90: warning: Should not be reached.
|
||||
make: "directive-for-errors.mk" line 90: warning: Should not be reached.
|
||||
make: "directive-for-errors.mk" line 90: warning: Should not be reached.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: directive-for-errors.mk,v 1.9 2023/12/19 19:33:40 rillig Exp $
|
||||
# $NetBSD: directive-for-errors.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for error handling in .for loops.
|
||||
|
||||
|
@ -85,7 +85,7 @@ ${:U\\}= backslash # see whether the "variable" '\' is local
|
|||
#
|
||||
# XXX: As of 2020-12-31, Var_Subst doesn't report any errors, therefore
|
||||
# the loop body is expanded as if no error had happened.
|
||||
# expect+1: Unknown modifier "Z"
|
||||
# expect+1: while evaluating "${:U3:Z} 4": Unknown modifier "Z"
|
||||
.for i in 1 2 ${:U3:Z} 4
|
||||
. warning Should not be reached.
|
||||
.endfor
|
||||
|
|
|
@ -106,6 +106,7 @@ make: "directive-for-escape.mk" line 228: long: " "
|
|||
For: end for 1
|
||||
For: loop body with i = "
|
||||
":
|
||||
Parsing line 244: .for i in "${.newline}"
|
||||
For: end for 1
|
||||
Parse_PushInput: .for loop in directive-for-escape.mk, line 244
|
||||
make: "directive-for-escape.mk" line 244: newline in .for value
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
make: "(stdin)" line 2: Zero byte read from file
|
||||
make: "(stdin)" line 2: Unexpected end of file in .for loop
|
||||
make: "(stdin)" line 3: Zero byte read from file
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
*** Error code 1 (continuing)
|
||||
*** Error code 2 (continuing)
|
||||
|
||||
Stop.
|
||||
make: stopped in unit-tests
|
||||
|
|
|
@ -1,18 +1,8 @@
|
|||
# $NetBSD: directive-for-null.mk,v 1.3 2022/06/12 15:03:27 rillig Exp $
|
||||
# $NetBSD: directive-for-null.mk,v 1.4 2024/04/01 12:26:02 rillig Exp $
|
||||
#
|
||||
# Test for parsing a .for loop that accidentally contains a null byte.
|
||||
#
|
||||
# As of 2020-12-19, there are 3 error messages:
|
||||
#
|
||||
# make: "(stdin)" line 2: Zero byte read from file
|
||||
# make: "(stdin)" line 2: Unexpected end of file in for loop.
|
||||
# make: "(stdin)" line 3: Zero byte read from file
|
||||
#
|
||||
# The one about "end of file" might be misleading but is due to the
|
||||
# implementation. On both errors and EOF, ParseRawLine returns NULL.
|
||||
#
|
||||
# The one about the "zero byte" in line 3 is surprising since the only
|
||||
# line that contains a null byte is line 2.
|
||||
# expect: make: "(stdin)" line 2: Zero byte read from file
|
||||
|
||||
all: .PHONY
|
||||
@printf '%s\n' \
|
||||
|
|
|
@ -17,7 +17,7 @@ make: "directive-for.mk" line 146: }{ }{ }{
|
|||
make: "directive-for.mk" line 166: invalid character ':' in .for loop variable name
|
||||
make: "directive-for.mk" line 173: invalid character '$' in .for loop variable name
|
||||
make: "directive-for.mk" line 185: invalid character '$' in .for loop variable name
|
||||
make: "directive-for.mk" line 210: Unknown modifier "Z"
|
||||
make: "directive-for.mk" line 210: while evaluating "${:Uword2:Z}-after word3": Unknown modifier "Z"
|
||||
make: "directive-for.mk" line 211: XXX: Should not reach word1
|
||||
make: "directive-for.mk" line 211: XXX: Should not reach before--after
|
||||
make: "directive-for.mk" line 211: XXX: Should not reach word3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: directive-for.mk,v 1.24 2023/12/06 22:28:20 rillig Exp $
|
||||
# $NetBSD: directive-for.mk,v 1.25 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for the .for directive.
|
||||
#
|
||||
|
@ -206,7 +206,7 @@ INDIRECT= ${DIRECT}
|
|||
# XXX: A parse error or evaluation error in the items of the .for loop
|
||||
# should skip the whole loop. As of 2023-05-09, the loop is expanded as
|
||||
# usual.
|
||||
# expect+1: Unknown modifier "Z"
|
||||
# expect+1: while evaluating "${:Uword2:Z}-after word3": Unknown modifier "Z"
|
||||
.for var in word1 before-${:Uword2:Z}-after word3
|
||||
. info XXX: Should not reach ${var}
|
||||
.endfor
|
||||
|
|
|
@ -4,7 +4,7 @@ CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
|
|||
Comparing "directive-include.mk null" != "directive-include.mk null"
|
||||
make: "directive-include.mk" line 26: Could not find nonexistent.mk
|
||||
make: "directive-include.mk" line 49: Could not find "
|
||||
make: "directive-include.mk" line 56: Unknown modifier "Z"
|
||||
make: "directive-include.mk" line 56: while evaluating "${:U123:Z}.mk": Unknown modifier "Z"
|
||||
make: "directive-include.mk" line 56: Could not find nonexistent.mk
|
||||
make: "directive-include.mk" line 61: Cannot open /nonexistent
|
||||
make: "directive-include.mk" line 66: Invalid line 'include'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: directive-include.mk,v 1.13 2023/08/19 10:52:14 rillig Exp $
|
||||
# $NetBSD: directive-include.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for the .include directive, which includes another file.
|
||||
|
||||
|
@ -52,7 +52,7 @@ DQUOT= "
|
|||
# expression is skipped and the file is included nevertheless.
|
||||
# FIXME: Add proper error handling, no file must be included here.
|
||||
# expect+2: Could not find nonexistent.mk
|
||||
# expect+1: Unknown modifier "Z"
|
||||
# expect+1: while evaluating "${:U123:Z}.mk": Unknown modifier "Z"
|
||||
.include "nonexistent${:U123:Z}.mk"
|
||||
|
||||
# The traditional include directive is seldom used.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
make: "directive-undef.mk" line 30: The .undef directive requires an argument
|
||||
make: "directive-undef.mk" line 88: Unknown modifier "Z"
|
||||
make: "directive-undef.mk" line 88: while evaluating variable "VARNAMES": Unknown modifier "Z"
|
||||
make: "directive-undef.mk" line 105: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore.
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: directive-undef.mk,v 1.13 2023/06/01 20:56:35 rillig Exp $
|
||||
# $NetBSD: directive-undef.mk,v 1.14 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for the .undef directive.
|
||||
#
|
||||
|
@ -84,7 +84,7 @@ ${DOLLAR}= dollar
|
|||
#
|
||||
# As of var.c 1.762, this doesn't happen though because the error handling
|
||||
# in Var_Parse and Var_Subst is not done properly.
|
||||
# expect+1: Unknown modifier "Z"
|
||||
# expect+1: while evaluating variable "VARNAMES": Unknown modifier "Z"
|
||||
.undef ${VARNAMES:L:Z}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
make: In the :@ modifier of "VAR", the variable name "${:Ubar:S,b,v,}" must not contain a dollar
|
||||
make: in target "mod-loop-varname": while evaluating variable "VAR": In the :@ modifier, the variable name "${:Ubar:S,b,v,}" must not contain a dollar
|
||||
y@:Q}
|
||||
xvaluey
|
||||
exit status 2
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
mod-unknown-direct:
|
||||
want: Unknown modifier 'Z'
|
||||
make: Unknown modifier "Z"
|
||||
make: in target "mod-unknown-direct": while evaluating variable "VAR": Unknown modifier "Z"
|
||||
VAR:Z=before--after
|
||||
|
||||
mod-unknown-indirect:
|
||||
want: Unknown modifier 'Z'
|
||||
make: Unknown modifier "Z"
|
||||
make: in target "mod-unknown-indirect": while evaluating variable "VAR": Unknown modifier "Z"
|
||||
VAR:Z=before-inner}-after
|
||||
|
||||
unclosed-direct:
|
||||
|
@ -119,17 +119,17 @@ then
|
|||
|
||||
mod-remember-parse:
|
||||
1 1 2 3 5 8 13 21 34
|
||||
make: Unknown modifier "__"
|
||||
make: in target "mod-remember-parse": while evaluating variable "FIB": Unknown modifier "__"
|
||||
|
||||
|
||||
mod-sysv-parse:
|
||||
make: Unknown modifier "3"
|
||||
make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3"
|
||||
make: Unclosed expression, expecting '}' for modifier "3" of variable "FIB" with value ""
|
||||
|
||||
make: Unknown modifier "3="
|
||||
make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3="
|
||||
make: Unclosed expression, expecting '}' for modifier "3=" of variable "FIB" with value ""
|
||||
|
||||
make: Unknown modifier "3=x3"
|
||||
make: in target "mod-sysv-parse": while evaluating variable "FIB": Unknown modifier "3=x3"
|
||||
make: Unclosed expression, expecting '}' for modifier "3=x3" of variable "FIB" with value ""
|
||||
|
||||
1 1 2 x3 5 8 1x3 21 34
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: opt-chdir.mk,v 1.6 2021/05/18 17:05:45 sjg Exp $
|
||||
# $NetBSD: opt-chdir.mk,v 1.7 2024/04/02 11:11:00 rillig Exp $
|
||||
#
|
||||
# Tests for the -C command line option, which changes the directory at the
|
||||
# beginning.
|
||||
|
@ -7,15 +7,9 @@
|
|||
|
||||
.MAKEFLAGS: -d0 # switch stdout to line-buffered
|
||||
|
||||
all: chdir-filename-too-long
|
||||
all: chdir-root
|
||||
all: chdir-nonexistent
|
||||
|
||||
# Try to overflow the internal buffer for .CURDIR, which is curdir.
|
||||
chdir-filename-too-long: .PHONY .IGNORE
|
||||
# 5000 slashes, separated by dots: /./././.../././
|
||||
@${MAKE} -C ${:U:range=5000:@@/@:ts.}
|
||||
|
||||
# Changing to another directory is possible via the command line.
|
||||
# In this test, it is the root directory since almost any other directory
|
||||
# is not guaranteed to exist on every platform.
|
||||
|
|
|
@ -2,6 +2,7 @@ echo '3 spaces'; false
|
|||
3 spaces
|
||||
|
||||
*** Failed target: fail-spaces
|
||||
*** In directory: <curdir>
|
||||
*** Failed commands:
|
||||
echo '3 spaces'; false
|
||||
*** [fail-spaces] Error code 1
|
||||
|
@ -11,6 +12,7 @@ echo \ indented; false
|
|||
indented
|
||||
|
||||
*** Failed target: fail-escaped-space
|
||||
*** In directory: <curdir>
|
||||
*** Failed commands:
|
||||
echo \ indented; false
|
||||
*** [fail-escaped-space] Error code 1
|
||||
|
@ -22,6 +24,7 @@ line1
|
|||
line2
|
||||
|
||||
*** Failed target: fail-newline
|
||||
*** In directory: <curdir>
|
||||
*** Failed commands:
|
||||
echo 'line1${.newline}line2'; false
|
||||
=> echo 'line1
|
||||
|
@ -33,6 +36,7 @@ echo 'line1 line2'; false
|
|||
line1 line2
|
||||
|
||||
*** Failed target: fail-multiline
|
||||
*** In directory: <curdir>
|
||||
*** Failed commands:
|
||||
echo 'line1 line2'; false
|
||||
*** [fail-multiline] Error code 1
|
||||
|
@ -42,6 +46,7 @@ echo 'word1' 'word2'; false
|
|||
word1 word2
|
||||
|
||||
*** Failed target: fail-multiline-intention
|
||||
*** In directory: <curdir>
|
||||
*** Failed commands:
|
||||
echo 'word1' 'word2'; false
|
||||
*** [fail-multiline-intention] Error code 1
|
||||
|
@ -49,6 +54,7 @@ word1 word2
|
|||
make: stopped in unit-tests
|
||||
|
||||
*** Failed target: fail-vars
|
||||
*** In directory: <curdir>
|
||||
*** Failed commands:
|
||||
@${COMPILE_C} ${COMPILE_C_FLAGS}
|
||||
=> @false c-compiler flag1 -macro="several words"
|
||||
|
|
|
@ -2,9 +2,9 @@ make: "opt-debug-lint.mk" line 21: Variable "X" is undefined
|
|||
make: "opt-debug-lint.mk" line 21: Malformed conditional ($X)
|
||||
make: "opt-debug-lint.mk" line 45: Variable "UNDEF" is undefined
|
||||
make: "opt-debug-lint.mk" line 45: Malformed conditional (${UNDEF})
|
||||
make: "opt-debug-lint.mk" line 67: Missing delimiter ':' after modifier "L"
|
||||
make: "opt-debug-lint.mk" line 67: Missing delimiter ':' after modifier "P"
|
||||
make: "opt-debug-lint.mk" line 76: Unknown modifier "${"
|
||||
make: "opt-debug-lint.mk" line 67: while evaluating variable "value": Missing delimiter ':' after modifier "L"
|
||||
make: "opt-debug-lint.mk" line 67: while evaluating variable "value": Missing delimiter ':' after modifier "P"
|
||||
make: "opt-debug-lint.mk" line 76: while evaluating variable "value": Unknown modifier "${"
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
exit status 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: opt-debug-lint.mk,v 1.16 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: opt-debug-lint.mk,v 1.17 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for the -dL command line option, which runs additional checks
|
||||
# to catch common mistakes, such as unclosed expressions.
|
||||
|
@ -62,8 +62,8 @@ ${UNDEF}: ${UNDEF}
|
|||
|
||||
# Since 2020-10-03, in lint mode the variable modifier must be separated
|
||||
# by colons. See varparse-mod.mk.
|
||||
# expect+2: Missing delimiter ':' after modifier "L"
|
||||
# expect+1: Missing delimiter ':' after modifier "P"
|
||||
# expect+2: while evaluating variable "value": Missing delimiter ':' after modifier "L"
|
||||
# expect+1: while evaluating variable "value": Missing delimiter ':' after modifier "P"
|
||||
.if ${value:LPL} != "value"
|
||||
. error
|
||||
.endif
|
||||
|
@ -72,7 +72,7 @@ ${UNDEF}: ${UNDEF}
|
|||
# variable modifier had to be separated by colons. This was wrong though
|
||||
# since make always fell back trying to parse the indirect modifier as a
|
||||
# SysV modifier.
|
||||
# expect+1: Unknown modifier "${"
|
||||
# expect+1: while evaluating variable "value": Unknown modifier "${"
|
||||
.if ${value:${:UL}PL} != "LPL}" # FIXME: "LPL}" is unexpected here.
|
||||
. error ${value:${:UL}PL}
|
||||
.endif
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Parsing line 16: .for var in value
|
||||
Parse_PushInput: .for loop in opt-debug-parse.mk, line 16
|
||||
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk'
|
||||
Parsing line 21: .info trace with multi-line .for loop head
|
||||
|
@ -11,6 +12,7 @@ SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `null'
|
|||
SetFilenameVars: ${.INCLUDEDFROMDIR} = <some-dir> ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk'
|
||||
ParseEOF: returning to file opt-debug-parse.mk, line 27
|
||||
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk'
|
||||
Parsing line 31: .for a b c in 1 2 3 ${:U4 5 6}
|
||||
Parse_PushInput: .for loop in opt-debug-parse.mk, line 31
|
||||
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk'
|
||||
Parsing line 34: .info trace
|
||||
|
|
|
@ -2,9 +2,7 @@ value
|
|||
value
|
||||
line-with-trailing-whitespace
|
||||
make: "(stdin)" line 1: Zero byte read from file
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
*** Error code 1 (continuing)
|
||||
*** Error code 2 (continuing)
|
||||
`all' not remade because of errors.
|
||||
|
||||
Stop.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: opt-file.mk,v 1.15 2022/03/26 13:32:31 rillig Exp $
|
||||
# $NetBSD: opt-file.mk,v 1.16 2024/04/01 12:26:02 rillig Exp $
|
||||
#
|
||||
# Tests for the -f command line option, which adds a makefile to the list of
|
||||
# files that are parsed.
|
||||
|
@ -79,7 +79,7 @@ line-with-trailing-whitespace: .PHONY
|
|||
# exit status 0
|
||||
#
|
||||
# 2008 to 2010:
|
||||
# make: "zero-byte.in" line 1: Zero byte read from file
|
||||
# make: "(stdin)" line 1: Zero byte read from file
|
||||
# make: Fatal errors encountered -- cannot continue
|
||||
#
|
||||
# make: stopped in .
|
||||
|
@ -92,14 +92,18 @@ line-with-trailing-whitespace: .PHONY
|
|||
# exit status 2
|
||||
#
|
||||
# 2014 to 2020-12-06:
|
||||
# make: "zero-byte.in" line 1: warning: Zero byte read from file, skipping rest of line.
|
||||
# make: "(stdin)" line 1: warning: Zero byte read from file, skipping rest of line.
|
||||
# exit status 0
|
||||
#
|
||||
# Since 2020-12-07:
|
||||
# make: "zero-byte.in" line 1: Zero byte read from file
|
||||
# make: "(stdin)" line 1: Zero byte read from file
|
||||
# make: Fatal errors encountered -- cannot continue
|
||||
# make: stopped in .
|
||||
# exit status 1
|
||||
#
|
||||
# Since 2024-04-01:
|
||||
# make: "(stdin)" line 1: Zero byte read from file
|
||||
# *** Error code 2 (continuing)
|
||||
file-containing-null-byte: .PHONY
|
||||
@printf '%s\n' 'VAR=value' 'VAR2=VALUE2' \
|
||||
| tr 'l' '\0' \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: opt-keep-going-indirect.mk,v 1.2 2022/02/12 20:05:36 rillig Exp $
|
||||
# $NetBSD: opt-keep-going-indirect.mk,v 1.3 2024/04/02 15:05:15 rillig Exp $
|
||||
#
|
||||
# Tests for the -k command line option, which stops building a target as soon
|
||||
# as an error is detected, but continues building the other, independent
|
||||
|
@ -49,19 +49,19 @@
|
|||
# to the child processes.
|
||||
all:
|
||||
@echo 'direct compat'
|
||||
@set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?"
|
||||
@set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k direct; echo "exited $$?"
|
||||
@echo
|
||||
|
||||
@echo 'direct jobs'
|
||||
@set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?"
|
||||
@set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k direct -j1; echo "exited $$?"
|
||||
@echo
|
||||
|
||||
@echo 'indirect compat'
|
||||
@set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?"
|
||||
@set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k indirect; echo "exited $$?"
|
||||
@echo
|
||||
|
||||
@echo 'indirect jobs'
|
||||
@set +e; env -i ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?"
|
||||
@set +e; env -i "PATH=$$PATH" ${MAKE} -r -f ${MAKEFILE} -k indirect -j1; echo "exited $$?"
|
||||
@echo
|
||||
|
||||
indirect: direct
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: opt-m-include-dir.mk,v 1.4 2020/09/01 20:14:34 rillig Exp $
|
||||
# $NetBSD: opt-m-include-dir.mk,v 1.5 2024/04/30 16:13:34 sjg Exp $
|
||||
#
|
||||
# Tests for the -m command line option, which adds a directory to the
|
||||
# search path for the .include <...> directive.
|
||||
|
@ -22,11 +22,14 @@
|
|||
TEST_DIR:= ${.PARSEFILE:R}.tmp/sub/sub/sub/workdir
|
||||
CANARY_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-canary.mk
|
||||
ACTUAL_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-step3.mk
|
||||
WANTED_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-check.mk
|
||||
|
||||
_!= mkdir -p ${TEST_DIR}
|
||||
_!= > ${CANARY_FILE}
|
||||
_!= cp ${MAKEFILE} ${TEST_DIR}/step2.mk
|
||||
_!= cp ${MAKEFILE} ${ACTUAL_FILE}
|
||||
_!= echo CHECK=ok > ${WANTED_FILE}
|
||||
_!= echo CHECK=${WANTED_FILE:T} found in .CURDIR > ${TEST_DIR}/${WANTED_FILE:T}
|
||||
|
||||
step1:
|
||||
@${.MAKE} -C ${TEST_DIR} -f step2.mk step2
|
||||
|
@ -52,9 +55,10 @@ step1:
|
|||
.elif ${.PARSEFILE:T} == "opt-m-step3.mk"
|
||||
|
||||
# This file is included by step2.mk.
|
||||
.include <opt-m-check.mk>
|
||||
|
||||
step2:
|
||||
@echo ok
|
||||
@echo ${CHECK}
|
||||
|
||||
.else
|
||||
. error
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
make: "var-eval-short.mk" line 46: In the :@ modifier of "", the variable name "${FAIL}" must not contain a dollar
|
||||
make: "var-eval-short.mk" line 46: while evaluating "${:Uword:@${FAIL}@expr@}": In the :@ modifier, the variable name "${FAIL}" must not contain a dollar
|
||||
make: "var-eval-short.mk" line 46: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@})
|
||||
Parsing line 159: .if 0 && ${0:?${FAIL}then:${FAIL}else}
|
||||
CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else}
|
||||
Var_Parse: ${0:?${FAIL}then:${FAIL}else} (parse-only)
|
||||
Parsing modifier ${0:?...}
|
||||
|
@ -10,6 +11,7 @@ Modifier part: "${FAIL}else"
|
|||
Result of ${0:?${FAIL}then:${FAIL}else} is "" (parse-only, defined)
|
||||
Parsing line 167: DEFINED= defined
|
||||
Global: DEFINED = defined
|
||||
Parsing line 168: .if 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else}
|
||||
CondParser_Eval: 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else}
|
||||
Var_Parse: ${DEFINED:L:?${FAIL}then:${FAIL}else} (parse-only)
|
||||
Parsing modifier ${DEFINED:L}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: var-eval-short.mk,v 1.11 2023/10/19 18:24:33 rillig Exp $
|
||||
# $NetBSD: var-eval-short.mk,v 1.12 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for each variable modifier to ensure that they only do the minimum
|
||||
# necessary computations. If the result of the expression is irrelevant,
|
||||
|
@ -41,7 +41,7 @@ FAIL= ${:!echo unexpected 1>&2!}
|
|||
# after the loop, when undefining the temporary global loop variable.
|
||||
# Since var.c 1.907 from 2021-04-04, a '$' is no longer allowed in the
|
||||
# variable name.
|
||||
# expect+2: In the :@ modifier of "", the variable name "${FAIL}" must not contain a dollar
|
||||
# expect+2: while evaluating "${:Uword:@${FAIL}@expr@}": In the :@ modifier, the variable name "${FAIL}" must not contain a dollar
|
||||
# expect+1: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@})
|
||||
.if 0 && ${:Uword:@${FAIL}@expr@}
|
||||
.endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
make: "var-op-expand.mk" line 274: Unknown modifier "s,value,replaced,"
|
||||
make: "var-op-expand.mk" line 274: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced,"
|
||||
make: "var-op-expand.mk" line 278: warning: XXX Neither branch should be taken.
|
||||
make: "var-op-expand.mk" line 283: Unknown modifier "s,value,replaced,"
|
||||
make: "var-op-expand.mk" line 283: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced,"
|
||||
make: "var-op-expand.mk" line 285: warning: XXX Neither branch should be taken.
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: var-op-expand.mk,v 1.19 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: var-op-expand.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for the := variable assignment operator, which expands its
|
||||
# right-hand side.
|
||||
|
@ -270,7 +270,7 @@ later= lowercase-value
|
|||
.undef later
|
||||
INDIRECT:= ${LATER:S,value,replaced,} OK ${LATER:value=sysv}
|
||||
indirect:= ${INDIRECT:tl}
|
||||
# expect+1: Unknown modifier "s,value,replaced,"
|
||||
# expect+1: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced,"
|
||||
.if ${indirect} != " ok "
|
||||
. error
|
||||
.else
|
||||
|
@ -279,7 +279,7 @@ indirect:= ${INDIRECT:tl}
|
|||
.endif
|
||||
LATER= uppercase-value
|
||||
later= lowercase-value
|
||||
# expect+1: Unknown modifier "s,value,replaced,"
|
||||
# expect+1: while evaluating variable "indirect": while evaluating variable "later": Unknown modifier "s,value,replaced,"
|
||||
.if ${indirect} != "uppercase-replaced ok uppercase-sysv"
|
||||
# expect+1: warning: XXX Neither branch should be taken.
|
||||
. warning XXX Neither branch should be taken.
|
||||
|
|
|
@ -54,7 +54,7 @@ Var_Parse: ${:Uvariable:unknown} (eval-defined)
|
|||
Evaluating modifier ${:U...} on value "" (eval-defined, undefined)
|
||||
Result of ${:Uvariable} is "variable" (eval-defined, defined)
|
||||
Evaluating modifier ${:u...} on value "variable" (eval-defined, defined)
|
||||
make: "vardebug.mk" line 63: Unknown modifier "unknown"
|
||||
make: "vardebug.mk" line 63: while evaluating "${:Uvariable:unknown}": Unknown modifier "unknown"
|
||||
Result of ${:unknown} is error (eval-defined, defined)
|
||||
make: "vardebug.mk" line 63: Malformed conditional (${:Uvariable:unknown})
|
||||
Var_Parse: ${UNDEFINED} (eval-defined)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: vardebug.mk,v 1.9 2023/12/20 09:46:00 rillig Exp $
|
||||
# $NetBSD: vardebug.mk,v 1.10 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Demonstrates the debugging output for var.c.
|
||||
|
||||
|
@ -59,7 +59,7 @@ VAR+= 3
|
|||
# as "is error", without surrounding quotes.
|
||||
# expect: Result of ${:unknown} is error (eval-defined, defined)
|
||||
# expect+2: Malformed conditional (${:Uvariable:unknown})
|
||||
# expect+1: Unknown modifier "unknown"
|
||||
# expect+1: while evaluating "${:Uvariable:unknown}": Unknown modifier "unknown"
|
||||
.if ${:Uvariable:unknown}
|
||||
.endif
|
||||
|
||||
|
|
|
@ -44,26 +44,26 @@ parse-dynamic: parse-dynamic parse-dynamic before
|
|||
parse-dynamic: parse-dynamic parse-dynamic after
|
||||
parse-dynamic: parse-dynamic parse-dynamic after
|
||||
varerror-unclosed:begin
|
||||
make: Unclosed variable ""
|
||||
make: in target "varerror-unclosed": Unclosed variable ""
|
||||
|
||||
make: Unclosed variable "UNCLOSED"
|
||||
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED"
|
||||
|
||||
make: Unclosed variable "UNCLOSED"
|
||||
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED"
|
||||
|
||||
make: Unclosed variable "PATTERN"
|
||||
make: in target "varerror-unclosed": while evaluating variable "UNCLOSED": Unclosed variable "PATTERN"
|
||||
make: Unclosed expression, expecting '}' for modifier "M${PATTERN" of variable "UNCLOSED" with value ""
|
||||
|
||||
make: Unclosed variable "param"
|
||||
make: Unclosed variable "UNCLOSED."
|
||||
make: in target "varerror-unclosed": Unclosed variable "param"
|
||||
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED."
|
||||
|
||||
|
||||
make: Unclosed variable "UNCLOSED.1"
|
||||
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.1"
|
||||
|
||||
make: Unclosed variable "UNCLOSED.2"
|
||||
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.2"
|
||||
|
||||
make: Unclosed variable "UNCLOSED.3"
|
||||
make: in target "varerror-unclosed": Unclosed variable "UNCLOSED.3"
|
||||
|
||||
make: Unclosed variable "UNCLOSED_ORIG"
|
||||
make: in target "varerror-unclosed": while evaluating variable "UNCLOSED_INDIR_2": while evaluating variable "UNCLOSED_INDIR_1": Unclosed variable "UNCLOSED_ORIG"
|
||||
|
||||
varerror-unclosed:end
|
||||
target1-flags: we have: one two
|
||||
|
|
|
@ -42,7 +42,7 @@ mod-assign-empty: value}
|
|||
make: Bad modifier ":" for variable ""
|
||||
mod-assign-empty: overwritten}
|
||||
mod-assign-empty: VAR=overwritten
|
||||
make: Unknown modifier ":x"
|
||||
make: in target "mod-assign-parse": while evaluating variable "ASSIGN": Unknown modifier ":x"
|
||||
|
||||
sysv:y
|
||||
make: Unfinished modifier for "ASSIGN" ('}' missing)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: varmod-assign.mk,v 1.19 2024/01/07 11:42:22 rillig Exp $
|
||||
# $NetBSD: varmod-assign.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for the obscure ::= variable modifiers, which perform variable
|
||||
# assignments during evaluation, just like the = operator in C.
|
||||
|
@ -90,7 +90,7 @@ mod-assign-empty:
|
|||
mod-assign-parse:
|
||||
# The modifier for assignment operators starts with a ':'.
|
||||
# An 'x' after that is an invalid modifier.
|
||||
# expect: make: Unknown modifier ":x"
|
||||
# expect: make: in target "mod-assign-parse": while evaluating variable "ASSIGN": Unknown modifier ":x"
|
||||
@echo ${ASSIGN::x}
|
||||
|
||||
# When parsing an assignment operator fails because the operator is
|
||||
|
|
|
@ -15,10 +15,10 @@ make: "varmod-edge.mk" line 184: ok eq-bs
|
|||
make: Unfinished modifier for "INP.eq-esc" ('=' missing)
|
||||
make: "varmod-edge.mk" line 184: ok eq-esc
|
||||
make: "varmod-edge.mk" line 184: ok colon
|
||||
make: "varmod-edge.mk" line 167: Unknown modifier ":"
|
||||
make: "varmod-edge.mk" line 167: Unknown modifier ":"
|
||||
make: "varmod-edge.mk" line 167: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
|
||||
make: "varmod-edge.mk" line 167: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
|
||||
make: "varmod-edge.mk" line 184: ok colons
|
||||
make: "varmod-edge.mk" line 195: Unknown modifier "Z"
|
||||
make: "varmod-edge.mk" line 195: while evaluating "${:Z}": Unknown modifier "Z"
|
||||
make: "varmod-edge.mk" line 195: Malformed conditional (${:Z})
|
||||
make: Unfinished modifier for "" (',' missing)
|
||||
make: "varmod-edge.mk" line 209: Malformed conditional (${:S,})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: varmod-edge.mk,v 1.19 2023/11/19 22:06:15 rillig Exp $
|
||||
# $NetBSD: varmod-edge.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for edge cases in variable modifiers.
|
||||
#
|
||||
|
@ -162,8 +162,8 @@ MOD.colons= ${INP.colons::::}
|
|||
EXP.colons= # empty
|
||||
|
||||
.for test in ${TESTS}
|
||||
# expect+2: Unknown modifier ":"
|
||||
# expect+1: Unknown modifier ":"
|
||||
# expect+2: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
|
||||
# expect+1: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
|
||||
. if ${MOD.${test}} == ${EXP.${test}}
|
||||
# expect+16: ok M-paren
|
||||
# expect+15: ok M-mixed
|
||||
|
@ -191,7 +191,7 @@ EXP.colons= # empty
|
|||
# XXX: The error message should mention the variable name of the expression,
|
||||
# even though that name is empty in this case.
|
||||
# expect+2: Malformed conditional (${:Z})
|
||||
# expect+1: Unknown modifier "Z"
|
||||
# expect+1: while evaluating "${:Z}": Unknown modifier "Z"
|
||||
.if ${:Z}
|
||||
. error
|
||||
.else
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
make: "varmod-gmtime.mk" line 61: Invalid time value "-1"
|
||||
make: "varmod-gmtime.mk" line 61: while evaluating "${:L:gmtime=-1} != """: Invalid time value "-1"
|
||||
make: "varmod-gmtime.mk" line 61: Malformed conditional (${:L:gmtime=-1} != "")
|
||||
make: "varmod-gmtime.mk" line 72: Invalid time value " 1"
|
||||
make: "varmod-gmtime.mk" line 72: while evaluating "${:L:gmtime= 1} != """: Invalid time value " 1"
|
||||
make: "varmod-gmtime.mk" line 72: Malformed conditional (${:L:gmtime= 1} != "")
|
||||
make: "varmod-gmtime.mk" line 120: Invalid time value "10000000000000000000000000000000"
|
||||
make: "varmod-gmtime.mk" line 120: while evaluating "${:L:gmtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000"
|
||||
make: "varmod-gmtime.mk" line 120: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "")
|
||||
make: "varmod-gmtime.mk" line 133: Invalid time value "error"
|
||||
make: "varmod-gmtime.mk" line 133: while evaluating "${:L:gmtime=error} != """: Invalid time value "error"
|
||||
make: "varmod-gmtime.mk" line 133: Malformed conditional (${:L:gmtime=error} != "")
|
||||
make: "varmod-gmtime.mk" line 144: Invalid time value "100000S,1970,bad,"
|
||||
make: "varmod-gmtime.mk" line 144: while evaluating variable "%Y": Invalid time value "100000S,1970,bad,"
|
||||
make: "varmod-gmtime.mk" line 144: Malformed conditional (${%Y:L:gmtime=100000S,1970,bad,} != "bad")
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: varmod-gmtime.mk,v 1.21 2023/11/19 21:47:52 rillig Exp $
|
||||
# $NetBSD: varmod-gmtime.mk,v 1.22 2024/04/20 10:18:55 rillig Exp $
|
||||
#
|
||||
# Tests for the :gmtime variable modifier, which formats a timestamp
|
||||
# using strftime(3) in UTC.
|
||||
|
@ -56,7 +56,7 @@
|
|||
# 1970. Going back 50 years in the past is not a practical use case for
|
||||
# make. Therefore, since var.c 1.631, negative time stamps produce a
|
||||
# parse error.
|
||||
# expect+2: Invalid time value "-1"
|
||||
# expect+2: while evaluating "${:L:gmtime=-1} != """: Invalid time value "-1"
|
||||
# expect+1: Malformed conditional (${:L:gmtime=-1} != "")
|
||||
.if ${:L:gmtime=-1} != ""
|
||||
. error
|
||||
|
@ -67,7 +67,7 @@
|
|||
|
||||
# Spaces were allowed before var.c 1.631 from 2020-10-31 21:40:20, not
|
||||
# because it would make sense but just as a side-effect from using strtoul.
|
||||
# expect+2: Invalid time value " 1"
|
||||
# expect+2: while evaluating "${:L:gmtime= 1} != """: Invalid time value " 1"
|
||||
# expect+1: Malformed conditional (${:L:gmtime= 1} != "")
|
||||
.if ${:L:gmtime= 1} != ""
|
||||
. error
|
||||
|
@ -115,7 +115,7 @@
|
|||
#
|
||||
# Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a
|
||||
# parse error.
|
||||
# expect+2: Invalid time value "10000000000000000000000000000000"
|
||||
# expect+2: while evaluating "${:L:gmtime=10000000000000000000000000000000} != """: Invalid time value "10000000000000000000000000000000"
|
||||
# expect+1: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "")
|
||||
.if ${:L:gmtime=10000000000000000000000000000000} != ""
|
||||
. error
|
||||
|
@ -128,7 +128,7 @@
|
|||
# stopped after the '=', and the remaining string was parsed for more variable
|
||||
# modifiers. Because of the unknown modifier 'e' from the 'error', the whole
|
||||
# variable value was discarded and thus not printed.
|
||||
# expect+2: Invalid time value "error"
|
||||
# expect+2: while evaluating "${:L:gmtime=error} != """: Invalid time value "error"
|
||||
# expect+1: Malformed conditional (${:L:gmtime=error} != "")
|
||||
.if ${:L:gmtime=error} != ""
|
||||
. error
|
||||
|
@ -139,7 +139,7 @@
|
|||
# Before var.c 1.1050 from 2023-05-09, the timestamp could be directly
|
||||
# followed by the next modifier, without a ':' separator. This was the same
|
||||
# bug as for the ':L' and ':P' modifiers.
|
||||
# expect+2: Invalid time value "100000S,1970,bad,"
|
||||
# expect+2: while evaluating variable "%Y": Invalid time value "100000S,1970,bad,"
|
||||
# expect+1: Malformed conditional (${%Y:L:gmtime=100000S,1970,bad,} != "bad")
|
||||
.if ${%Y:L:gmtime=100000S,1970,bad,} != "bad"
|
||||
. error
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
make: Unknown modifier "has"
|
||||
make: in target "all": while evaluating variable "12345": Unknown modifier "has"
|
||||
|
||||
26bb0f5f
|
||||
12345
|
||||
make: Unknown modifier "hasX"
|
||||
make: in target "all": while evaluating variable "12345": Unknown modifier "hasX"
|
||||
|
||||
make: Unknown modifier "hashed"
|
||||
make: in target "all": while evaluating variable "12345": Unknown modifier "hashed"
|
||||
|
||||
exit status 0
|
||||
|
|
|
@ -16,7 +16,7 @@ CondParser_Eval: ${VAR} == value
|
|||
Comparing "value" == "value"
|
||||
Comparing "ok" != "ok"
|
||||
make: "varmod-ifelse.mk" line 158: no.
|
||||
make: "varmod-ifelse.mk" line 162: Comparison with '>=' requires both operands 'no' and '10' to be numeric
|
||||
make: "varmod-ifelse.mk" line 162: while evaluating variable "string == "literal" || no >= 10": Comparison with '>=' requires both operands 'no' and '10' to be numeric
|
||||
make: Bad conditional expression 'string == "literal" || no >= 10' before '?yes:no'
|
||||
make: "varmod-ifelse.mk" line 162: .
|
||||
make: Bad conditional expression 'string == "literal" && >= 10' before '?yes:no'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: varmod-ifelse.mk,v 1.26 2023/12/10 20:12:28 rillig Exp $
|
||||
# $NetBSD: varmod-ifelse.mk,v 1.28 2024/04/23 22:51:28 rillig Exp $
|
||||
#
|
||||
# Tests for the ${cond:?then:else} variable modifier, which evaluates either
|
||||
# the then-expression or the else-expression, depending on the condition.
|
||||
|
@ -156,7 +156,7 @@ STRING= string
|
|||
NUMBER= no # not really a number
|
||||
# expect+1: no.
|
||||
.info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
|
||||
# expect+3: Comparison with '>=' requires both operands 'no' and '10' to be numeric
|
||||
# expect+3: while evaluating variable "string == "literal" || no >= 10": Comparison with '>=' requires both operands 'no' and '10' to be numeric
|
||||
# expect: make: Bad conditional expression 'string == "literal" || no >= 10' before '?yes:no'
|
||||
# expect+1: .
|
||||
.info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.
|
||||
|
@ -294,7 +294,7 @@ INDIRECT_COND2= $${DELAYED} == "two"
|
|||
|
||||
|
||||
# In the modifier parts for the 'then' and 'else' branches, subexpressions are
|
||||
# parsed in by inspecting the actual modifiers. In 2008, 2015, 2020, 2022 and
|
||||
# parsed by inspecting the actual modifiers. In 2008, 2015, 2020, 2022 and
|
||||
# 2023, the exact parsing algorithm switched a few times, counting balanced
|
||||
# braces instead of proper subexpressions, which meant that unbalanced braces
|
||||
# were parsed differently, depending on whether the branch was active or not.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
make: "varmod-indirect.mk" line 19: Unknown modifier "${"
|
||||
make: "varmod-indirect.mk" line 52: Unknown modifier "${"
|
||||
make: "varmod-indirect.mk" line 19: while evaluating variable "value": Unknown modifier "${"
|
||||
make: "varmod-indirect.mk" line 52: while evaluating variable "value": Unknown modifier "${"
|
||||
make: "varmod-indirect.mk" line 54: warning: FIXME: this expression should have resulted in a parse error rather than returning the unparsed portion of the expression.
|
||||
make: "varmod-indirect.mk" line 143: before
|
||||
make: "varmod-indirect.mk" line 143: after
|
||||
|
@ -7,7 +7,7 @@ make: "varmod-indirect.mk" line 151: before
|
|||
make: "varmod-indirect.mk" line 151: after
|
||||
make: "varmod-indirect.mk" line 159: before
|
||||
make: "varmod-indirect.mk" line 159: after
|
||||
make: "varmod-indirect.mk" line 164: Unknown modifier "Z"
|
||||
make: "varmod-indirect.mk" line 164: while evaluating variable "UNDEF": Unknown modifier "Z"
|
||||
make: "varmod-indirect.mk" line 167: before
|
||||
make: "varmod-indirect.mk" line 167: after
|
||||
Parsing line 176: _:= before ${UNDEF} after
|
||||
|
@ -31,7 +31,7 @@ Parsing line 195: _:= before ${UNDEF:${:UZ}} after
|
|||
Var_Parse: ${UNDEF:${:UZ}} after (eval-keep-dollar-and-undefined)
|
||||
Indirect modifier "Z" from "${:UZ}"
|
||||
Evaluating modifier ${UNDEF:Z} on value "" (eval-keep-dollar-and-undefined, undefined)
|
||||
make: "varmod-indirect.mk" line 195: Unknown modifier "Z"
|
||||
make: "varmod-indirect.mk" line 195: while evaluating variable "UNDEF": Unknown modifier "Z"
|
||||
Result of ${UNDEF:Z} is error (eval-keep-dollar-and-undefined, undefined)
|
||||
Global: _ = before ${UNDEF:Z} after
|
||||
Parsing line 197: .MAKEFLAGS: -d0
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue