Commit graph

237 commits

Author SHA1 Message Date
Paul Smith
21a538ce8f [SV 65359] doc/make.texi: Describe invalid export variable names 2024-03-24 14:05:45 -04:00
Dmitry Goncharov
07187db947 [SV 64822, SV 36486] Fix appending to a pattern specific variable
Appending to a pattern specific variable produces an incorrect value
in the presence of a command line definition or an env override of
the variable.  Also, fix pattern/target-specific appending to a
variable with origin override.

* At parse time record_target_var sets the value of a pattern
  specific variable to the value defined on command line or to the
  value of the env override.
* Later, at build time, recursively_expand_for_file appends this
  value of the variable (set in record_target_var) to the command
  line value again, regardless of the origin of the variable.

This patch modifies recursively_expand_for_file to avoid appending,
unless the origin of the variable beats or equals the origin of one
of the parent definitions of this variable.

Reported by Rob <robw9739@gmail.com>,
Brian Vandenberg <phantall@gmail.com>,
Markus Oberhumer <markus@oberhumer.com>.

* NEWS: Note the change.
* src/variable.c (do_variable_definition): Avoid merging a
pattern-specific variable with the parent definition when a command
line or env override is present.
* src/expand.c (recursively_expand_for_file): Avoid appending to a
pattern-specific variable, unless the origin of this pattern-specific
variable beats or equals the origin of one of the parent definitions
of this variable.
* doc/make.texi (Override Directive): Add missing cross-reference.
* tests/scripts/variables/append: Add tests.
2024-02-04 18:26:21 -05:00
Paul Smith
51e56a028e * doc/make.texi: Grammar improvements.
Reported-by: David Apps <davidapps3+gnu@gmail.com>
2024-01-28 14:21:00 -05:00
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
Paul Smith
31036e648f [SV 64571] Add --print-targets option
Add an option to print a list of targets defined in the makefiles.
Don't print targets of implicit rules, or special targets.  To
support this remember which files are deemed suffix rule targets.

Add a missing warning for single-suffix targets with prerequisites.

Suggested by many.  Sample implementation by Tim <tdhutt@gmail.com>.

* NEWS: Announce the new option and single-suffix warning.
* doc/make.1: Add --print-targets to the man page.
* doc/make.texi: Add --print-targets to the documentation.  Clean up
the text around the definition of suffix rules.
* src/main.c (print_targets_flag): New variable for --print-targets.
(switches): Add a new long option --print-targets.
(main): If the option was provided call print_targets() and exit.
* src/filedef.h (struct file): Add a "suffix" boolean value.  Remove
print_prereqs() since it's static.  Add new print_targets().
* src/file.c (rehash_file): Merge the new suffix value.
(print_prereqs): Used only locally: change to static.
(print_target): Print targets which are not suffix rule targets and
are not special targets.
(print_targets): Call print_target() on each file.
* src/rule.c (convert_to_pattern): Make maxsuffix local; it doesn't
need to be static.  Emit ignoring prerequisites for single-suffix
rules as well as double-suffix rules.  Remember which files are
actually suffix rules.
* tests/scripts/features/suffixrules: Test single-suffix behavior.
* tests/scripts/options/print-targets: Add tests for --print-targets.
2024-01-08 23:31:58 -05:00
Paul Smith
1161779ef8 * doc/make.texi (Text Functions): [SV 64339] Clarify pattern use. 2024-01-07 10:22:20 -05:00
Paul Smith
a80670ad41 * (all): Update Copyright year to 2024 2024-01-06 18:06:09 -05:00
Paul Smith
dd1980426e * doc/make.texi (Text Functions): [SV 64818] Remove redundant text 2024-01-01 19:24:37 -05:00
Paul Smith
b1e240c554 * doc/make.texi: [SV 64924] Add missing parenthesis 2023-11-26 23:21:55 -05:00
Paul Smith
7fa40eb4fc * doc/make.texi: Add a quick reference appendix 2023-11-26 23:21:06 -05:00
Paul Smith
66adfb7c6f make.texi: Cleanup 2023-09-01 16:57:58 -04:00
Paul Smith
9af3e60f4d make.texi: Add an appendix with troubleshooting tips 2023-08-29 15:39:16 -04:00
Paul Smith
8061929963 doc/make.texi: Clean up references to GNU Make 2023-08-29 15:20:31 -04:00
Paul Smith
cd33c9a1e9 doc/make.texi: Remove unnecessary @node arguments 2023-08-29 14:44:50 -04:00
Paul Smith
1748e66414 [SV 63219] Support an "unload" function for loaded objects
If a loaded object defines a symbol <object>_gmk_unload, assume it's
a function and invoke it whenever the loaded object is unloaded.
Original implementation by Dmitry Goncharov <dgoncharov@users.sf.net>

* NEWS: Announce the change.
* doc/make.texi: Describe the behavior.
* src/gnumake.h: Add information to the comments.
* src/makeint.h (unload_all): Declare a new function.
* src/main.c (die): Invoke unload_all().
* src/load.c (unload_func_t): Declare a new type for unload.
(struct load_list): Remember the unload symbol if it exists.
(load_object): Move the parsing of the object name from load_file.
Check for the _gmk_unload symbol and if found, remember it.
(load_file): Allow load_object to do object filename parsing.
(unload_file): Remove the load_list entry when unloading the object.
(unload_all): Unload all the loaded objects.
* tests/scripts/features/loadapi: Test the unload function.
2023-05-14 18:26:35 -04:00
Paul Smith
8e0e6c678f Remove the "preview" status from the loaded object feature
Add an ABI version both to the header file and passed to the setup
function.  Unfortunately this itself is an ABI break and I couldn't
find a good way to avoid it.

* NEWS: Announce the ABI is not a preview and the incompatibility.
* doc/make.texi: Remove the preview warnings for object loading.
Document the new ABI version argument.
* src/gnumake.h (GMK_ABI_VERSION): Set the ABI version to 1.
Add comments documenting the format of the setup function.
* src/load.c (setup_func_t): Rename from load_func_t.
(load_file): Pass the ABI version to the setup function.
* tests/scripts/features/load: Rework the setup function.
* tests/scripts/features/loadapi: Ditto.
2023-05-07 16:51:06 -04:00
Paul Smith
0552b0abc8 * doc/make.texi: Clean up function and variable references
Avoid unnecessary extra remarks in the index and remove duplicates.
2023-04-02 10:02:18 -04:00
Paul Smith
a0d1e76d60 Add support for .WARNINGS special variable
Create a new special variable, .WARNINGS, to allow per-makefile
control over warnings.  The command line settings will override
this.

Move the handling of warning flags to a new file: src/warning.c.
Allow the decode to work with generic strings, and call it from
decode_switches().

* Makefile.am: Add new file src/warning.c.
* build_w32.bat: Ditto.
* builddos.bat: Ditto.
* po/POTFILES.in: Ditto.
* src/makeint.h: #define for the .WARNINGS variable name.
* src/warning.h: Add declarations for methods moved from main.c.
Rename the enum warning_state to warning_action.
* src/warning.c: New file.  Move all warning encode/decode here
from main.c.
* src/main.c: Move methods into warning.c and call those methods
instead.
(main): Set .WARNINGS as a special variable.
* src/job.c (construct_command_argv): Rename to warning_action.
* src/read.c (tilde_expand): Ditto.
* src/variable.c (set_special_var): Update warnings when the
.WARNINGS special variable is set.
* tests/scripts/options/warn: Check invalid warning options.
* tests/scripts/variables/WARNINGS: Add tests for the .WARNINGS
special variable.
2023-04-02 10:02:18 -04:00
Paul Smith
03ecd94488 Add new warnings invalid-var and invalid-ref
The "invalid-var" warning triggers if the makefile attempts to assign
a value to an invalid variable name (a name containing whitespace).
The "invalid-ref" warning triggers if the makefile attempts to
reference an invalid variable name.  Both new warnings have a default
action of "warn".

* NEWS: Add these new warnings.
* doc/make.1: Document them in the man page.
* doc/make.texi (Warnings): Document them in the user's manual.
* src/warning.h: Add enum values for the new warning types.
* src/main.c (initialize_warnings): Initialize the new warnings.
* src/variable.h (undefine_variable_in_set, undefine_variable_global):
Ask callers to provide a struct floc specifying where the variable
is undefined.
* src/read.c (do_undefine): Pass floc when undefining.
* src/variable.c (check_valid_name): If invalid-var is enabled, check
the variable name.
(define_variable_in_set): Call it.
(undefine_variable_in_set): Ditto.
(check_variable_reference): If invalid-ref is enabled, check the
variable reference.
(lookup_variable): Call it.
(lookup_variable_in_set): Ditto.
* tests/scripts/options/warn: Add tests for the new warning types.
2023-04-01 11:13:12 -04:00
Paul Smith
2611e1991f Introduce a --warn command line option
Replace the singleton --warn-undefined-variables with infrastructure
to manage multiple warnings: the --warn option can take an action
"ignore", "warn", or "error" (which will apply to all warnings), or
a specific warning type and an action for that type.  Multiple
options can be provided and are consolidated.

* NEWS: Announce the new option.
* doc/make.1: Document in the man page.
* doc/make.texi (Warnings): Document in the user's manual.
* Makefile.am: Add new header warning.h.
* src/warning.h: Define enum for actions and warning types, and
macros to test whether they are set.  Keep the default settings
separate so that we can correctly reconstruct MAKEFLAGS.
* src/makeint.h: Remove deprecated warn_undefined_variables_flag.
* src/main.c: Create global variables to hold warning settings.
(switches): Add a new switch for --warn.
(initialize_warnings): Set the default warning actions.
(main): Call initialize_warnings().
(encode_warning_state, decode_warning_state): Convert warning states
between strings and enums.
(encode_warning_name, decode_warning_name): Convert warning names
between strings and enums.
(decode_warn_flags): Convert a --warn option into enum values.  If
deprecated warn_undefined_variables_flag is set convert it to --warn.
(decode_switches): Don't remove duplicates of --warn since order
matters.  Call decode_warn_flags() to handle --warn.
(define_makeflags): Special-case handling of --warn options written
to MAKEFLAGS: write out the current settings.
* src/read.c (tilde_expand): Use new warning control macros.
* src/variable.c (warn_undefined): Ditto.
* src/job.c (construct_command_argv): Ditto.
* tests/scripts/options/warn: Rename from warn-undefined-variables
and add tests for --warn.
* tests/scripts/variables/MAKEFLAGS: Expect the new behavior.
2023-04-01 11:13:12 -04:00
Paul Smith
d66a65ad5a GNU Make release 4.4.1
* NEWS: Set the release number and date.
* configure.ac: Update the version.
* README.git: Remind to update doc/make.1.
* doc/make.1: Update the date.  Fix some "GNU Make" references.
* doc/make.texi: Update the edition.
2023-02-26 13:46:22 -05:00
Paul Smith
8f03e69af0 * doc/make.texi: Fix typo (reported by <mao492479407@163.com>) 2023-02-05 09:42:49 -05:00
Dmitry Goncharov
f21cd822a3 * doc/make.texi: [SV 63689] Fix typos in examples 2023-01-28 13:09:36 -05:00
Paul Smith
1ceeb8c64b [SV 14927] Allow parallel builds for archives
Compare the timestamp of the object file (if it exists) with the
archived object and if the object file is newer, ensure it's updated
in the archive.

* NEWS: Announce the new capability.
* doc/make.texi (Dangers When Using Archives): Explain how to enable
parallel builds with archives.
* src/remake.c (f_mtime): For archive element files check the mod
time of the object file (if it exists) against the archive object
(if it exists).
* tests/scripts/features/archives: Add tests for this capability.
2023-01-03 01:57:35 -05:00
Paul Smith
8dc66b6c31 * doc/make.texi (Special Targets): Fix minor typo
Reported by Andrey Melnikov <vafilor@gmail.com>.
2023-01-02 00:13:28 -05:00
Paul Smith
e7ce3a655e Convert references from "GNU make" to "GNU Make" 2023-01-01 17:05:12 -05:00
Paul Smith
56d2978141 Update the copyright year on all files 2023-01-01 10:06:01 -05:00
Dmitry Goncharov
7d8756a4a3 [SV 63537] Document and test flippable switches
* doc/make.texi (Options/Recursion): Clarify that MAKEFLAGS values
from the environment have precedence over those set in the makefile.
* tests/scripts/variables/MAKEFLAGS: Check boolean switches -k/-S,
-w/--no-print-directory and -s/--no-silent as follows:
1. A switch can be enabled or disabled on the command line.
2. A switch can be enabled or disabled in env.
3. A switch can be enabled or disabled in makefile.
4. Command line beats env and makefile.
5. Env beats makefile.
6. MAKEFLAGS contains each specified switch at parse and build time.
7. If switches are specified in multiple origins, MAKEFLAGS contains
   the winning switch at parse and build time.
8. MAKEFLAGS does not contain the losing switch.
Also test that --debug settings from different origins are combined
together into one option.
2022-12-18 20:06:38 -05:00
Paul Smith
5d1b757517 [SV 63516] [DOS] Support include files with drivespecs
* src/makeint.h (HAVE_DRIVESPEC): Create a macro to check.
* src/main.c (.FEATURES): Add "dospaths" as a feature.
* src/read.c (eval_makefile) [DOS]: If the included makefile name
starts with a drivespec, don't search the include directories.
* doc/make.texi (Include): Document this behavior.
* tests/scripts/features/include: Add a test.
2022-12-18 20:06:38 -05:00
Paul Smith
a99183ed2b * doc/make.texi: Use $(firstword) rather than $(word 1,) 2022-11-28 10:50:55 -05:00
Paul Smith
ed493f6c91 Release GNU Make 4.4
* NEWS: Update the version and date.
* configure.ac: Update the version.
* doc/make.texi: Update the EDITION.
2022-10-31 02:23:04 -04:00
Paul Smith
d9fc1ac5d2 Update URLs to use https rather than http
* (all): Change http:// to https://
* README.W32: Remove invalid link to mingw.org.
2022-10-18 14:37:47 -04:00
Paul Smith
7296991d6c [SV 63098] Temporarily revert the change to pattern rule behavior
The fix for SV 12078 caused a backward-compatibility issue with some
makefiles.  In order to allow users to resolve this issue, revert
that change for this release cycle: it will be reinstated in the
next release cycle.  Introduce a warning if we detect that the recipe
of a multi-target pattern rule doesn't create all the targets.

* NEWS: Announce the future backward-incompatibility.
* doc/make.texi (Pattern Intro): Describe the behavior and that it
will change in the future.
* src/remake.c (check_also_make): Check for also_make targets that
were not created and generate a warning.
(update_goal_chain): Call the new function.
(check_dep): Ditto.
(update_file_1): Defer implicit rule detection until after we check
all the also_make files (as it used to be).
* tests/scripts/features/patternrules: Add tests of the new warning.
Skip the tests for SV 12078.
2022-10-02 10:18:21 -04:00
Paul Smith
d51ac70122 * doc/make.texi (Prerequisite Types): [SV 58056] Clarify ordering. 2022-10-02 09:30:20 -04:00
Dmitry Goncharov
f8852311cc * doc/make.texi (Loaded Object API): [SV 63126] Fix typos and examples 2022-10-01 11:47:41 -04:00
Paul Smith
38116baee9 * doc/make.texi: Update out of date behavior for grouped targets. 2022-09-25 16:58:36 -04:00
Paul Smith
88d126d6c4 * doc/make.texi (Parallel Disable): Add clarifications.
* NEWS: Suggest how to change makefiles that use $(MAKEFLAGS).
2022-09-13 18:22:29 -04:00
Paul Smith
f6ea899d83 [SV 13862] Implement the .WAIT special target
The next version of the POSIX standard defines parallel execution
and requires the .WAIT special target as is implemented in some other
versions of make.

This implementation behaves similarly to others in that it does not
create a relationship between targets in the dependency graph, so
that the same two targets may be run in parallel if they appear as
prerequisites elsewhere without .WAIT between them.

Now that we support .WAIT it's trivial to also support prerequisites
of the .NOTPARALLEL special target, which forces the prerequisites of
those targets to be run serially (as if .WAIT was specified between
each one).

* NEWS: Announce the new .WAIT and .NOTPARALLEL support.
* doc/make.texi (Parallel Disable): A new section to discuss ways in
which parallel execution can be controlled.  Modify cross-refs to
refer to this section.
* src/dep.h (struct dep): Add a new wait_here boolean.
(parse_file_seq): Add PARSEFS_WAIT to check for .WAIT dependencies.
* src/file.c (split_prereqs): Use PARSEFS_WAIT.
(snap_deps): If .NOTPARALLEL has prerequisites, set .WAIT between
each of _their_ prerequisites.
(print_prereqs): Add back in .WAIT when printing prerequisites.
* src/implicit.c (struct patdeps): Preserve wait_here.
(pattern_search): Ditto.  Use PARSEFS_WAIT when parsing prereqs for
pattern rule expansion.
* src/read.c (check_specials): Don't give up early: remembering to
update these options is not worth the rare speedup.
(check_special_file): If .WAIT is given as a target show an error--
once--if it has prereqs or commands.
(record_files): Call check_special_file on each target.
(parse_file_seq): If PARSEFS_WAIT is given, look for .WAIT prereqs.
If we see one assume that we are building a struct dep chain and set
the wait_here option while not putting it into the list.
* src/remake.c (update_file_1): If wait_here is set and we are still
running, then stop trying to build this target's prerequisites.
* src/rule.c (get_rule_defn): Add .WAIT to the prerequisite list.
* src/shuffle.c (shuffle_deps): Don't shuffle the prerequisite list
if .WAIT appears anywhere in it.
* tests/scripts/targets/WAIT: Add a test suite for this feature.
2022-09-12 18:35:29 -04:00
Paul Smith
257b82ac1f * doc/make.texi (How Make Works): Clarify default goal exceptions. 2022-09-11 15:09:13 -04:00
Paul Smith
86fc644dcc Support the MAKE_TMPDIR environment variable
Allow build systems to choose an alternative location for make to
store its temporary files.

* NEWS: Announce the new environment variable.
* doc/make.texi (Temporary Files): Provide documentation.
* src/misc.c (get_tmpdir): Split into a new function.  Compute the
temporary directory and store it in a static location.
* tests/scripts/features/jobserver: Add a test of MAKE_TMPDIR.
2022-09-11 10:56:08 -04:00
Paul Smith
02b3a6ad46 [SV 62898] Document ways to hide special chars from make functions
* doc/make.texi (Function Call Syntax): Add a subsubheading describing
which special characters may need to be hidden from make functions.
2022-09-10 23:14:02 -04:00
Paul Smith
820210ab85 Enhance the make.texi formatting
Notes provided by Tzvetelin Katchov <katchov@gnu.org>.

* doc/make.texi: Remove obsolete @refill statements.  Add some breaks
to overfull lines.  Fix up some example text.
2022-09-10 18:35:47 -04:00
Paul Smith
70ba0357a0 [SV 63040] shell: Fall back to the callers environment
If we detect a recursive variable reference when constructing the
environment for the shell function, return the original value from the
caller's environment.  Other options such as failing, returning the
empty string, or returning the unexpanded make variable value have
been shown to not behave well in real-world environments.  If the
variable doesn't exist in the caller's environment, return the empty
string.

Found by Sergei Trofimovich <slyich@gmail.com> when testing older
versions of autoconf.

* NEWS: Clarify this behavior.
* doc/make.texi (Shell Function): Ditto.  Also add info about !=.
* src/expand.c (recursively_expand_for_file): Search the caller's
environment if we detect a recursive variable expansion.
* tests/scripts/functions/shell: Add tests for this behavior.
2022-09-10 16:27:47 -04:00
Paul Smith
ab31f0b594 * doc/make.texi (Variables/Recursion): [SV 56446] Clarify export docs 2022-08-14 14:06:31 -04:00
Paul Smith
8f1b6bca46 * doc/make.texi (Goals): [SV 51306] Improve MAKECMDGOALS example 2022-08-07 17:32:07 -04:00
Dmitry Goncharov
6faa02247e * doc/make.texi (Remaking Makefiles): [SV 61623] Add optimization 2022-08-07 17:31:50 -04:00
Paul Smith
c72e1ec446 * doc/make.texi (Chained Rules): [SV 61957] Clarify NOTINTERMEDIATE 2022-08-03 00:13:34 -04:00
Paul Smith
91d87ccf32 [SV 62496] Fix example of testing MAKEFLAGS
* doc/make.texi (Options/Recursion): Define the layout of MAKEFLAGS.
(Testing Flags): Fix the example to test the first word.
2022-08-03 00:05:39 -04:00
Paul Smith
7ad2593b2d Support implementing the jobserver using named pipes
Using anonymous pipes for jobserver support has some advantages:
for example there is nothing on disk that needs to be cleaned up.
However it has many obscure problems, related to the fact that in
order for it to work we need to ensure these resources are properly
passed through to child processes that want to use the jobserver.
At the same time we don't want to pass the pipe to process which
DON'T know about the jobserver.

Other processes can open file descriptors which we then think are
our jobserver, but aren't.  And, we open the pipe file descriptors
in blocking mode which doesn't work for all users.

See issues such as SV 57178, SV 57242, and SV 62397

To avoid these issues, use named pipes (on systems where they are
available) instead of anonoymous pipes.  This simplifies many things:
we never need to pass open file descriptors to our children; they
can open the jobserver named pipe.  We don't need to worry about
recursive vs. non-recursive children.  Users don't have to "pass
through" the resources if they are invoking sub-makes.  Each child
can open its own file descriptor and set blocking as needed.

The downside is the named pipe exists on disk and so must be cleaned
up when the "top-level" make instance exits.

In order to allow make to continue to be used in build systems where
older versions of GNU make, or other tools that want to use the
jobserver, but don't understand named pipes, introduce a new option
--jobserver-style that allows the user to choose anonymous pipes.

* NEWS: Announce the change and the --jobserver-style option.
* doc/make.1: Add --jobserver-style documentation.
* doc/make.texi (Special Variables): Add missing items to .FEATURES.
(Options Summary): Add --jobserver-style.
(POSIX Jobserver): Named pipes, changes to --jobserver-auth, and the
--jobserver-style option.
(Windows Jobserver): Document --jobserver-style for Windows.
* configure.ac: Check for mkfifo.
* src/config.h-vms.template: Undefined HAVE_MKFIFO.
* src/config.h.W32.template: Ditto.
* src/main.c: Add jobserver-style as a new command line option.
(main): Add jobserver-fifo to .FEATURES if supported.  Pass the style
option to jobserver_setup().
* src/os.h (jobserver_setup): Accept a style string option.
* src/posixos.c (enum js_type): Enumeration of the jobserver style.
(js_type): Which style we are currently using.
(fifo_name): The path to the named pipe (if in use).
(jobserver_setup): If no style is given, or "fifo" is given, set up a
named pipe: get a temporary file and use mkfifo() on it, then open it
for reading and writing.  If something fails fall back to anonymous
pipes.
(jobserver_parse_auth): Parse jobserver-auth to determine the style.
If we are using a named pipe, open it.  If we're using anonymous pipes
ensure they're valid as before.
(jobserver_get_invalid_auth): Don't invalidate the jobserver when
using named pipes.
(jobserver_clear): Clean up memory used for named pipes.
(jobserver_acquire_all): Unlink the named pipe when done.
* src/w32/w32os.c (jobserver_setup): Check the style argument.
* tests/scripts/features/jobserver: Use --jobserver-style to test
the anonymous pipe behavior, and also test named pipe/semaphore
behavior.  Check invalid jobserver-style options.
* tests/scripts/functions/shell: Use --jobserver-style to test the
anonymous pipe behavior, and also test named pipe/semaphore
behavior.
2022-08-02 23:36:35 -04:00
Dmitry Goncharov
07eea3aa49 [SV 62706] Only second-expand targets that might be built
Second-expand only the prerequisites of the targets being built.
Defer second-expanding the prerequisites of targets until we need
to decide if they should be built.

* NEWS: Mention the change in behavior.
* doc/make.texi (Secondary Expansion): Document the new behavior.
* src/filedef.h (struct file): Add flag snapped.
(expand_deps): Declare a function to second expand the
prerequisites of a target.
* src/file.c (rehash_file): Merge flag snapped.
(expand_deps): Remove qualifier static. Check flag snapped.
(snap_deps): Remove the loop which performed second expansion for all
targets.
* src/remake.c (update_file_1): Second expand the prerequisites of
the considered target.
* tests/scripts/features/se_explicit: Add tests.
* tests/scripts/features/se_implicit: Ditto.
* tests/scripts/features/se_statpat: Ditto.
2022-07-30 18:40:28 -04:00