make/tests/scripts/variables
Paul Smith 1eff20f6f6 Support conditional modifiers on all assignment operators
Rework the single "?=" operator to instead allow a "?" modifier to be
prepended to ANY assignment operator.  If "?" is given then the
variable is assigned (using whatever operator comes next) if and only
if the variable is not already defined.  If it is defined then no
action is taken (the right-hand side is not expanded, etc.)

* NEWS: Announce this new feature.
* doc/make.texi: Modify the documentation around assignment operators.
* src/variable.h: Remove the f_conditional variable flavor.
(do_variable_definition): Add an argument specifying conditional.
* src/variable.c (parse_variable_definition): Use the existing flag
"conditional" to remember if we saw "?" rather than the flavor.
When we see "?" skip it and continue trying to parse an assignment.
(try_variable_definition): Pass condition to do_variable_definition().
(initialize_file_variables): Ditto.
(do_variable_definition): Check for conditional up-front: quit if set.
Remove handling of obsolete f_conditional flavor.
* src/read.c (eval_makefile): MAKEFILE_LIST is not conditional.
(do_define): Unset conditional for define with no operator.  Pass the
conditional flag to do_variable_definition().
(construct_include_path): .INCLUDE_DIRS is not conditional.
* src/load.c (load_file): .LOADED is not conditional.
* tests/scripts/variables/conditional: Add new tests.
2024-01-28 14:20:47 -05:00
..
automatic [SV 62324] Simplify set_file_variables by passing in the stem 2022-04-24 10:39:32 -04:00
conditional Support conditional modifiers on all assignment operators 2024-01-28 14:20:47 -05:00
CURDIR Refresh the test suite framework implementation. 2019-09-16 08:25:33 -04:00
DEFAULT_GOAL
define Add support for the POSIX :::= assignment operator. 2021-09-20 00:29:31 -04:00
EXTRA_PREREQS [SV 65006] Allow secondary expansion of .EXTRA_PREREQS 2024-01-06 17:39:43 -05:00
flavors Remove unnecessary parsing during makefile read 2024-01-27 16:40:36 -05:00
GNUMAKEFLAGS tests: Run each file in a separate directory 2023-04-02 17:32:09 -04:00
INCLUDE_DIRS tests [WINDOWS32]: Support Strawberry Perl on Windows 2022-12-20 02:14:18 -05:00
LIBPATTERNS
MAKE
MAKE_RESTARTS * tests/scripts/variables/MAKE_RESTARTS: Remove TAB chars 2022-02-27 18:01:13 -05:00
MAKECMDGOALS
MAKEFILES
MAKEFLAGS [SV 64107] Disable builtins immediately on -R or -r 2023-04-30 09:40:50 -04:00
MAKELEVEL
MFILE_LIST [SV 50823] Support filenames containing '$' in MAKEFILE_LIST 2017-06-04 18:37:21 -04:00
negative Directly handle $\ line endings 2023-02-26 17:30:15 -05:00
private [SV 61463] Don't export inherited private variables 2023-01-02 23:02:33 -05:00
SHELL [SV 62654] Support GNU Make on z/OS 2023-01-08 10:45:38 -05:00
special Convert references from "GNU make" to "GNU Make" 2023-01-01 17:05:12 -05:00
undefine [SV 59870] define/undefine prerequisites are not target-specific vars 2021-03-14 16:35:38 -04:00
WARNINGS Add support for .WARNINGS special variable 2023-04-02 10:02:18 -04:00