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
2024-05-03 22:43:12 +00:00
|
|
|
/* $NetBSD: cond.c,v 1.363 2024/04/23 22:51:28 rillig Exp $ */
|
2012-06-08 21:57:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Adam de Boor.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1988, 1989 by Adam de Boor
|
|
|
|
* Copyright (c) 1989 by Berkeley Softworks
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Adam de Boor.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
|
|
|
* Handling of conditionals in a makefile.
|
2012-06-08 21:57:36 +00:00
|
|
|
*
|
|
|
|
* Interface:
|
2020-11-20 03:54:37 +00:00
|
|
|
* Cond_EvalLine Evaluate the conditional directive, such as
|
|
|
|
* '.if <cond>', '.elifnmake <cond>', '.else', '.endif'.
|
2020-11-07 19:39:21 +00:00
|
|
|
*
|
|
|
|
* Cond_EvalCondition
|
|
|
|
* Evaluate the conditional, which is either the argument
|
|
|
|
* of one of the .if directives or the condition in a
|
|
|
|
* ':?then:else' variable modifier.
|
2012-06-08 21:57:36 +00:00
|
|
|
*
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* Cond_EndFile At the end of reading a makefile, ensure that the
|
2023-01-28 00:23:54 +00:00
|
|
|
* conditional directives are well-balanced.
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
#include <errno.h>
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
#include "make.h"
|
|
|
|
#include "dir.h"
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
|
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
2024-05-03 22:43:12 +00:00
|
|
|
MAKE_RCSID("$NetBSD: cond.c,v 1.363 2024/04/23 22:51:28 rillig Exp $");
|
2020-11-07 19:39:21 +00:00
|
|
|
|
2012-06-08 21:57:36 +00:00
|
|
|
/*
|
2022-02-05 20:03:50 +00:00
|
|
|
* Conditional expressions conform to this grammar:
|
2021-12-18 07:27:22 +00:00
|
|
|
* Or -> And ('||' And)*
|
|
|
|
* And -> Term ('&&' Term)*
|
2021-02-11 01:51:11 +00:00
|
|
|
* Term -> Function '(' Argument ')'
|
|
|
|
* Term -> Leaf Operator Leaf
|
|
|
|
* Term -> Leaf
|
|
|
|
* Term -> '(' Or ')'
|
|
|
|
* Term -> '!' Term
|
|
|
|
* Leaf -> "string"
|
|
|
|
* Leaf -> Number
|
|
|
|
* Leaf -> VariableExpression
|
2022-02-05 20:03:50 +00:00
|
|
|
* Leaf -> BareWord
|
2021-02-11 01:51:11 +00:00
|
|
|
* Operator -> '==' | '!=' | '>' | '<' | '>=' | '<='
|
2012-06-08 21:57:36 +00:00
|
|
|
*
|
2022-02-05 20:03:50 +00:00
|
|
|
* BareWord is an unquoted string literal, its evaluation depends on the kind
|
|
|
|
* of '.if' directive.
|
2012-06-08 21:57:36 +00:00
|
|
|
*
|
2022-02-05 20:03:50 +00:00
|
|
|
* The tokens are scanned by CondParser_Token, which returns:
|
2021-02-11 01:51:11 +00:00
|
|
|
* TOK_AND for '&&'
|
|
|
|
* TOK_OR for '||'
|
2020-11-07 19:39:21 +00:00
|
|
|
* TOK_NOT for '!'
|
|
|
|
* TOK_LPAREN for '('
|
|
|
|
* TOK_RPAREN for ')'
|
2021-02-11 01:51:11 +00:00
|
|
|
*
|
2020-11-07 19:39:21 +00:00
|
|
|
* Other terminal symbols are evaluated using either the default function or
|
2022-02-05 20:03:50 +00:00
|
|
|
* the function given in the terminal, they return either TOK_TRUE, TOK_FALSE
|
|
|
|
* or TOK_ERROR.
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
2020-11-07 19:39:21 +00:00
|
|
|
typedef enum Token {
|
2021-02-11 01:51:11 +00:00
|
|
|
TOK_FALSE, TOK_TRUE, TOK_AND, TOK_OR, TOK_NOT,
|
2021-01-14 01:24:34 +00:00
|
|
|
TOK_LPAREN, TOK_RPAREN, TOK_EOF, TOK_NONE, TOK_ERROR
|
2012-06-08 21:57:36 +00:00
|
|
|
} Token;
|
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
typedef enum ComparisonOp {
|
|
|
|
LT, LE, GT, GE, EQ, NE
|
|
|
|
} ComparisonOp;
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
typedef struct CondParser {
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The plain '.if ${VAR}' evaluates to true if the value of the
|
2023-06-27 20:29:43 +00:00
|
|
|
* expression has length > 0 and is not numerically zero. The other
|
|
|
|
* '.if' variants delegate to evalBare instead, for example '.ifdef
|
|
|
|
* ${VAR}' is equivalent to '.if defined(${VAR})', checking whether
|
|
|
|
* the variable named by the expression '${VAR}' is defined.
|
2021-02-11 01:51:11 +00:00
|
|
|
*/
|
2021-06-25 18:16:24 +00:00
|
|
|
bool plain;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
/* The function to apply on unquoted bare words. */
|
2021-12-18 07:27:22 +00:00
|
|
|
bool (*evalBare)(const char *);
|
2021-06-25 18:16:24 +00:00
|
|
|
bool negateEvalBare;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
/*
|
|
|
|
* Whether the left-hand side of a comparison may be an unquoted
|
|
|
|
* string. This is allowed for expressions of the form
|
|
|
|
* ${condition:?:}, see ApplyModifier_IfElse. Such a condition is
|
|
|
|
* expanded before it is evaluated, due to ease of implementation.
|
|
|
|
* This means that at the point where the condition is evaluated,
|
|
|
|
* make cannot know anymore whether the left-hand side had originally
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* been an expression or a plain word.
|
2021-12-18 07:27:22 +00:00
|
|
|
*
|
2022-04-03 19:52:08 +00:00
|
|
|
* In conditional directives like '.if', the left-hand side must
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* either be an expression, a quoted string or a number.
|
2021-12-18 07:27:22 +00:00
|
|
|
*/
|
|
|
|
bool leftUnquotedOK;
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
const char *p; /* The remaining condition to parse */
|
|
|
|
Token curr; /* Single push-back token used in parsing */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Whether an error message has already been printed for this
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* condition.
|
2021-01-14 01:24:34 +00:00
|
|
|
*/
|
2021-06-25 18:16:24 +00:00
|
|
|
bool printedError;
|
2020-11-07 19:39:21 +00:00
|
|
|
} CondParser;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2023-06-27 20:29:43 +00:00
|
|
|
static CondResult CondParser_Or(CondParser *, bool);
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2023-01-28 00:23:54 +00:00
|
|
|
unsigned int cond_depth = 0; /* current .if nesting level */
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
/* Names for ComparisonOp. */
|
|
|
|
static const char opname[][3] = { "<", "<=", ">", ">=", "==", "!=" };
|
2015-05-10 20:01:54 +00:00
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
MAKE_INLINE bool
|
|
|
|
skip_string(const char **pp, const char *str)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2022-02-05 20:03:50 +00:00
|
|
|
size_t len = strlen(str);
|
|
|
|
bool ok = strncmp(*pp, str, len) == 0;
|
|
|
|
if (ok)
|
|
|
|
*pp += len;
|
|
|
|
return ok;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2020-11-20 03:54:37 +00:00
|
|
|
static Token
|
2021-06-25 18:16:24 +00:00
|
|
|
ToToken(bool cond)
|
2020-11-20 03:54:37 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
return cond ? TOK_TRUE : TOK_FALSE;
|
2020-11-20 03:54:37 +00:00
|
|
|
}
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
static void
|
|
|
|
CondParser_SkipWhitespace(CondParser *par)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
cpp_skip_whitespace(&par->p);
|
2020-11-07 19:39:21 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
2021-12-18 07:27:22 +00:00
|
|
|
* Parse a single word, taking into account balanced parentheses as well as
|
|
|
|
* embedded expressions. Used for the argument of a built-in function as
|
|
|
|
* well as for bare words, which are then passed to the default function.
|
2021-01-14 01:24:34 +00:00
|
|
|
*/
|
2022-02-05 20:03:50 +00:00
|
|
|
static char *
|
|
|
|
ParseWord(const char **pp, bool doEval)
|
2021-01-14 01:24:34 +00:00
|
|
|
{
|
|
|
|
const char *p = *pp;
|
2022-04-03 19:52:08 +00:00
|
|
|
Buffer word;
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
int depth;
|
2021-01-14 01:24:34 +00:00
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
Buf_Init(&word);
|
2021-01-14 01:24:34 +00:00
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
depth = 0;
|
2021-01-14 01:24:34 +00:00
|
|
|
for (;;) {
|
|
|
|
char ch = *p;
|
|
|
|
if (ch == '\0' || ch == ' ' || ch == '\t')
|
|
|
|
break;
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
if ((ch == '&' || ch == '|') && depth == 0)
|
2021-01-14 01:24:34 +00:00
|
|
|
break;
|
2022-02-05 20:03:50 +00:00
|
|
|
if (ch == '$') {
|
2021-06-25 18:16:24 +00:00
|
|
|
VarEvalMode emode = doEval
|
|
|
|
? VARE_UNDEFERR
|
|
|
|
: VARE_PARSE_ONLY;
|
Import bmake-20230909
Update import.sh to generate below
ChangeLog since bmake-20230622
2023-09-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230909
Merge with NetBSD make, pick up
o main.c: allow -j to compute a multiple of ncpu
If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating
point number or ends in 'C' compute .MAKE.JOBS as a multiple of
_SC_NPROCESSORS_ONLN
.MAKE.JOBS.C will be "yes" if -jC is supported
2023-08-20 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230820
Merge with NetBSD make, pick up
o make.1: note that :localtime is better for %s
o parse.c: improve error messages for invalid input.
o var.c: fix for %s:L:gmtime - set TZ=UTC and use localtime to get
correct result, it is still better to use %s:L:localtime.
2023-08-18 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230818
Merge with NetBSD make, pick up
o meta.c: meta_ignore - check raw path against metaIgnorePaths
to potentially skip call to realpath.
o var.c: be strict when parsing the argument of the ':mtime' modifier
o unit-tests/varmod-mtime.mk: document why '${%s:L:localtime}'
should be used to get an equivalent value to time(3).
2023-08-16 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230816
Merge with NetBSD make, pick up
o cond.c: clean up multiple-inclusion guards
2023-07-25 Simon J Gerraty <sjg@beast.crufty.net>
* unit-tests/Makefile: addd varmod-localtime to BROKEN_TESTS
if configure cannot work out how to control TZ.
Remove varmod-localtime from BROKEN_TESTS for IRIX*
2023-07-24 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230723
* configure.in: fix the test for wether TZ=Europe/Berlin works.
Depending on the time of year, if run between 22:00 and 00:00 UTC
the check in configure would fail incorrectly.
Take the day into account as well.
2023-07-18 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230711
Merge with NetBSD make, pick up
o make.1: clean up wording, clarify scope of '!' in conditions
2023-07-15 Simon J Gerraty <sjg@beast.crufty.net>
* make-bootstrap.sh.in: set prefix
If configure is run using ksh we get unexpanded ${prefix} in
DEFAULT_SYS_PATH, by ensuring prefix is set we should still get
correct result.
2023-07-13 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230711
bump version for IRIX tweaks
* make.h: undef OP_NONE if defined
* unit-tests/Makefile: set BROKEN_TESTS for IRIX
* configure.in: override INSTALL on IRIX
2023-06-27 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap op_test: ensure we set TEST_MAKE as we want it.
mk/ChangeLog since bmake-20230622
2023-09-09 Simon J Gerraty <sjg@beast.crufty.net>
* jobs.mk (JOB_MAX): use -jC if we can
we actually use JOB_MAX_C which defaults to 1.33C
2023-08-18 Simon J Gerraty <sjg@beast.crufty.net>
* now_utc: %s only works with :localtime
2023-07-14 Simon J Gerraty <sjg@beast.crufty.net>
* install-sh: ignore -c as claimed and only insist on
a directory for destination when more than one file to copy.
* sys.mk: when looking for SYS_OS_MK try ${.MAKE.OS} and
${.MAKE.OS:S,64,,} early (so we find sys/IRIX.mk for IRIX64)
2023-07-13 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20230711
* sys.mk: set SYS_MK and INSTALL_SH for systems with incompatible
install(1)
* sys/IRIX.mk: when setting ROOT_GROUP only match the first :0:
set INSTALL to install-sh rather than pathname that may not exist
(yet).
2023-07-07 Simon J Gerraty <sjg@beast.crufty.net>
* dirdeps.mk: pass DIRDEP_TARGETS to DIRDEP_MAKE
normally this is empty - for the default target, but there are
use-cases where we might set it to something else.
2023-07-04 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20230704
* dirdeps.mk: apply DEBUG_DIRDEPS_LIST_FILTER to lists we output
when DEBUG_DIRDEPS is in effect.
Eg. DEBUG_DIRDEPS_LIST_FILTER=ts\n
can greatly improve readability.
2023-09-17 17:03:11 +00:00
|
|
|
/*
|
|
|
|
* TODO: make Var_Parse complain about undefined
|
|
|
|
* variables.
|
|
|
|
*/
|
2023-04-24 23:44:30 +00:00
|
|
|
FStr nestedVal = Var_Parse(&p, SCOPE_CMDLINE, emode);
|
2021-01-14 01:24:34 +00:00
|
|
|
/* TODO: handle errors */
|
2022-04-03 19:52:08 +00:00
|
|
|
Buf_AddStr(&word, nestedVal.str);
|
2021-01-14 01:24:34 +00:00
|
|
|
FStr_Done(&nestedVal);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (ch == '(')
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
depth++;
|
|
|
|
else if (ch == ')' && --depth < 0)
|
2021-01-14 01:24:34 +00:00
|
|
|
break;
|
2022-04-03 19:52:08 +00:00
|
|
|
Buf_AddByte(&word, ch);
|
2021-01-14 01:24:34 +00:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
cpp_skip_hspace(&p);
|
|
|
|
*pp = p;
|
2021-01-14 01:24:34 +00:00
|
|
|
|
2022-04-03 19:52:08 +00:00
|
|
|
return Buf_DoneData(&word);
|
2022-02-05 20:03:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Parse the function argument, including the surrounding parentheses. */
|
|
|
|
static char *
|
|
|
|
ParseFuncArg(CondParser *par, const char **pp, bool doEval, const char *func)
|
|
|
|
{
|
|
|
|
const char *p = *pp;
|
|
|
|
char *res;
|
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
p++; /* skip the '(' */
|
2021-01-14 01:24:34 +00:00
|
|
|
cpp_skip_hspace(&p);
|
2022-02-05 20:03:50 +00:00
|
|
|
res = ParseWord(&p, doEval);
|
|
|
|
cpp_skip_hspace(&p);
|
|
|
|
|
|
|
|
if (*p++ != ')') {
|
|
|
|
int len = 0;
|
|
|
|
while (ch_isalpha(func[len]))
|
|
|
|
len++;
|
2021-01-14 01:24:34 +00:00
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
Parse_Error(PARSE_FATAL,
|
2022-02-05 20:03:50 +00:00
|
|
|
"Missing closing parenthesis for %.*s()", len, func);
|
2021-06-25 18:16:24 +00:00
|
|
|
par->printedError = true;
|
2022-02-05 20:03:50 +00:00
|
|
|
free(res);
|
|
|
|
return NULL;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*pp = p;
|
2022-02-05 20:03:50 +00:00
|
|
|
return res;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
2022-04-03 19:52:08 +00:00
|
|
|
/* See if the given variable is defined. */
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2022-02-05 20:03:50 +00:00
|
|
|
FuncDefined(const char *var)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2022-02-05 20:03:50 +00:00
|
|
|
return Var_Exists(SCOPE_CMDLINE, var);
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
2022-04-03 19:52:08 +00:00
|
|
|
/* See if a target matching targetPattern is requested to be made. */
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2022-04-03 19:52:08 +00:00
|
|
|
FuncMake(const char *targetPattern)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
StringListNode *ln;
|
2023-06-27 20:29:43 +00:00
|
|
|
bool warned = false;
|
|
|
|
|
|
|
|
for (ln = opts.create.first; ln != NULL; ln = ln->next) {
|
|
|
|
StrMatchResult res = Str_Match(ln->datum, targetPattern);
|
|
|
|
if (res.error != NULL && !warned) {
|
|
|
|
warned = true;
|
|
|
|
Parse_Error(PARSE_WARNING,
|
|
|
|
"%s in pattern argument '%s' to function 'make'",
|
|
|
|
res.error, targetPattern);
|
|
|
|
}
|
|
|
|
if (res.matched)
|
2021-06-25 18:16:24 +00:00
|
|
|
return true;
|
2023-06-27 20:29:43 +00:00
|
|
|
}
|
2021-06-25 18:16:24 +00:00
|
|
|
return false;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
/* See if the given file exists. */
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2022-02-05 20:03:50 +00:00
|
|
|
FuncExists(const char *file)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-06-25 18:16:24 +00:00
|
|
|
bool result;
|
2021-01-14 01:24:34 +00:00
|
|
|
char *path;
|
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
path = Dir_FindFile(file, &dirSearchPath);
|
2021-01-14 01:24:34 +00:00
|
|
|
DEBUG2(COND, "exists(%s) result is \"%s\"\n",
|
2022-02-05 20:03:50 +00:00
|
|
|
file, path != NULL ? path : "");
|
2021-01-14 01:24:34 +00:00
|
|
|
result = path != NULL;
|
|
|
|
free(path);
|
|
|
|
return result;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
/* See if the given node exists and is an actual target. */
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2022-02-05 20:03:50 +00:00
|
|
|
FuncTarget(const char *node)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2022-02-05 20:03:50 +00:00
|
|
|
GNode *gn = Targ_FindNode(node);
|
2021-01-14 01:24:34 +00:00
|
|
|
return gn != NULL && GNode_IsTarget(gn);
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
|
|
|
* See if the given node exists and is an actual target with commands
|
|
|
|
* associated with it.
|
|
|
|
*/
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2022-02-05 20:03:50 +00:00
|
|
|
FuncCommands(const char *node)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2022-02-05 20:03:50 +00:00
|
|
|
GNode *gn = Targ_FindNode(node);
|
|
|
|
return gn != NULL && GNode_IsTarget(gn) &&
|
|
|
|
!Lst_IsEmpty(&gn->commands);
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
2020-11-20 03:54:37 +00:00
|
|
|
/*
|
2023-06-27 20:29:43 +00:00
|
|
|
* Convert the string to a floating point number. Accepted formats are
|
2022-02-05 20:03:50 +00:00
|
|
|
* base-10 integer, base-16 integer and finite floating point numbers.
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2020-11-20 03:54:37 +00:00
|
|
|
TryParseNumber(const char *str, double *out_value)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
char *end;
|
|
|
|
unsigned long ul_val;
|
|
|
|
double dbl_val;
|
|
|
|
|
|
|
|
if (str[0] == '\0') { /* XXX: why is an empty string a number? */
|
|
|
|
*out_value = 0.0;
|
2021-06-25 18:16:24 +00:00
|
|
|
return true;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
errno = 0;
|
2021-01-14 01:24:34 +00:00
|
|
|
ul_val = strtoul(str, &end, str[1] == 'x' ? 16 : 10);
|
|
|
|
if (*end == '\0' && errno != ERANGE) {
|
|
|
|
*out_value = str[0] == '-' ? -(double)-ul_val : (double)ul_val;
|
2021-06-25 18:16:24 +00:00
|
|
|
return true;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
if (*end != '\0' && *end != '.' && *end != 'e' && *end != 'E')
|
2021-06-25 18:16:24 +00:00
|
|
|
return false; /* skip the expensive strtod call */
|
2021-01-14 01:24:34 +00:00
|
|
|
dbl_val = strtod(str, &end);
|
|
|
|
if (*end != '\0')
|
2021-06-25 18:16:24 +00:00
|
|
|
return false;
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
*out_value = dbl_val;
|
2021-06-25 18:16:24 +00:00
|
|
|
return true;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2020-11-07 19:39:21 +00:00
|
|
|
is_separator(char ch)
|
|
|
|
{
|
2021-06-25 18:16:24 +00:00
|
|
|
return ch == '\0' || ch_isspace(ch) || ch == '!' || ch == '=' ||
|
|
|
|
ch == '>' || ch == '<' || ch == ')' /* but not '(' */;
|
2020-11-07 19:39:21 +00:00
|
|
|
}
|
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
/*
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* In a quoted or unquoted string literal or a number, parse an
|
2023-04-24 23:44:30 +00:00
|
|
|
* expression and add its value to the buffer.
|
|
|
|
*
|
|
|
|
* Return whether to continue parsing the leaf.
|
2021-02-11 01:51:11 +00:00
|
|
|
*
|
|
|
|
* Example: .if x${CENTER}y == "${PREFIX}${SUFFIX}" || 0x${HEX}
|
|
|
|
*/
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2021-02-11 01:51:11 +00:00
|
|
|
CondParser_StringExpr(CondParser *par, const char *start,
|
2021-12-18 07:27:22 +00:00
|
|
|
bool doEval, bool quoted,
|
|
|
|
Buffer *buf, FStr *inout_str)
|
2021-02-11 01:51:11 +00:00
|
|
|
{
|
2021-06-25 18:16:24 +00:00
|
|
|
VarEvalMode emode;
|
2022-02-05 20:03:50 +00:00
|
|
|
const char *p;
|
Import bmake-20240309
Intersting/relevant changes since bmake-20240108
ChangeLog since bmake-20240108
2024-03-10 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap: tests can take a long time; use a cookie to
skip them if bmake has not been updated since tests last
ran successfully.
* Makefile: Cygwin handles MANTARGET man
* unit-tests/Makefile: set BROKEN_TESTS for Cygwin
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240309
Merge with NetBSD make, pick up
o set .ERROR_EXIT to the exit status of .ERROR_TARGET
this allows a .ERROR target to ignore the case of
.ERROR_EXIT==6 which just means that the build actually
failed somewhere else.
2024-03-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240303
* var.c: on IRIX we need both inttypes.h and stdint.h
2024-03-01 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240301
Merge with NetBSD make, pick up
o export variables with value from target scope
when appropriate.
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240212
Merge with NetBSD make, pick up
o remove unneeded conditional-compilation toggles
INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB,
GMAKEEXPORT NO_REGEX and SUNSHCMD
* configure.in: add check for regex.h
* var.c: replace use of NO_REGEX with HAVE_REGEX_H
2024-02-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240204
Merge with NetBSD make, pick up
o var.c: fix some lint (-dL) mode parsing issues
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION: (_MAKE_VERSION): 20240202
Merge with NetBSD make, pick up
o make.1: note that arg to :D and :U can be empty
o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no
mk/ChangeLog since bmake-20240108
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240309
* meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not
want to save the .ERROR_META_FILE
2024-02-20 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240220
* sys.dirdeps.mk, dirdeps-targets.mk, init.mk:
do not set .MAIN: dirdeps in sys.dirdeps.mk
dirdeps-targets.mk will do that for top-level builds
and init.mk will do it for others.
This allows a Makefile which has no need of 'dirdeps' to
set .MAIN for itself and "just work".
2024-02-18 Simon J Gerraty <sjg@beast.crufty.net>
* bsd.*.mk: for makefiles that get a bsd. symlink,
use _this in multiple inclusion tags since .PARSEFILE will not
DTRT when such a makefile is included directly by Makefile and
automatically (without bsd. prefix).
Since we cannot guarantee that our sys.mk will be used, we provide
a default _this in each makefile that gets a bsd. prefix such that
the value is the same regardless of bsd. prefix.
* subdir.mk: drop the !target guard on $SUBDIR_TARGETS
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240212
* SPDX-License-Identifier: BSD-2-Clause
Add SPDX-License-Identifier to inidicate that I consider
my copyright on any of these makefiles equivalent to BSD-2-Clause
* autoconf.mk: allow for configure.ac as currently recommended
* subdir.mk: support @auto
which is replaced with each subdir that
has a [Mm]akefile.
* subdir.mk: include local.subdir.mk if it exists.
* subdir.mk: rework to handle .WAIT
2024-02-11 Simon J Gerraty <sjg@beast.crufty.net>
* subdir.mk: _SUBDIRUSE report the target we are entering subdirs for.
2024-02-10 Simon J Gerraty <sjg@beast.crufty.net>
* prog.mk: treat empty SRCS the same as undefined
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* Avoid undefined errors in lint (-dL) mode
* man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7)
2024-01-28 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240128
* FILES: add ccm.dep.mk for C++ modules
add suffixes.mk for common location for generic SUFFIX rules.
* auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk
replace OBJ_EXTENSIONS with OBJ_SUFFIXES
* autodep.mk: leverage CXX_SUFFIXES for __depsrcs
and update style (spaces around = etc)
* init.mk: add OBJS_SRCS_FILTER to filter SRCS when
setting OBJS
* meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
|
|
|
bool atStart; /* true means an expression outside quotes */
|
2021-02-11 01:51:11 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
emode = doEval && quoted ? VARE_WANTRES
|
|
|
|
: doEval ? VARE_UNDEFERR
|
2021-06-25 18:16:24 +00:00
|
|
|
: VARE_PARSE_ONLY;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
p = par->p;
|
|
|
|
atStart = p == start;
|
2023-04-24 23:44:30 +00:00
|
|
|
*inout_str = Var_Parse(&p, SCOPE_CMDLINE, emode);
|
2021-02-11 01:51:11 +00:00
|
|
|
/* TODO: handle errors */
|
|
|
|
if (inout_str->str == var_Error) {
|
|
|
|
FStr_Done(inout_str);
|
|
|
|
*inout_str = FStr_InitRefer(NULL);
|
2021-06-25 18:16:24 +00:00
|
|
|
return false;
|
2021-02-11 01:51:11 +00:00
|
|
|
}
|
2022-02-05 20:03:50 +00:00
|
|
|
par->p = p;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
if (atStart && is_separator(par->p[0]))
|
2021-06-25 18:16:24 +00:00
|
|
|
return false;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
Buf_AddStr(buf, inout_str->str);
|
|
|
|
FStr_Done(inout_str);
|
2022-02-05 20:03:50 +00:00
|
|
|
*inout_str = FStr_InitRefer(NULL); /* not finished yet */
|
2021-06-25 18:16:24 +00:00
|
|
|
return true;
|
2021-02-11 01:51:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* Parse a string from an expression or an optionally quoted string,
|
2022-02-05 20:03:50 +00:00
|
|
|
* on the left-hand and right-hand sides of comparisons.
|
2012-06-08 21:57:36 +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
2024-05-03 22:43:12 +00:00
|
|
|
* Return the string without any enclosing quotes, or NULL on error.
|
|
|
|
* Sets out_quoted if the leaf was a quoted string literal.
|
2012-06-08 21:57:36 +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
2024-05-03 22:43:12 +00:00
|
|
|
static FStr
|
2021-12-18 07:27:22 +00:00
|
|
|
CondParser_Leaf(CondParser *par, bool doEval, bool unquotedOK,
|
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
2024-05-03 22:43:12 +00:00
|
|
|
bool *out_quoted)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
Buffer buf;
|
|
|
|
FStr str;
|
2021-06-25 18:16:24 +00:00
|
|
|
bool quoted;
|
2021-01-14 01:24:34 +00:00
|
|
|
const char *start;
|
|
|
|
|
|
|
|
Buf_Init(&buf);
|
|
|
|
str = FStr_InitRefer(NULL);
|
|
|
|
*out_quoted = quoted = par->p[0] == '"';
|
|
|
|
start = par->p;
|
|
|
|
if (quoted)
|
2020-11-07 19:39:21 +00:00
|
|
|
par->p++;
|
2021-01-14 01:24:34 +00:00
|
|
|
|
|
|
|
while (par->p[0] != '\0' && str.str == NULL) {
|
|
|
|
switch (par->p[0]) {
|
|
|
|
case '\\':
|
|
|
|
par->p++;
|
|
|
|
if (par->p[0] != '\0') {
|
|
|
|
Buf_AddByte(&buf, par->p[0]);
|
|
|
|
par->p++;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
case '"':
|
|
|
|
par->p++;
|
2021-02-11 01:51:11 +00:00
|
|
|
if (quoted)
|
2022-02-05 20:03:50 +00:00
|
|
|
goto return_buf; /* skip the closing quote */
|
2021-02-11 01:51:11 +00:00
|
|
|
Buf_AddByte(&buf, '"');
|
2021-01-14 01:24:34 +00:00
|
|
|
continue;
|
|
|
|
case ')': /* see is_separator */
|
|
|
|
case '!':
|
|
|
|
case '=':
|
|
|
|
case '>':
|
|
|
|
case '<':
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
|
|
|
if (!quoted)
|
2022-02-05 20:03:50 +00:00
|
|
|
goto return_buf;
|
2021-01-14 01:24:34 +00:00
|
|
|
Buf_AddByte(&buf, par->p[0]);
|
|
|
|
par->p++;
|
|
|
|
continue;
|
|
|
|
case '$':
|
2021-02-11 01:51:11 +00:00
|
|
|
if (!CondParser_StringExpr(par,
|
|
|
|
start, doEval, quoted, &buf, &str))
|
2022-02-05 20:03:50 +00:00
|
|
|
goto return_str;
|
2021-01-14 01:24:34 +00:00
|
|
|
continue;
|
|
|
|
default:
|
2021-12-18 07:27:22 +00:00
|
|
|
if (!unquotedOK && !quoted && *start != '$' &&
|
2021-01-14 01:24:34 +00:00
|
|
|
!ch_isdigit(*start)) {
|
|
|
|
str = FStr_InitRefer(NULL);
|
2022-02-05 20:03:50 +00:00
|
|
|
goto return_str;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
|
|
|
Buf_AddByte(&buf, par->p[0]);
|
|
|
|
par->p++;
|
|
|
|
continue;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-05 20:03:50 +00:00
|
|
|
return_buf:
|
2021-02-11 01:51:11 +00:00
|
|
|
str = FStr_InitOwn(buf.data);
|
2021-12-18 07:27:22 +00:00
|
|
|
buf.data = NULL;
|
2022-02-05 20:03:50 +00:00
|
|
|
return_str:
|
2021-12-18 07:27:22 +00:00
|
|
|
Buf_Done(&buf);
|
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
2024-05-03 22:43:12 +00:00
|
|
|
return str;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
|
|
|
* Evaluate a "comparison without operator", such as in ".if ${VAR}" or
|
|
|
|
* ".if 0".
|
|
|
|
*/
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2023-06-27 20:29:43 +00:00
|
|
|
EvalTruthy(CondParser *par, const char *value, bool quoted)
|
2020-11-07 19:39:21 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
double num;
|
2020-11-07 19:39:21 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
if (quoted)
|
|
|
|
return value[0] != '\0';
|
|
|
|
if (TryParseNumber(value, &num))
|
|
|
|
return num != 0.0;
|
2021-02-11 01:51:11 +00:00
|
|
|
if (par->plain)
|
2021-01-14 01:24:34 +00:00
|
|
|
return value[0] != '\0';
|
2022-02-05 20:03:50 +00:00
|
|
|
return par->evalBare(value) != par->negateEvalBare;
|
2020-11-07 19:39:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Evaluate a numerical comparison, such as in ".if ${VAR} >= 9". */
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2021-02-11 01:51:11 +00:00
|
|
|
EvalCompareNum(double lhs, ComparisonOp op, double rhs)
|
2020-11-07 19:39:21 +00:00
|
|
|
{
|
2022-04-03 19:52:08 +00:00
|
|
|
DEBUG3(COND, "Comparing %f %s %f\n", lhs, opname[op], rhs);
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
case LT:
|
|
|
|
return lhs < rhs;
|
|
|
|
case LE:
|
|
|
|
return lhs <= rhs;
|
|
|
|
case GT:
|
|
|
|
return lhs > rhs;
|
|
|
|
case GE:
|
|
|
|
return lhs >= rhs;
|
2023-01-28 00:23:54 +00:00
|
|
|
case EQ:
|
2021-02-11 01:51:11 +00:00
|
|
|
return lhs == rhs;
|
2023-01-28 00:23:54 +00:00
|
|
|
default:
|
|
|
|
return lhs != rhs;
|
2020-11-07 19:39:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Token
|
2021-02-11 01:51:11 +00:00
|
|
|
EvalCompareStr(CondParser *par, const char *lhs,
|
|
|
|
ComparisonOp op, const char *rhs)
|
2020-11-07 19:39:21 +00:00
|
|
|
{
|
2021-02-11 01:51:11 +00:00
|
|
|
if (op != EQ && op != NE) {
|
|
|
|
Parse_Error(PARSE_FATAL,
|
2023-01-28 00:23:54 +00:00
|
|
|
"Comparison with '%s' requires both operands "
|
|
|
|
"'%s' and '%s' to be numeric",
|
|
|
|
opname[op], lhs, rhs);
|
2021-06-25 18:16:24 +00:00
|
|
|
par->printedError = true;
|
2021-01-14 01:24:34 +00:00
|
|
|
return TOK_ERROR;
|
|
|
|
}
|
2020-11-07 19:39:21 +00:00
|
|
|
|
2022-04-03 19:52:08 +00:00
|
|
|
DEBUG3(COND, "Comparing \"%s\" %s \"%s\"\n", lhs, opname[op], rhs);
|
2021-02-11 01:51:11 +00:00
|
|
|
return ToToken((op == EQ) == (strcmp(lhs, rhs) == 0));
|
2020-11-07 19:39:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Evaluate a comparison, such as "${VAR} == 12345". */
|
|
|
|
static Token
|
2021-06-25 18:16:24 +00:00
|
|
|
EvalCompare(CondParser *par, const char *lhs, bool lhsQuoted,
|
|
|
|
ComparisonOp op, const char *rhs, bool rhsQuoted)
|
2020-11-07 19:39:21 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
double left, right;
|
2020-11-07 19:39:21 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
if (!rhsQuoted && !lhsQuoted)
|
|
|
|
if (TryParseNumber(lhs, &left) && TryParseNumber(rhs, &right))
|
2021-02-11 01:51:11 +00:00
|
|
|
return ToToken(EvalCompareNum(left, op, right));
|
|
|
|
|
|
|
|
return EvalCompareStr(par, lhs, op, rhs);
|
|
|
|
}
|
2020-11-07 19:39:21 +00:00
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2021-02-11 01:51:11 +00:00
|
|
|
CondParser_ComparisonOp(CondParser *par, ComparisonOp *out_op)
|
|
|
|
{
|
|
|
|
const char *p = par->p;
|
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
if (p[0] == '<' && p[1] == '=')
|
|
|
|
return par->p += 2, *out_op = LE, true;
|
|
|
|
if (p[0] == '<')
|
|
|
|
return par->p += 1, *out_op = LT, true;
|
|
|
|
if (p[0] == '>' && p[1] == '=')
|
|
|
|
return par->p += 2, *out_op = GE, true;
|
|
|
|
if (p[0] == '>')
|
|
|
|
return par->p += 1, *out_op = GT, true;
|
|
|
|
if (p[0] == '=' && p[1] == '=')
|
|
|
|
return par->p += 2, *out_op = EQ, true;
|
|
|
|
if (p[0] == '!' && p[1] == '=')
|
|
|
|
return par->p += 2, *out_op = NE, true;
|
2021-06-25 18:16:24 +00:00
|
|
|
return false;
|
2020-11-07 19:39:21 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
|
|
|
* Parse a comparison condition such as:
|
2012-06-08 21:57:36 +00:00
|
|
|
*
|
2020-11-07 19:39:21 +00:00
|
|
|
* 0
|
|
|
|
* ${VAR:Mpattern}
|
|
|
|
* ${VAR} == value
|
|
|
|
* ${VAR:U0} < 12345
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
|
|
|
static Token
|
2021-06-25 18:16:24 +00:00
|
|
|
CondParser_Comparison(CondParser *par, bool doEval)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
Token t = TOK_ERROR;
|
|
|
|
FStr lhs, rhs;
|
2021-02-11 01:51:11 +00:00
|
|
|
ComparisonOp op;
|
2021-06-25 18:16:24 +00:00
|
|
|
bool lhsQuoted, rhsQuoted;
|
2021-01-14 01:24:34 +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
2024-05-03 22:43:12 +00:00
|
|
|
lhs = CondParser_Leaf(par, doEval, par->leftUnquotedOK, &lhsQuoted);
|
2021-01-14 01:24:34 +00:00
|
|
|
if (lhs.str == NULL)
|
|
|
|
goto done_lhs;
|
|
|
|
|
|
|
|
CondParser_SkipWhitespace(par);
|
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
if (!CondParser_ComparisonOp(par, &op)) {
|
2023-06-27 20:29:43 +00:00
|
|
|
t = ToToken(doEval && EvalTruthy(par, lhs.str, lhsQuoted));
|
2021-01-14 01:24:34 +00:00
|
|
|
goto done_lhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
CondParser_SkipWhitespace(par);
|
|
|
|
|
|
|
|
if (par->p[0] == '\0') {
|
2021-02-11 01:51:11 +00:00
|
|
|
Parse_Error(PARSE_FATAL,
|
2021-12-18 07:27:22 +00:00
|
|
|
"Missing right-hand side of operator '%s'", opname[op]);
|
2021-06-25 18:16:24 +00:00
|
|
|
par->printedError = true;
|
2021-01-14 01:24:34 +00:00
|
|
|
goto done_lhs;
|
|
|
|
}
|
|
|
|
|
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
2024-05-03 22:43:12 +00:00
|
|
|
rhs = CondParser_Leaf(par, doEval, true, &rhsQuoted);
|
2022-04-03 19:52:08 +00:00
|
|
|
t = rhs.str == NULL ? TOK_ERROR
|
|
|
|
: !doEval ? TOK_FALSE
|
|
|
|
: EvalCompare(par, lhs.str, lhsQuoted, op, rhs.str, rhsQuoted);
|
2021-01-14 01:24:34 +00:00
|
|
|
FStr_Done(&rhs);
|
2022-04-03 19:52:08 +00:00
|
|
|
|
2020-11-20 03:54:37 +00:00
|
|
|
done_lhs:
|
2021-01-14 01:24:34 +00:00
|
|
|
FStr_Done(&lhs);
|
|
|
|
return t;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
|
|
|
* The argument to empty() is a variable name, optionally followed by
|
|
|
|
* variable modifiers.
|
|
|
|
*/
|
2021-12-18 07:27:22 +00:00
|
|
|
static bool
|
|
|
|
CondParser_FuncCallEmpty(CondParser *par, bool doEval, Token *out_token)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
const char *p = par->p;
|
2021-12-18 07:27:22 +00:00
|
|
|
Token tok;
|
2021-01-14 01:24:34 +00:00
|
|
|
FStr val;
|
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
if (!skip_string(&p, "empty"))
|
2021-12-18 07:27:22 +00:00
|
|
|
return false;
|
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
cpp_skip_whitespace(&p);
|
|
|
|
if (*p != '(')
|
2021-12-18 07:27:22 +00:00
|
|
|
return false;
|
2021-01-14 01:24:34 +00:00
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
p--; /* Make p[1] point to the '('. */
|
|
|
|
val = Var_Parse(&p, SCOPE_CMDLINE,
|
2023-04-24 23:44:30 +00:00
|
|
|
doEval ? VARE_WANTRES : VARE_PARSE_ONLY);
|
2021-01-14 01:24:34 +00:00
|
|
|
/* TODO: handle errors */
|
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
if (val.str == var_Error)
|
|
|
|
tok = TOK_ERROR;
|
|
|
|
else {
|
|
|
|
cpp_skip_whitespace(&val.str);
|
2022-02-05 20:03:50 +00:00
|
|
|
tok = ToToken(doEval && val.str[0] == '\0');
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FStr_Done(&val);
|
2021-12-18 07:27:22 +00:00
|
|
|
*out_token = tok;
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
par->p = p;
|
2021-12-18 07:27:22 +00:00
|
|
|
return true;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2022-04-22 20:34:55 +00:00
|
|
|
/* Parse a function call expression, such as 'exists(${file})'. */
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
|
|
|
CondParser_FuncCall(CondParser *par, bool doEval, Token *out_token)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2022-02-05 20:03:50 +00:00
|
|
|
char *arg;
|
|
|
|
const char *p = par->p;
|
|
|
|
bool (*fn)(const char *);
|
|
|
|
const char *fn_name = p;
|
|
|
|
|
|
|
|
if (skip_string(&p, "defined"))
|
|
|
|
fn = FuncDefined;
|
|
|
|
else if (skip_string(&p, "make"))
|
|
|
|
fn = FuncMake;
|
|
|
|
else if (skip_string(&p, "exists"))
|
|
|
|
fn = FuncExists;
|
|
|
|
else if (skip_string(&p, "target"))
|
|
|
|
fn = FuncTarget;
|
|
|
|
else if (skip_string(&p, "commands"))
|
|
|
|
fn = FuncCommands;
|
|
|
|
else
|
2021-12-18 07:27:22 +00:00
|
|
|
return false;
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
cpp_skip_whitespace(&p);
|
|
|
|
if (*p != '(')
|
|
|
|
return false;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
arg = ParseFuncArg(par, &p, doEval, fn_name);
|
|
|
|
*out_token = ToToken(doEval &&
|
|
|
|
arg != NULL && arg[0] != '\0' && fn(arg));
|
2021-12-18 07:27:22 +00:00
|
|
|
free(arg);
|
2022-02-05 20:03:50 +00:00
|
|
|
|
|
|
|
par->p = p;
|
2021-12-18 07:27:22 +00:00
|
|
|
return true;
|
2020-11-20 03:54:37 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
2021-12-18 07:27:22 +00:00
|
|
|
* Parse a comparison that neither starts with '"' nor '$', such as the
|
|
|
|
* unusual 'bare == right' or '3 == ${VAR}', or a simple leaf without
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* operator, which is a number, an expression or a string literal.
|
2021-12-18 07:27:22 +00:00
|
|
|
*
|
|
|
|
* TODO: Can this be merged into CondParser_Comparison?
|
2021-01-14 01:24:34 +00:00
|
|
|
*/
|
2020-11-20 03:54:37 +00:00
|
|
|
static Token
|
2021-06-25 18:16:24 +00:00
|
|
|
CondParser_ComparisonOrLeaf(CondParser *par, bool doEval)
|
2020-11-20 03:54:37 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
Token t;
|
2022-02-05 20:03:50 +00:00
|
|
|
char *arg;
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
const char *p;
|
2020-11-20 03:54:37 +00:00
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
p = par->p;
|
|
|
|
if (ch_isdigit(p[0]) || p[0] == '-' || p[0] == '+')
|
2021-01-14 01:24:34 +00:00
|
|
|
return CondParser_Comparison(par, doEval);
|
|
|
|
|
|
|
|
/*
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* Most likely we have a bare word to apply the default function to.
|
|
|
|
* However, ".if a == b" gets here when the "a" is unquoted and
|
|
|
|
* doesn't start with a '$'. This surprises people.
|
2021-01-14 01:24:34 +00:00
|
|
|
* If what follows the function argument is a '=' or '!' then the
|
|
|
|
* syntax would be invalid if we did "defined(a)" - so instead treat
|
|
|
|
* as an expression.
|
|
|
|
*/
|
2021-06-25 18:16:24 +00:00
|
|
|
/*
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* XXX: In edge cases, an expression may be evaluated twice,
|
2022-02-05 20:03:50 +00:00
|
|
|
* see cond-token-plain.mk, keyword 'twice'.
|
2021-06-25 18:16:24 +00:00
|
|
|
*/
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
arg = ParseWord(&p, doEval);
|
2022-02-05 20:03:50 +00:00
|
|
|
assert(arg[0] != '\0');
|
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
if (*p == '=' || *p == '!' || *p == '<' || *p == '>')
|
2021-01-14 01:24:34 +00:00
|
|
|
return CondParser_Comparison(par, doEval);
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
par->p = p;
|
2021-01-14 01:24:34 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Evaluate the argument using the default function.
|
|
|
|
* This path always treats .if as .ifdef. To get here, the character
|
|
|
|
* after .if must have been taken literally, so the argument cannot
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* be empty - even if it contained an expression.
|
2021-01-14 01:24:34 +00:00
|
|
|
*/
|
2022-02-05 20:03:50 +00:00
|
|
|
t = ToToken(doEval && par->evalBare(arg) != par->negateEvalBare);
|
2021-01-14 01:24:34 +00:00
|
|
|
free(arg);
|
|
|
|
return t;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
/* Return the next token or comparison result from the parser. */
|
2012-06-08 21:57:36 +00:00
|
|
|
static Token
|
2021-06-25 18:16:24 +00:00
|
|
|
CondParser_Token(CondParser *par, bool doEval)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
Token t;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
t = par->curr;
|
|
|
|
if (t != TOK_NONE) {
|
|
|
|
par->curr = TOK_NONE;
|
|
|
|
return t;
|
|
|
|
}
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
cpp_skip_hspace(&par->p);
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
switch (par->p[0]) {
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
case '(':
|
|
|
|
par->p++;
|
|
|
|
return TOK_LPAREN;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
case ')':
|
|
|
|
par->p++;
|
|
|
|
return TOK_RPAREN;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
case '|':
|
|
|
|
par->p++;
|
|
|
|
if (par->p[0] == '|')
|
|
|
|
par->p++;
|
|
|
|
else if (opts.strict) {
|
|
|
|
Parse_Error(PARSE_FATAL, "Unknown operator '|'");
|
2021-06-25 18:16:24 +00:00
|
|
|
par->printedError = true;
|
2021-01-14 01:24:34 +00:00
|
|
|
return TOK_ERROR;
|
|
|
|
}
|
|
|
|
return TOK_OR;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
case '&':
|
|
|
|
par->p++;
|
|
|
|
if (par->p[0] == '&')
|
|
|
|
par->p++;
|
|
|
|
else if (opts.strict) {
|
|
|
|
Parse_Error(PARSE_FATAL, "Unknown operator '&'");
|
2021-06-25 18:16:24 +00:00
|
|
|
par->printedError = true;
|
2021-01-14 01:24:34 +00:00
|
|
|
return TOK_ERROR;
|
|
|
|
}
|
|
|
|
return TOK_AND;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
case '!':
|
|
|
|
par->p++;
|
|
|
|
return TOK_NOT;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
case '#': /* XXX: see unit-tests/cond-token-plain.mk */
|
|
|
|
case '\n': /* XXX: why should this end the condition? */
|
|
|
|
/* Probably obsolete now, from 1993-03-21. */
|
|
|
|
case '\0':
|
|
|
|
return TOK_EOF;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
case '"':
|
|
|
|
case '$':
|
|
|
|
return CondParser_Comparison(par, doEval);
|
|
|
|
|
|
|
|
default:
|
2021-12-18 07:27:22 +00:00
|
|
|
if (CondParser_FuncCallEmpty(par, doEval, &t))
|
|
|
|
return t;
|
2021-06-25 18:16:24 +00:00
|
|
|
if (CondParser_FuncCall(par, doEval, &t))
|
|
|
|
return t;
|
|
|
|
return CondParser_ComparisonOrLeaf(par, doEval);
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
/* Skip the next token if it equals t. */
|
|
|
|
static bool
|
|
|
|
CondParser_Skip(CondParser *par, Token t)
|
|
|
|
{
|
|
|
|
Token actual;
|
|
|
|
|
|
|
|
actual = CondParser_Token(par, false);
|
|
|
|
if (actual == t)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
assert(par->curr == TOK_NONE);
|
|
|
|
assert(actual != TOK_NONE);
|
|
|
|
par->curr = actual;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
2021-02-11 01:51:11 +00:00
|
|
|
* Term -> '(' Or ')'
|
|
|
|
* Term -> '!' Term
|
|
|
|
* Term -> Leaf Operator Leaf
|
|
|
|
* Term -> Leaf
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
2021-02-11 01:51:11 +00:00
|
|
|
static CondResult
|
2021-06-25 18:16:24 +00:00
|
|
|
CondParser_Term(CondParser *par, bool doEval)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-02-11 01:51:11 +00:00
|
|
|
CondResult res;
|
2021-01-14 01:24:34 +00:00
|
|
|
Token t;
|
Import bmake-20240309
Intersting/relevant changes since bmake-20240108
ChangeLog since bmake-20240108
2024-03-10 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap: tests can take a long time; use a cookie to
skip them if bmake has not been updated since tests last
ran successfully.
* Makefile: Cygwin handles MANTARGET man
* unit-tests/Makefile: set BROKEN_TESTS for Cygwin
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240309
Merge with NetBSD make, pick up
o set .ERROR_EXIT to the exit status of .ERROR_TARGET
this allows a .ERROR target to ignore the case of
.ERROR_EXIT==6 which just means that the build actually
failed somewhere else.
2024-03-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240303
* var.c: on IRIX we need both inttypes.h and stdint.h
2024-03-01 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240301
Merge with NetBSD make, pick up
o export variables with value from target scope
when appropriate.
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240212
Merge with NetBSD make, pick up
o remove unneeded conditional-compilation toggles
INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB,
GMAKEEXPORT NO_REGEX and SUNSHCMD
* configure.in: add check for regex.h
* var.c: replace use of NO_REGEX with HAVE_REGEX_H
2024-02-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240204
Merge with NetBSD make, pick up
o var.c: fix some lint (-dL) mode parsing issues
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION: (_MAKE_VERSION): 20240202
Merge with NetBSD make, pick up
o make.1: note that arg to :D and :U can be empty
o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no
mk/ChangeLog since bmake-20240108
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240309
* meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not
want to save the .ERROR_META_FILE
2024-02-20 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240220
* sys.dirdeps.mk, dirdeps-targets.mk, init.mk:
do not set .MAIN: dirdeps in sys.dirdeps.mk
dirdeps-targets.mk will do that for top-level builds
and init.mk will do it for others.
This allows a Makefile which has no need of 'dirdeps' to
set .MAIN for itself and "just work".
2024-02-18 Simon J Gerraty <sjg@beast.crufty.net>
* bsd.*.mk: for makefiles that get a bsd. symlink,
use _this in multiple inclusion tags since .PARSEFILE will not
DTRT when such a makefile is included directly by Makefile and
automatically (without bsd. prefix).
Since we cannot guarantee that our sys.mk will be used, we provide
a default _this in each makefile that gets a bsd. prefix such that
the value is the same regardless of bsd. prefix.
* subdir.mk: drop the !target guard on $SUBDIR_TARGETS
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240212
* SPDX-License-Identifier: BSD-2-Clause
Add SPDX-License-Identifier to inidicate that I consider
my copyright on any of these makefiles equivalent to BSD-2-Clause
* autoconf.mk: allow for configure.ac as currently recommended
* subdir.mk: support @auto
which is replaced with each subdir that
has a [Mm]akefile.
* subdir.mk: include local.subdir.mk if it exists.
* subdir.mk: rework to handle .WAIT
2024-02-11 Simon J Gerraty <sjg@beast.crufty.net>
* subdir.mk: _SUBDIRUSE report the target we are entering subdirs for.
2024-02-10 Simon J Gerraty <sjg@beast.crufty.net>
* prog.mk: treat empty SRCS the same as undefined
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* Avoid undefined errors in lint (-dL) mode
* man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7)
2024-01-28 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240128
* FILES: add ccm.dep.mk for C++ modules
add suffixes.mk for common location for generic SUFFIX rules.
* auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk
replace OBJ_EXTENSIONS with OBJ_SUFFIXES
* autodep.mk: leverage CXX_SUFFIXES for __depsrcs
and update style (spaces around = etc)
* init.mk: add OBJS_SRCS_FILTER to filter SRCS when
setting OBJS
* meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
|
|
|
bool neg = false;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
Import bmake-20240309
Intersting/relevant changes since bmake-20240108
ChangeLog since bmake-20240108
2024-03-10 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap: tests can take a long time; use a cookie to
skip them if bmake has not been updated since tests last
ran successfully.
* Makefile: Cygwin handles MANTARGET man
* unit-tests/Makefile: set BROKEN_TESTS for Cygwin
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240309
Merge with NetBSD make, pick up
o set .ERROR_EXIT to the exit status of .ERROR_TARGET
this allows a .ERROR target to ignore the case of
.ERROR_EXIT==6 which just means that the build actually
failed somewhere else.
2024-03-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240303
* var.c: on IRIX we need both inttypes.h and stdint.h
2024-03-01 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240301
Merge with NetBSD make, pick up
o export variables with value from target scope
when appropriate.
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240212
Merge with NetBSD make, pick up
o remove unneeded conditional-compilation toggles
INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB,
GMAKEEXPORT NO_REGEX and SUNSHCMD
* configure.in: add check for regex.h
* var.c: replace use of NO_REGEX with HAVE_REGEX_H
2024-02-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240204
Merge with NetBSD make, pick up
o var.c: fix some lint (-dL) mode parsing issues
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION: (_MAKE_VERSION): 20240202
Merge with NetBSD make, pick up
o make.1: note that arg to :D and :U can be empty
o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no
mk/ChangeLog since bmake-20240108
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240309
* meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not
want to save the .ERROR_META_FILE
2024-02-20 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240220
* sys.dirdeps.mk, dirdeps-targets.mk, init.mk:
do not set .MAIN: dirdeps in sys.dirdeps.mk
dirdeps-targets.mk will do that for top-level builds
and init.mk will do it for others.
This allows a Makefile which has no need of 'dirdeps' to
set .MAIN for itself and "just work".
2024-02-18 Simon J Gerraty <sjg@beast.crufty.net>
* bsd.*.mk: for makefiles that get a bsd. symlink,
use _this in multiple inclusion tags since .PARSEFILE will not
DTRT when such a makefile is included directly by Makefile and
automatically (without bsd. prefix).
Since we cannot guarantee that our sys.mk will be used, we provide
a default _this in each makefile that gets a bsd. prefix such that
the value is the same regardless of bsd. prefix.
* subdir.mk: drop the !target guard on $SUBDIR_TARGETS
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240212
* SPDX-License-Identifier: BSD-2-Clause
Add SPDX-License-Identifier to inidicate that I consider
my copyright on any of these makefiles equivalent to BSD-2-Clause
* autoconf.mk: allow for configure.ac as currently recommended
* subdir.mk: support @auto
which is replaced with each subdir that
has a [Mm]akefile.
* subdir.mk: include local.subdir.mk if it exists.
* subdir.mk: rework to handle .WAIT
2024-02-11 Simon J Gerraty <sjg@beast.crufty.net>
* subdir.mk: _SUBDIRUSE report the target we are entering subdirs for.
2024-02-10 Simon J Gerraty <sjg@beast.crufty.net>
* prog.mk: treat empty SRCS the same as undefined
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* Avoid undefined errors in lint (-dL) mode
* man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7)
2024-01-28 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240128
* FILES: add ccm.dep.mk for C++ modules
add suffixes.mk for common location for generic SUFFIX rules.
* auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk
replace OBJ_EXTENSIONS with OBJ_SUFFIXES
* autodep.mk: leverage CXX_SUFFIXES for __depsrcs
and update style (spaces around = etc)
* init.mk: add OBJS_SRCS_FILTER to filter SRCS when
setting OBJS
* meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
|
|
|
while ((t = CondParser_Token(par, doEval)) == TOK_NOT)
|
|
|
|
neg = !neg;
|
|
|
|
|
|
|
|
if (t == TOK_TRUE || t == TOK_FALSE)
|
|
|
|
return neg == (t == TOK_FALSE) ? CR_TRUE : CR_FALSE;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
if (t == TOK_LPAREN) {
|
|
|
|
res = CondParser_Or(par, doEval);
|
|
|
|
if (res == CR_ERROR)
|
|
|
|
return CR_ERROR;
|
|
|
|
if (CondParser_Token(par, doEval) != TOK_RPAREN)
|
|
|
|
return CR_ERROR;
|
Import bmake-20240309
Intersting/relevant changes since bmake-20240108
ChangeLog since bmake-20240108
2024-03-10 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap: tests can take a long time; use a cookie to
skip them if bmake has not been updated since tests last
ran successfully.
* Makefile: Cygwin handles MANTARGET man
* unit-tests/Makefile: set BROKEN_TESTS for Cygwin
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240309
Merge with NetBSD make, pick up
o set .ERROR_EXIT to the exit status of .ERROR_TARGET
this allows a .ERROR target to ignore the case of
.ERROR_EXIT==6 which just means that the build actually
failed somewhere else.
2024-03-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240303
* var.c: on IRIX we need both inttypes.h and stdint.h
2024-03-01 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240301
Merge with NetBSD make, pick up
o export variables with value from target scope
when appropriate.
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240212
Merge with NetBSD make, pick up
o remove unneeded conditional-compilation toggles
INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB,
GMAKEEXPORT NO_REGEX and SUNSHCMD
* configure.in: add check for regex.h
* var.c: replace use of NO_REGEX with HAVE_REGEX_H
2024-02-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240204
Merge with NetBSD make, pick up
o var.c: fix some lint (-dL) mode parsing issues
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION: (_MAKE_VERSION): 20240202
Merge with NetBSD make, pick up
o make.1: note that arg to :D and :U can be empty
o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no
mk/ChangeLog since bmake-20240108
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240309
* meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not
want to save the .ERROR_META_FILE
2024-02-20 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240220
* sys.dirdeps.mk, dirdeps-targets.mk, init.mk:
do not set .MAIN: dirdeps in sys.dirdeps.mk
dirdeps-targets.mk will do that for top-level builds
and init.mk will do it for others.
This allows a Makefile which has no need of 'dirdeps' to
set .MAIN for itself and "just work".
2024-02-18 Simon J Gerraty <sjg@beast.crufty.net>
* bsd.*.mk: for makefiles that get a bsd. symlink,
use _this in multiple inclusion tags since .PARSEFILE will not
DTRT when such a makefile is included directly by Makefile and
automatically (without bsd. prefix).
Since we cannot guarantee that our sys.mk will be used, we provide
a default _this in each makefile that gets a bsd. prefix such that
the value is the same regardless of bsd. prefix.
* subdir.mk: drop the !target guard on $SUBDIR_TARGETS
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240212
* SPDX-License-Identifier: BSD-2-Clause
Add SPDX-License-Identifier to inidicate that I consider
my copyright on any of these makefiles equivalent to BSD-2-Clause
* autoconf.mk: allow for configure.ac as currently recommended
* subdir.mk: support @auto
which is replaced with each subdir that
has a [Mm]akefile.
* subdir.mk: include local.subdir.mk if it exists.
* subdir.mk: rework to handle .WAIT
2024-02-11 Simon J Gerraty <sjg@beast.crufty.net>
* subdir.mk: _SUBDIRUSE report the target we are entering subdirs for.
2024-02-10 Simon J Gerraty <sjg@beast.crufty.net>
* prog.mk: treat empty SRCS the same as undefined
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* Avoid undefined errors in lint (-dL) mode
* man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7)
2024-01-28 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240128
* FILES: add ccm.dep.mk for C++ modules
add suffixes.mk for common location for generic SUFFIX rules.
* auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk
replace OBJ_EXTENSIONS with OBJ_SUFFIXES
* autodep.mk: leverage CXX_SUFFIXES for __depsrcs
and update style (spaces around = etc)
* init.mk: add OBJS_SRCS_FILTER to filter SRCS when
setting OBJS
* meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
|
|
|
return neg == (res == CR_FALSE) ? CR_TRUE : CR_FALSE;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
return CR_ERROR;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
2021-12-18 07:27:22 +00:00
|
|
|
* And -> Term ('&&' Term)*
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
2021-02-11 01:51:11 +00:00
|
|
|
static CondResult
|
2021-06-25 18:16:24 +00:00
|
|
|
CondParser_And(CondParser *par, bool doEval)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-12-18 07:27:22 +00:00
|
|
|
CondResult res, rhs;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
res = CR_TRUE;
|
|
|
|
do {
|
|
|
|
if ((rhs = CondParser_Term(par, doEval)) == CR_ERROR)
|
2021-02-11 01:51:11 +00:00
|
|
|
return CR_ERROR;
|
2021-12-18 07:27:22 +00:00
|
|
|
if (rhs == CR_FALSE) {
|
|
|
|
res = CR_FALSE;
|
|
|
|
doEval = false;
|
|
|
|
}
|
|
|
|
} while (CondParser_Skip(par, TOK_AND));
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
return res;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2020-09-05 16:11:04 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
2021-12-18 07:27:22 +00:00
|
|
|
* Or -> And ('||' And)*
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
2021-02-11 01:51:11 +00:00
|
|
|
static CondResult
|
2021-06-25 18:16:24 +00:00
|
|
|
CondParser_Or(CondParser *par, bool doEval)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-12-18 07:27:22 +00:00
|
|
|
CondResult res, rhs;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
2021-12-18 07:27:22 +00:00
|
|
|
res = CR_FALSE;
|
|
|
|
do {
|
|
|
|
if ((rhs = CondParser_And(par, doEval)) == CR_ERROR)
|
2021-02-11 01:51:11 +00:00
|
|
|
return CR_ERROR;
|
2021-12-18 07:27:22 +00:00
|
|
|
if (rhs == CR_TRUE) {
|
|
|
|
res = CR_TRUE;
|
|
|
|
doEval = false;
|
|
|
|
}
|
|
|
|
} while (CondParser_Skip(par, TOK_OR));
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
return res;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* Evaluate the condition, including any side effects from the
|
2020-11-07 19:39:21 +00:00
|
|
|
* expressions in the condition. The condition consists of &&, ||, !,
|
|
|
|
* function(arg), comparisons and parenthetical groupings thereof.
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
2022-02-05 20:03:50 +00:00
|
|
|
static CondResult
|
|
|
|
CondEvalExpression(const char *cond, bool plain,
|
2021-12-18 07:27:22 +00:00
|
|
|
bool (*evalBare)(const char *), bool negate,
|
|
|
|
bool eprint, bool leftUnquotedOK)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
CondParser par;
|
2022-02-05 20:03:50 +00:00
|
|
|
CondResult rval;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
cpp_skip_hspace(&cond);
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
par.plain = plain;
|
|
|
|
par.evalBare = evalBare;
|
|
|
|
par.negateEvalBare = negate;
|
2021-12-18 07:27:22 +00:00
|
|
|
par.leftUnquotedOK = leftUnquotedOK;
|
2021-01-14 01:24:34 +00:00
|
|
|
par.p = cond;
|
|
|
|
par.curr = TOK_NONE;
|
2021-06-25 18:16:24 +00:00
|
|
|
par.printedError = false;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
Import bmake-20240309
Intersting/relevant changes since bmake-20240108
ChangeLog since bmake-20240108
2024-03-10 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap: tests can take a long time; use a cookie to
skip them if bmake has not been updated since tests last
ran successfully.
* Makefile: Cygwin handles MANTARGET man
* unit-tests/Makefile: set BROKEN_TESTS for Cygwin
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240309
Merge with NetBSD make, pick up
o set .ERROR_EXIT to the exit status of .ERROR_TARGET
this allows a .ERROR target to ignore the case of
.ERROR_EXIT==6 which just means that the build actually
failed somewhere else.
2024-03-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240303
* var.c: on IRIX we need both inttypes.h and stdint.h
2024-03-01 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240301
Merge with NetBSD make, pick up
o export variables with value from target scope
when appropriate.
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240212
Merge with NetBSD make, pick up
o remove unneeded conditional-compilation toggles
INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB,
GMAKEEXPORT NO_REGEX and SUNSHCMD
* configure.in: add check for regex.h
* var.c: replace use of NO_REGEX with HAVE_REGEX_H
2024-02-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20240204
Merge with NetBSD make, pick up
o var.c: fix some lint (-dL) mode parsing issues
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION: (_MAKE_VERSION): 20240202
Merge with NetBSD make, pick up
o make.1: note that arg to :D and :U can be empty
o var.c: $$ is not a parse error when .MAKE.SAVE_DOLLARS=no
mk/ChangeLog since bmake-20240108
2024-03-09 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240309
* meta.sys.mk: _metaError: if .ERROR_EXIT == 6, we do not
want to save the .ERROR_META_FILE
2024-02-20 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240220
* sys.dirdeps.mk, dirdeps-targets.mk, init.mk:
do not set .MAIN: dirdeps in sys.dirdeps.mk
dirdeps-targets.mk will do that for top-level builds
and init.mk will do it for others.
This allows a Makefile which has no need of 'dirdeps' to
set .MAIN for itself and "just work".
2024-02-18 Simon J Gerraty <sjg@beast.crufty.net>
* bsd.*.mk: for makefiles that get a bsd. symlink,
use _this in multiple inclusion tags since .PARSEFILE will not
DTRT when such a makefile is included directly by Makefile and
automatically (without bsd. prefix).
Since we cannot guarantee that our sys.mk will be used, we provide
a default _this in each makefile that gets a bsd. prefix such that
the value is the same regardless of bsd. prefix.
* subdir.mk: drop the !target guard on $SUBDIR_TARGETS
2024-02-12 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240212
* SPDX-License-Identifier: BSD-2-Clause
Add SPDX-License-Identifier to inidicate that I consider
my copyright on any of these makefiles equivalent to BSD-2-Clause
* autoconf.mk: allow for configure.ac as currently recommended
* subdir.mk: support @auto
which is replaced with each subdir that
has a [Mm]akefile.
* subdir.mk: include local.subdir.mk if it exists.
* subdir.mk: rework to handle .WAIT
2024-02-11 Simon J Gerraty <sjg@beast.crufty.net>
* subdir.mk: _SUBDIRUSE report the target we are entering subdirs for.
2024-02-10 Simon J Gerraty <sjg@beast.crufty.net>
* prog.mk: treat empty SRCS the same as undefined
2024-02-02 Simon J Gerraty <sjg@beast.crufty.net>
* Avoid undefined errors in lint (-dL) mode
* man.mk (CMT2DOC_FLAGS): note that -mm does mdoc(7)
2024-01-28 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20240128
* FILES: add ccm.dep.mk for C++ modules
add suffixes.mk for common location for generic SUFFIX rules.
* auto.dep.mk autodep.mk meta.autodep.mk: include ccm.dep.mk
replace OBJ_EXTENSIONS with OBJ_SUFFIXES
* autodep.mk: leverage CXX_SUFFIXES for __depsrcs
and update style (spaces around = etc)
* init.mk: add OBJS_SRCS_FILTER to filter SRCS when
setting OBJS
* meta2deps.py: handle multiple ./ embedded in path better.
2024-03-14 02:14:41 +00:00
|
|
|
DEBUG1(COND, "CondParser_Eval: %s\n", par.p);
|
|
|
|
rval = CondParser_Or(&par, true);
|
|
|
|
if (par.curr != TOK_EOF)
|
|
|
|
rval = CR_ERROR;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
if (rval == CR_ERROR && eprint && !par.printedError)
|
2021-01-14 01:24:34 +00:00
|
|
|
Parse_Error(PARSE_FATAL, "Malformed conditional (%s)", cond);
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
return rval;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
|
|
|
* Evaluate a condition in a :? modifier, such as
|
|
|
|
* ${"${VAR}" == value:?yes:no}.
|
|
|
|
*/
|
2022-02-05 20:03:50 +00:00
|
|
|
CondResult
|
|
|
|
Cond_EvalCondition(const char *cond)
|
2020-11-07 19:39:21 +00:00
|
|
|
{
|
2022-02-05 20:03:50 +00:00
|
|
|
return CondEvalExpression(cond, true,
|
2021-12-18 07:27:22 +00:00
|
|
|
FuncDefined, false, false, true);
|
2020-11-07 19:39:21 +00:00
|
|
|
}
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
2021-01-14 01:24:34 +00:00
|
|
|
IsEndif(const char *p)
|
|
|
|
{
|
|
|
|
return p[0] == 'e' && p[1] == 'n' && p[2] == 'd' &&
|
|
|
|
p[3] == 'i' && p[4] == 'f' && !ch_isalpha(p[5]);
|
|
|
|
}
|
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
static bool
|
|
|
|
DetermineKindOfConditional(const char **pp, bool *out_plain,
|
2021-12-18 07:27:22 +00:00
|
|
|
bool (**out_evalBare)(const char *),
|
2021-06-25 18:16:24 +00:00
|
|
|
bool *out_negate)
|
2021-02-11 01:51:11 +00:00
|
|
|
{
|
2022-02-05 20:03:50 +00:00
|
|
|
const char *p = *pp + 2;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
*out_plain = false;
|
2021-02-11 01:51:11 +00:00
|
|
|
*out_evalBare = FuncDefined;
|
2022-02-05 20:03:50 +00:00
|
|
|
*out_negate = skip_string(&p, "n");
|
|
|
|
|
|
|
|
if (skip_string(&p, "def")) { /* .ifdef and .ifndef */
|
|
|
|
} else if (skip_string(&p, "make")) /* .ifmake and .ifnmake */
|
2021-02-11 01:51:11 +00:00
|
|
|
*out_evalBare = FuncMake;
|
2022-02-05 20:03:50 +00:00
|
|
|
else if (!*out_negate) /* plain .if */
|
2021-06-25 18:16:24 +00:00
|
|
|
*out_plain = true;
|
2022-02-05 20:03:50 +00:00
|
|
|
else
|
|
|
|
goto unknown_directive;
|
|
|
|
if (ch_isalpha(*p))
|
|
|
|
goto unknown_directive;
|
2021-02-11 01:51:11 +00:00
|
|
|
|
|
|
|
*pp = p;
|
2021-06-25 18:16:24 +00:00
|
|
|
return true;
|
2022-02-05 20:03:50 +00:00
|
|
|
|
|
|
|
unknown_directive:
|
|
|
|
return false;
|
2021-02-11 01:51:11 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/*
|
|
|
|
* Evaluate the conditional directive in the line, which is one of:
|
2012-06-08 21:57:36 +00:00
|
|
|
*
|
2020-11-20 03:54:37 +00:00
|
|
|
* .if <cond>
|
|
|
|
* .ifmake <cond>
|
|
|
|
* .ifnmake <cond>
|
|
|
|
* .ifdef <cond>
|
|
|
|
* .ifndef <cond>
|
|
|
|
* .elif <cond>
|
|
|
|
* .elifmake <cond>
|
|
|
|
* .elifnmake <cond>
|
|
|
|
* .elifdef <cond>
|
|
|
|
* .elifndef <cond>
|
|
|
|
* .else
|
|
|
|
* .endif
|
|
|
|
*
|
|
|
|
* In these directives, <cond> consists of &&, ||, !, function(arg),
|
|
|
|
* comparisons, expressions, bare words, numbers and strings, and
|
|
|
|
* parenthetical groupings thereof.
|
2020-11-07 19:39:21 +00:00
|
|
|
*
|
|
|
|
* Results:
|
2022-02-05 20:03:50 +00:00
|
|
|
* CR_TRUE to continue parsing the lines that follow the
|
2021-06-25 18:16:24 +00:00
|
|
|
* conditional (when <cond> evaluates to true)
|
2022-02-05 20:03:50 +00:00
|
|
|
* CR_FALSE to skip the lines after the conditional
|
2021-06-25 18:16:24 +00:00
|
|
|
* (when <cond> evaluates to false, or when a previous
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
* branch was already taken)
|
2022-02-05 20:03:50 +00:00
|
|
|
* CR_ERROR if the conditional was not valid, either because of
|
2020-11-07 19:39:21 +00:00
|
|
|
* a syntax error or because some variable was undefined
|
|
|
|
* or because the condition could not be evaluated
|
2012-06-08 21:57:36 +00:00
|
|
|
*/
|
2022-02-05 20:03:50 +00:00
|
|
|
CondResult
|
2021-01-14 01:24:34 +00:00
|
|
|
Cond_EvalLine(const char *line)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2021-01-14 01:24:34 +00:00
|
|
|
typedef enum IfState {
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
/* None of the previous <cond> evaluated to true. */
|
2021-01-14 01:24:34 +00:00
|
|
|
IFS_INITIAL = 0,
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
/*
|
|
|
|
* The previous <cond> evaluated to true. The lines following
|
|
|
|
* this condition are interpreted.
|
|
|
|
*/
|
2021-01-14 01:24:34 +00:00
|
|
|
IFS_ACTIVE = 1 << 0,
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/* The previous directive was an '.else'. */
|
|
|
|
IFS_SEEN_ELSE = 1 << 1,
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
/* One of the previous <cond> evaluated to true. */
|
2021-01-14 01:24:34 +00:00
|
|
|
IFS_WAS_ACTIVE = 1 << 2
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
} IfState;
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
static enum IfState *cond_states = NULL;
|
|
|
|
static unsigned int cond_states_cap = 128;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-06-25 18:16:24 +00:00
|
|
|
bool plain;
|
2021-12-18 07:27:22 +00:00
|
|
|
bool (*evalBare)(const char *);
|
2021-06-25 18:16:24 +00:00
|
|
|
bool negate;
|
|
|
|
bool isElif;
|
2022-02-05 20:03:50 +00:00
|
|
|
CondResult res;
|
2021-01-14 01:24:34 +00:00
|
|
|
IfState state;
|
|
|
|
const char *p = line;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
if (cond_states == NULL) {
|
|
|
|
cond_states = bmake_malloc(
|
|
|
|
cond_states_cap * sizeof *cond_states);
|
|
|
|
cond_states[0] = IFS_ACTIVE;
|
|
|
|
}
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
p++; /* skip the leading '.' */
|
|
|
|
cpp_skip_hspace(&p);
|
2020-11-20 03:54:37 +00:00
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
if (IsEndif(p)) {
|
2021-01-14 01:24:34 +00:00
|
|
|
if (p[5] != '\0') {
|
|
|
|
Parse_Error(PARSE_FATAL,
|
2021-12-18 07:27:22 +00:00
|
|
|
"The .endif directive does not take arguments");
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2023-01-28 00:23:54 +00:00
|
|
|
if (cond_depth == CurFile_CondMinDepth()) {
|
2021-01-14 01:24:34 +00:00
|
|
|
Parse_Error(PARSE_FATAL, "if-less endif");
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_TRUE;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/* Return state for previous conditional */
|
|
|
|
cond_depth--;
|
2023-06-27 20:29:43 +00:00
|
|
|
Parse_GuardEndif();
|
2021-01-14 01:24:34 +00:00
|
|
|
return cond_states[cond_depth] & IFS_ACTIVE
|
2022-02-05 20:03:50 +00:00
|
|
|
? CR_TRUE : CR_FALSE;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2020-11-20 03:54:37 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
/* Parse the name of the directive, such as 'if', 'elif', 'endif'. */
|
|
|
|
if (p[0] == 'e') {
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
if (p[1] != 'l')
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_ERROR;
|
2021-01-14 01:24:34 +00:00
|
|
|
|
|
|
|
/* Quite likely this is 'else' or 'elif' */
|
|
|
|
p += 2;
|
2022-02-05 20:03:50 +00:00
|
|
|
if (strncmp(p, "se", 2) == 0 && !ch_isalpha(p[2])) {
|
2021-01-14 01:24:34 +00:00
|
|
|
if (p[2] != '\0')
|
|
|
|
Parse_Error(PARSE_FATAL,
|
2021-12-18 07:27:22 +00:00
|
|
|
"The .else directive "
|
|
|
|
"does not take arguments");
|
2021-01-14 01:24:34 +00:00
|
|
|
|
2023-01-28 00:23:54 +00:00
|
|
|
if (cond_depth == CurFile_CondMinDepth()) {
|
2021-01-14 01:24:34 +00:00
|
|
|
Parse_Error(PARSE_FATAL, "if-less else");
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_TRUE;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2023-06-27 20:29:43 +00:00
|
|
|
Parse_GuardElse();
|
2021-01-14 01:24:34 +00:00
|
|
|
|
|
|
|
state = cond_states[cond_depth];
|
|
|
|
if (state == IFS_INITIAL) {
|
|
|
|
state = IFS_ACTIVE | IFS_SEEN_ELSE;
|
|
|
|
} else {
|
|
|
|
if (state & IFS_SEEN_ELSE)
|
|
|
|
Parse_Error(PARSE_WARNING,
|
2022-02-05 20:03:50 +00:00
|
|
|
"extra else");
|
2021-01-14 01:24:34 +00:00
|
|
|
state = IFS_WAS_ACTIVE | IFS_SEEN_ELSE;
|
|
|
|
}
|
|
|
|
cond_states[cond_depth] = state;
|
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
return state & IFS_ACTIVE ? CR_TRUE : CR_FALSE;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
|
|
|
/* Assume for now it is an elif */
|
2021-06-25 18:16:24 +00:00
|
|
|
isElif = true;
|
2021-01-14 01:24:34 +00:00
|
|
|
} else
|
2021-06-25 18:16:24 +00:00
|
|
|
isElif = false;
|
2021-01-14 01:24:34 +00:00
|
|
|
|
Import bmake-20240108
Interesting/relevant changes since bmake-20230909
* VERSION (_MAKE_VERSION): 20240106
Merge with NetBSD make, pick up
o fix duplicate progname when reporting an unknown target
o unit tests for Cmd_Exec using temp file
* VERSION (_MAKE_VERSION): 20240105
Merge with NetBSD make, pick up
o main.c: Cmd_Exec write cmd to a file if too big
avoid blowing commandline/env limits
* VERSION (_MAKE_VERSION): 20240101
o util.c: flesh out more of strftime
* configure.in: add --with-bmake-strftime
it is not a full implementation but enough to pass all
the unit-tests.
* parse.c: LoadFile do not append \n to empty buffer.
* VERSION (_MAKE_VERSION): 20231230
Merge with NetBSD make, pick up
o simplify memory allocation for string buffers
o fix declared types of list nodes
o suff.c: clean up freeing of suffixes
o var.c: simplify debug message for the ':@var@...@' modifier
clean up variable handling
* VERSION (_MAKE_VERSION): 20231226
Merge with NetBSD make, pick up
o compat.c: ensure make's output is correctly ordered with that of
the target when not going to a tty
o main.c: check for shellPath whether to call Shell_Init()
* VERSION (_MAKE_VERSION): 20231224
Merge with NetBSD make, pick up
o compat.c: check for shellPath whether to call Shell_Init()
tweak the unit test to detect the bug thus fixed.
o make.1: do not claim .SHELL is only used by jobs mode.
* VERSION (_MAKE_VERSION): 20231220
Merge with NetBSD make, pick up
o str.c: speed up pattern matching in the ':M' modifier
o var.c: fix confusing debug logging when deleting a variable
use consistent debug messages style when ignoring variables
* VERSION (_MAKE_VERSION): 20231210
Merge with NetBSD make, pick up
o var.c: avoid segfault on empty :C match expression
explain in debug log why variable assignment is ignored.
* VERSION (_MAKE_VERSION): 20231208
Merge with NetBSD make, pick up
o var.c: ensure fromCmd is set correctly for variables set on
command line.
* VERSION (_MAKE_VERSION): 20231124
Merge with NetBSD make, pick up
o main.c: cleanup processing of -j
fix lint warning about strchr
o var.c: more accurate error message for invalid ':mtime' argument
cleanup :[...] modifier
avoid reading beyond substring when comparing
o unit-tests cover all cases of :mtime, test and explain exporting
of variables
o cleanup comments
* bsd.after-import.mk (ECHO_TAG): FreeBSD no longer uses
$FreeBSD$ tag, so avoid adding it.
mk/ChangeLog since bmake-20230909
* dirdeps.mk: for MAKE_VERSION 20240105 we do not have the same
limits on command line length, so skip export of lists to env.
* jobs.mk: avoid C suffix in JOB_MAX_C if factor is floating
point. This keeps JOB_MAX numeric incase another makefile does
comparisons.
* gendirdeps.mk: if META_XTRAS is passed to us, add to META_FILES
2024-01-14 01:16:25 +00:00
|
|
|
if (p[0] != 'i' || p[1] != 'f')
|
|
|
|
return CR_ERROR;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-02-11 01:51:11 +00:00
|
|
|
if (!DetermineKindOfConditional(&p, &plain, &evalBare, &negate))
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_ERROR;
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2021-01-14 01:24:34 +00:00
|
|
|
if (isElif) {
|
2023-01-28 00:23:54 +00:00
|
|
|
if (cond_depth == CurFile_CondMinDepth()) {
|
2021-01-14 01:24:34 +00:00
|
|
|
Parse_Error(PARSE_FATAL, "if-less elif");
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_TRUE;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2023-06-27 20:29:43 +00:00
|
|
|
Parse_GuardElse();
|
2021-01-14 01:24:34 +00:00
|
|
|
state = cond_states[cond_depth];
|
|
|
|
if (state & IFS_SEEN_ELSE) {
|
|
|
|
Parse_Error(PARSE_WARNING, "extra elif");
|
|
|
|
cond_states[cond_depth] =
|
|
|
|
IFS_WAS_ACTIVE | IFS_SEEN_ELSE;
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_FALSE;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
|
|
|
if (state != IFS_INITIAL) {
|
|
|
|
cond_states[cond_depth] = IFS_WAS_ACTIVE;
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_FALSE;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Normal .if */
|
|
|
|
if (cond_depth + 1 >= cond_states_cap) {
|
|
|
|
/*
|
|
|
|
* This is rare, but not impossible.
|
|
|
|
* In meta mode, dirdeps.mk (only runs at level 0)
|
|
|
|
* can need more than the default.
|
|
|
|
*/
|
|
|
|
cond_states_cap += 32;
|
|
|
|
cond_states = bmake_realloc(cond_states,
|
2022-02-05 20:03:50 +00:00
|
|
|
cond_states_cap * sizeof *cond_states);
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
|
|
|
state = cond_states[cond_depth];
|
|
|
|
cond_depth++;
|
|
|
|
if (!(state & IFS_ACTIVE)) {
|
|
|
|
cond_states[cond_depth] = IFS_WAS_ACTIVE;
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_FALSE;
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2021-01-14 01:24:34 +00:00
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
res = CondEvalExpression(p, plain, evalBare, negate, true, false);
|
|
|
|
if (res == CR_ERROR) {
|
|
|
|
/* Syntax error, error message already output. */
|
|
|
|
/* Skip everything to the matching '.endif'. */
|
|
|
|
/* An extra '.else' is not detected in this case. */
|
2021-01-14 01:24:34 +00:00
|
|
|
cond_states[cond_depth] = IFS_WAS_ACTIVE;
|
2022-02-05 20:03:50 +00:00
|
|
|
return CR_FALSE;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
2021-01-14 01:24:34 +00:00
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
cond_states[cond_depth] = res == CR_TRUE ? IFS_ACTIVE : IFS_INITIAL;
|
|
|
|
return res;
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|
|
|
|
|
2023-06-27 20:29:43 +00:00
|
|
|
static bool
|
|
|
|
ParseVarnameGuard(const char **pp, const char **varname)
|
|
|
|
{
|
|
|
|
const char *p = *pp;
|
|
|
|
|
|
|
|
if (ch_isalpha(*p) || *p == '_') {
|
|
|
|
while (ch_isalnum(*p) || *p == '_')
|
|
|
|
p++;
|
|
|
|
*varname = *pp;
|
|
|
|
*pp = p;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extracts the multiple-inclusion guard from a conditional, if any. */
|
|
|
|
Guard *
|
|
|
|
Cond_ExtractGuard(const char *line)
|
|
|
|
{
|
|
|
|
const char *p, *varname;
|
|
|
|
Substring dir;
|
|
|
|
Guard *guard;
|
|
|
|
|
|
|
|
p = line + 1; /* skip the '.' */
|
|
|
|
cpp_skip_hspace(&p);
|
|
|
|
|
|
|
|
dir.start = p;
|
|
|
|
while (ch_isalpha(*p))
|
|
|
|
p++;
|
|
|
|
dir.end = p;
|
|
|
|
cpp_skip_hspace(&p);
|
|
|
|
|
|
|
|
if (Substring_Equals(dir, "if")) {
|
|
|
|
if (skip_string(&p, "!defined(")) {
|
|
|
|
if (ParseVarnameGuard(&p, &varname)
|
|
|
|
&& strcmp(p, ")") == 0)
|
|
|
|
goto found_variable;
|
|
|
|
} else if (skip_string(&p, "!target(")) {
|
|
|
|
const char *arg_p = p;
|
|
|
|
free(ParseWord(&p, false));
|
|
|
|
if (strcmp(p, ")") == 0) {
|
|
|
|
guard = bmake_malloc(sizeof(*guard));
|
|
|
|
guard->kind = GK_TARGET;
|
Import bmake-20230909
Update import.sh to generate below
ChangeLog since bmake-20230622
2023-09-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230909
Merge with NetBSD make, pick up
o main.c: allow -j to compute a multiple of ncpu
If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating
point number or ends in 'C' compute .MAKE.JOBS as a multiple of
_SC_NPROCESSORS_ONLN
.MAKE.JOBS.C will be "yes" if -jC is supported
2023-08-20 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230820
Merge with NetBSD make, pick up
o make.1: note that :localtime is better for %s
o parse.c: improve error messages for invalid input.
o var.c: fix for %s:L:gmtime - set TZ=UTC and use localtime to get
correct result, it is still better to use %s:L:localtime.
2023-08-18 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230818
Merge with NetBSD make, pick up
o meta.c: meta_ignore - check raw path against metaIgnorePaths
to potentially skip call to realpath.
o var.c: be strict when parsing the argument of the ':mtime' modifier
o unit-tests/varmod-mtime.mk: document why '${%s:L:localtime}'
should be used to get an equivalent value to time(3).
2023-08-16 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230816
Merge with NetBSD make, pick up
o cond.c: clean up multiple-inclusion guards
2023-07-25 Simon J Gerraty <sjg@beast.crufty.net>
* unit-tests/Makefile: addd varmod-localtime to BROKEN_TESTS
if configure cannot work out how to control TZ.
Remove varmod-localtime from BROKEN_TESTS for IRIX*
2023-07-24 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230723
* configure.in: fix the test for wether TZ=Europe/Berlin works.
Depending on the time of year, if run between 22:00 and 00:00 UTC
the check in configure would fail incorrectly.
Take the day into account as well.
2023-07-18 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230711
Merge with NetBSD make, pick up
o make.1: clean up wording, clarify scope of '!' in conditions
2023-07-15 Simon J Gerraty <sjg@beast.crufty.net>
* make-bootstrap.sh.in: set prefix
If configure is run using ksh we get unexpanded ${prefix} in
DEFAULT_SYS_PATH, by ensuring prefix is set we should still get
correct result.
2023-07-13 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230711
bump version for IRIX tweaks
* make.h: undef OP_NONE if defined
* unit-tests/Makefile: set BROKEN_TESTS for IRIX
* configure.in: override INSTALL on IRIX
2023-06-27 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap op_test: ensure we set TEST_MAKE as we want it.
mk/ChangeLog since bmake-20230622
2023-09-09 Simon J Gerraty <sjg@beast.crufty.net>
* jobs.mk (JOB_MAX): use -jC if we can
we actually use JOB_MAX_C which defaults to 1.33C
2023-08-18 Simon J Gerraty <sjg@beast.crufty.net>
* now_utc: %s only works with :localtime
2023-07-14 Simon J Gerraty <sjg@beast.crufty.net>
* install-sh: ignore -c as claimed and only insist on
a directory for destination when more than one file to copy.
* sys.mk: when looking for SYS_OS_MK try ${.MAKE.OS} and
${.MAKE.OS:S,64,,} early (so we find sys/IRIX.mk for IRIX64)
2023-07-13 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20230711
* sys.mk: set SYS_MK and INSTALL_SH for systems with incompatible
install(1)
* sys/IRIX.mk: when setting ROOT_GROUP only match the first :0:
set INSTALL to install-sh rather than pathname that may not exist
(yet).
2023-07-07 Simon J Gerraty <sjg@beast.crufty.net>
* dirdeps.mk: pass DIRDEP_TARGETS to DIRDEP_MAKE
normally this is empty - for the default target, but there are
use-cases where we might set it to something else.
2023-07-04 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20230704
* dirdeps.mk: apply DEBUG_DIRDEPS_LIST_FILTER to lists we output
when DEBUG_DIRDEPS is in effect.
Eg. DEBUG_DIRDEPS_LIST_FILTER=ts\n
can greatly improve readability.
2023-09-17 17:03:11 +00:00
|
|
|
guard->name = ParseWord(&arg_p, true);
|
2023-06-27 20:29:43 +00:00
|
|
|
return guard;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (Substring_Equals(dir, "ifndef")) {
|
|
|
|
if (ParseVarnameGuard(&p, &varname) && *p == '\0')
|
|
|
|
goto found_variable;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
found_variable:
|
|
|
|
guard = bmake_malloc(sizeof(*guard));
|
Import bmake-20230909
Update import.sh to generate below
ChangeLog since bmake-20230622
2023-09-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230909
Merge with NetBSD make, pick up
o main.c: allow -j to compute a multiple of ncpu
If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating
point number or ends in 'C' compute .MAKE.JOBS as a multiple of
_SC_NPROCESSORS_ONLN
.MAKE.JOBS.C will be "yes" if -jC is supported
2023-08-20 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230820
Merge with NetBSD make, pick up
o make.1: note that :localtime is better for %s
o parse.c: improve error messages for invalid input.
o var.c: fix for %s:L:gmtime - set TZ=UTC and use localtime to get
correct result, it is still better to use %s:L:localtime.
2023-08-18 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230818
Merge with NetBSD make, pick up
o meta.c: meta_ignore - check raw path against metaIgnorePaths
to potentially skip call to realpath.
o var.c: be strict when parsing the argument of the ':mtime' modifier
o unit-tests/varmod-mtime.mk: document why '${%s:L:localtime}'
should be used to get an equivalent value to time(3).
2023-08-16 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230816
Merge with NetBSD make, pick up
o cond.c: clean up multiple-inclusion guards
2023-07-25 Simon J Gerraty <sjg@beast.crufty.net>
* unit-tests/Makefile: addd varmod-localtime to BROKEN_TESTS
if configure cannot work out how to control TZ.
Remove varmod-localtime from BROKEN_TESTS for IRIX*
2023-07-24 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230723
* configure.in: fix the test for wether TZ=Europe/Berlin works.
Depending on the time of year, if run between 22:00 and 00:00 UTC
the check in configure would fail incorrectly.
Take the day into account as well.
2023-07-18 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230711
Merge with NetBSD make, pick up
o make.1: clean up wording, clarify scope of '!' in conditions
2023-07-15 Simon J Gerraty <sjg@beast.crufty.net>
* make-bootstrap.sh.in: set prefix
If configure is run using ksh we get unexpanded ${prefix} in
DEFAULT_SYS_PATH, by ensuring prefix is set we should still get
correct result.
2023-07-13 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20230711
bump version for IRIX tweaks
* make.h: undef OP_NONE if defined
* unit-tests/Makefile: set BROKEN_TESTS for IRIX
* configure.in: override INSTALL on IRIX
2023-06-27 Simon J Gerraty <sjg@beast.crufty.net>
* boot-strap op_test: ensure we set TEST_MAKE as we want it.
mk/ChangeLog since bmake-20230622
2023-09-09 Simon J Gerraty <sjg@beast.crufty.net>
* jobs.mk (JOB_MAX): use -jC if we can
we actually use JOB_MAX_C which defaults to 1.33C
2023-08-18 Simon J Gerraty <sjg@beast.crufty.net>
* now_utc: %s only works with :localtime
2023-07-14 Simon J Gerraty <sjg@beast.crufty.net>
* install-sh: ignore -c as claimed and only insist on
a directory for destination when more than one file to copy.
* sys.mk: when looking for SYS_OS_MK try ${.MAKE.OS} and
${.MAKE.OS:S,64,,} early (so we find sys/IRIX.mk for IRIX64)
2023-07-13 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20230711
* sys.mk: set SYS_MK and INSTALL_SH for systems with incompatible
install(1)
* sys/IRIX.mk: when setting ROOT_GROUP only match the first :0:
set INSTALL to install-sh rather than pathname that may not exist
(yet).
2023-07-07 Simon J Gerraty <sjg@beast.crufty.net>
* dirdeps.mk: pass DIRDEP_TARGETS to DIRDEP_MAKE
normally this is empty - for the default target, but there are
use-cases where we might set it to something else.
2023-07-04 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20230704
* dirdeps.mk: apply DEBUG_DIRDEPS_LIST_FILTER to lists we output
when DEBUG_DIRDEPS is in effect.
Eg. DEBUG_DIRDEPS_LIST_FILTER=ts\n
can greatly improve readability.
2023-09-17 17:03:11 +00:00
|
|
|
guard->kind = GK_VARIABLE;
|
2023-06-27 20:29:43 +00:00
|
|
|
guard->name = bmake_strsedup(varname, p);
|
|
|
|
return guard;
|
|
|
|
}
|
|
|
|
|
2012-06-08 21:57:36 +00:00
|
|
|
void
|
2023-01-28 00:23:54 +00:00
|
|
|
Cond_EndFile(void)
|
2012-06-08 21:57:36 +00:00
|
|
|
{
|
2023-01-28 00:23:54 +00:00
|
|
|
unsigned int open_conds = cond_depth - CurFile_CondMinDepth();
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2023-01-28 00:23:54 +00:00
|
|
|
if (open_conds != 0) {
|
2021-01-14 01:24:34 +00:00
|
|
|
Parse_Error(PARSE_FATAL, "%u open conditional%s",
|
2022-02-05 20:03:50 +00:00
|
|
|
open_conds, open_conds == 1 ? "" : "s");
|
2023-01-28 00:23:54 +00:00
|
|
|
cond_depth = CurFile_CondMinDepth();
|
2021-01-14 01:24:34 +00:00
|
|
|
}
|
2012-06-08 21:57:36 +00:00
|
|
|
}
|