summaryrefslogtreecommitdiff
path: root/doc
Commit message (Collapse)AuthorAgeFilesLines
* [SV 63219] Support an "unload" function for loaded objectsPaul Smith2023-05-141-7/+71
| | | | | | | | | | | | | | | | | | | | 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.
* Remove the "preview" status from the loaded object featurePaul Smith2023-05-071-188/+197
| | | | | | | | | | | | | | | | 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.
* * doc/make.texi: Clean up function and variable referencesPaul Smith2023-04-021-41/+19
| | | | Avoid unnecessary extra remarks in the index and remove duplicates.
* Add support for .WARNINGS special variablePaul Smith2023-04-021-44/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add new warnings invalid-var and invalid-refPaul Smith2023-04-012-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Introduce a --warn command line optionPaul Smith2023-04-012-7/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* GNU Make release 4.4.14.4.1Paul Smith2023-02-262-8/+5
| | | | | | | | * 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.
* * doc/make.texi: Fix typo (reported by <mao492479407@163.com>)Paul Smith2023-02-051-1/+1
|
* * doc/make.texi: [SV 63689] Fix typos in examplesDmitry Goncharov2023-01-281-2/+2
|
* [SV 14927] Allow parallel builds for archivesPaul Smith2023-01-031-9/+32
| | | | | | | | | | | | | | 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.
* * doc/make.texi (Special Targets): Fix minor typoPaul Smith2023-01-021-1/+1
| | | | Reported by Andrey Melnikov <vafilor@gmail.com>.
* Convert references from "GNU make" to "GNU Make"Paul Smith2023-01-012-9/+9
|
* Update the copyright year on all filesPaul Smith2023-01-013-3/+3
|
* [SV 63537] Document and test flippable switchesDmitry Goncharov2022-12-181-4/+6
| | | | | | | | | | | | | | | | | | * 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.
* [SV 63516] [DOS] Support include files with drivespecsPaul Smith2022-12-181-11/+8
| | | | | | | | | * 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.
* * doc/make.texi: Use $(firstword) rather than $(word 1,)Paul Smith2022-11-281-1/+1
|
* Release GNU Make 4.44.4Paul Smith2022-10-311-1/+1
| | | | | | * NEWS: Update the version and date. * configure.ac: Update the version. * doc/make.texi: Update the EDITION.
* Update URLs to use https rather than httpPaul Smith2022-10-181-1/+1
| | | | | * (all): Change http:// to https:// * README.W32: Remove invalid link to mingw.org.
* [SV 63098] Temporarily revert the change to pattern rule behaviorPaul Smith2022-10-021-0/+9
| | | | | | | | | | | | | | | | | | | | 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.
* * doc/make.texi (Prerequisite Types): [SV 58056] Clarify ordering.Paul Smith2022-10-021-15/+14
|
* * doc/make.texi (Loaded Object API): [SV 63126] Fix typos and examplesDmitry Goncharov2022-10-011-7/+9
|
* * doc/make.texi: Update out of date behavior for grouped targets.Paul Smith2022-09-251-15/+15
|
* * doc/make.texi (Parallel Disable): Add clarifications.Paul Smith2022-09-131-4/+5
| | | | * NEWS: Suggest how to change makefiles that use $(MAKEFLAGS).
* [SV 13862] Implement the .WAIT special targetPaul Smith2022-09-121-15/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * doc/make.texi (How Make Works): Clarify default goal exceptions.Paul Smith2022-09-111-16/+14
|
* Support the MAKE_TMPDIR environment variablePaul Smith2022-09-111-2/+32
| | | | | | | | | | | 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.
* [SV 62898] Document ways to hide special chars from make functionsPaul Smith2022-09-101-24/+42
| | | | | * doc/make.texi (Function Call Syntax): Add a subsubheading describing which special characters may need to be hidden from make functions.
* Enhance the make.texi formattingPaul Smith2022-09-101-161/+159
| | | | | | | 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.
* [SV 63040] shell: Fall back to the callers environmentPaul Smith2022-09-101-16/+28
| | | | | | | | | | | | | | | | | | | 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.
* * doc/make.texi (Variables/Recursion): [SV 56446] Clarify export docsPaul Smith2022-08-141-30/+36
|
* * doc/make.texi (Goals): [SV 51306] Improve MAKECMDGOALS examplePaul Smith2022-08-071-1/+1
|
* * doc/make.texi (Remaking Makefiles): [SV 61623] Add optimizationDmitry Goncharov2022-08-071-1/+15
|
* * doc/make.texi (Chained Rules): [SV 61957] Clarify NOTINTERMEDIATEPaul Smith2022-08-031-12/+15
|
* [SV 62496] Fix example of testing MAKEFLAGSPaul Smith2022-08-031-5/+18
| | | | | * doc/make.texi (Options/Recursion): Define the layout of MAKEFLAGS. (Testing Flags): Fix the example to test the first word.
* Support implementing the jobserver using named pipesPaul Smith2022-08-022-56/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [SV 62706] Only second-expand targets that might be builtDmitry Goncharov2022-07-301-12/+10
| | | | | | | | | | | | | | | | | | | | | 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.
* [SV 10593] Export variables to $(shell ...) commandsPaul Smith2022-07-091-0/+17
| | | | | | | | | | | | | | | | | | | | | | Export all variables, including exported makefile variables, when invoking a shell for the $(shell ...) function. If we detect a recursive variable expansion, silently ignore that variable and do not export it. We do print a debug message. * NEWS: Announce the potential backward-incompatibility. * doc/make.texi (Shell Function): Document the export behavior. * src/main.c (main): Add "shell-export" to .FEATURES. * src/job.h: New function to free struct childbase. * src/job.c (free_childbase): Implement it; call from free_child. * src/function.c (func_shell_base): Use target_environment() to obtain the proper environment for the shell function. Use free_childbase() to free memory. (windows32_openpipe): Don't reset the environment: the caller already provided a proper PATH variable in envp. * src/variable.c (target_environment): If we detect a recursive expansion and we're called from func_shell, ignore the variable. (sync_Path_environment): Simplify and reduce memory allocation. * tests/scripts/functions/shell: Add tests for this.
* [SV 62100] Add '--shuffle' option supportSergei Trofimovich2022-06-042-1/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce non-deterministic ordering into goal and prerequisite traversal to help tease out inconsistent failures that may happen when running in parallel build mode. Introduce second order into each dependency chain: 1. Existing order is syntactic order reachable via 'dep->next' 2. New order is shuffled order stored as 'dep->shuf' in each 'dep' When updating goals and prerequisites and '--shuffle' is provided, use the shuffled order to walk the graph. When automatic variable are set always use the syntactic order of parameters. * Makefile.am: Add new src/shuffle.c and src/shuffle.h file. * build_w32.bat: Ditto. * builddos.bat: Ditto. * makefile.com: Ditto. * po/POTFILES.in: Ditto. * doc/make.texi: Add documentation for --shuffle. * doc/make.1: Ditto. * src/dep.h (DEP): Add the shuf pointer. * src/filedef.h (struct file): Add was_shuffled flag. * src/main.c: (shuffle_mode): Global flag for the shuffle mode. (usage): Add the --shuffle option. (switches): Ditto. (main): Set shuffle_mode based on the command line parameter. Reshuffle prerequisites if requested. * src/remake.c (update_goal_chain): Walk the shuffled list if enabled. (update_file_1): Ditto. * src/shuffle.h: Provide an interface for shuffling prerequisites. * src/shuffle.c: Implement option parsing and prerequisite shuffling. * tests/scripts/options/shuffle: Test shuffle option and modes.
* * <all>: Update copyright notices.Paul Smith2022-02-103-3/+3
|
* * doc/make.1: Use "target" from the SYNOPSIS.Paul Smith2022-02-061-3/+3
| | | | Reported by Helge Kreutzmann <debian@helgefjell.de>
* * doc/make.texi (Using One Shell): Correct example to use $<.Paul Smith2022-02-061-2/+2
|
* [SV 61226] Revert changes to detect missing included filesPaul Smith2022-01-171-7/+7
| | | | | | | | | | | | | | | | | The fix for SV 60595 introduced a backward-incompatibility: rules that purported to rebuild included files, but didn't actually do so, were treated as errors whereas before they were ignored. This breaks a common idiom in makefiles where an empty recipe is created for an included makefile so make doesn't complain if it doesn't exist. Unfortunately this means make cannot diagnose some types of errors. Extra tests supplied by Dmitry Goncharov <dgoncharov@users.sf.net>. * doc/make.texi (Including Other Makefiles): Clarify this behavior. * src/main.c (main): Don't run the new check-for-errors behavior. * tests/scripts/features/reinvoke: Reset tests of the "old" behavior and add new tests for this situation.
* Update documentation with instructions for patch submissionPaul Smith2021-12-191-0/+3
| | | | | | * README.template: Add notes on how to submit patches. * README.git: Point to the README. * doc/make.texi: Ditto.
* Change HTTP URLs to use HTTPS insteadPaul Smith2021-12-192-2/+2
| | | | | | | | | | | Also remove unnecessary tests/COPYING file. * README.template: Change http: to https: * README.git: Ditto * doc/make.texi: Ditto * doc/make.1: Ditto * src/main.c: Ditto * maintMakefile: Remove invalid URL
* * doc/make.text (Wildcards): Document that glob results are sorted.Paul Smith2021-12-191-0/+12
|
* Introduce $(intcmp ...) for numerical comparisonJouke Witteveen2021-11-281-1/+37
| | | | | | | | | | | | Numbers can come from $(words ...), automatic variables such as $(MAKELEVEL), from environment variables, or from shell output such as through $(shell expr ...). The $(intcmp ...) function allows conditional evaluation controlled by numerical variables. * NEWS: Announce this feature. * doc/make.texi (Functions for Conditionals): Document 'intcmp'. * src/function.c (func_intcmp): Create the 'intcmp' built-in function. * tests/scripts/functions/intcmp: Test the 'intcmp' built-in function.
* [SV 48643] Update the implicit rule search docsPaul Smith2021-11-271-2/+9
| | | | | | * NEWS: Announce the change. * doc/make.texi (Implicit Rule Search): Update the definition of "ought to exist" and add the extra step for compatibility mode.
* * doc/make.texi (Special Targets): [SV 61122] Add .SECONDARY exampleDmitry Goncharov2021-10-171-0/+24
|
* Add support for the POSIX :::= assignment operator.Paul Smith2021-09-201-61/+166
| | | | | | | | | | | | | | | | | | | | | | | | POSIX Issue 8 will require a new assignment operator, :::=. This operator behaves similarly to the BSD make := operator: the right-hand side is expanded immediately, but then the value is re-escaped (all '$' are converted to '$$') and the resulting variable is considered a recursive variable: the value is re-expanded on use. * src/variable.h (enum variable_flavor): Add f_expand flavor. * src/variable.c (do_variable_definition): When defining f_expand, post-process the result to re-escape '$' characters. Remove default: to the compiler warns about un-handled enum values. Set recursive values for both f_recursive and f_expand. (parse_variable_definition): Rewrite this method. The previous version was annoying to extend to ':::='. (print_variable): Remove default: so the compiler warns us about un-handled enum values. * src/function.c (func_origin): Remove default: so the compiler warns us about un-handled enum values. * doc/make.texi: Add documentation for :::=. * tests/scripts/variables/define: Add a test for define :::=. * tests/scripts/variables/flavors: Add tests for :::=. * tests/scripts/variables/negative: Add tests for :::=.
* [SV 60435] Ensure intermediate grouped files are removedDmitry Goncharov2021-09-071-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | If multiple intermediate files are built together be sure all of them are removed after make is finished. Continue to ensure that targets that exist before make starts are not removed even if they appear to be intermediate. Add a number of tests to pattern rules to verify this behavior. * src/filedef.h (struct file): Add a new is_explicit bitfield. * src/file.c (rehash_file): Merge the is_explicit bit. (enter_prereqs): Set is_explicit if the file is explicitly mentioned. * src/implicit.c (pattern_search): Set intermediate on the file if it's not explicit. (record_files): Set is_explicit if a file is mentioned as a target. * src/remake.c (update_file_1): Set secondary on files that already exist so they won't be removed. * tests/scripts/features/double_colon: Add a test for double-colon pattern rules. * tests/scripts/features/patternrules: Update KGO for tests where more files are removed. Add new tests to verify handling removal of intermediate files in the context of grouped pattern targets.