summaryrefslogtreecommitdiff
path: root/src/rule.c
Commit message (Collapse)AuthorAgeFilesLines
* Adjust output strings to be alignedPaul Smith2023-04-021-1/+1
| | | | | | | | Change error and fatal messages to start with lowercase and not end with a period. Note a few very common messages were left as-is, just in case some other tools parse them. Also modify the test known-good-output to satisfy the messages.
* Rename VMS macro to MK_OS_VMSPaul Smith2023-01-151-2/+2
| | | | | | * src/makeint.h: Set MK_OS_VMS to 1 if we're on VMS. * src/*: Convert all #if references to VMS, to use MK_OS_VMS. * gl/lib/*: Ditto.
* Convert references from "GNU make" to "GNU Make"Paul Smith2023-01-011-1/+1
|
* Update the copyright year on all filesPaul Smith2023-01-011-1/+1
|
* * src/rule.c (get_rule_defn): Don't use STRING_SIZE_TUPLE in mempcpyPaul Smith2022-10-231-2/+2
| | | | If mempcpy() is a macro then STRING_SIZE_TUPLE won't compile.
* 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 13862] Implement the .WAIT special targetPaul Smith2022-09-121-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [SV 62206] Fix %-substitution in second expansion of pattern rulesDmitry Goncharov2022-04-241-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | During second expansion of pattern rules only the first pattern in each "group" was being substituted. E.g. in this makefile: .SECONDEXPANSION: all: hello.x %.x: $$(wordlist 1, 99, %.1 %.%.2) ; $(info $@ from $^) hello.1 hello.\%.2 \%.1 \%.\%.2: ; the output would build "hello.1" and "%.%.2" because each function is considered a single "word" and only the first pattern is replaced. Fix the expansion so each whitespace-separated string is considered a word and the first pattern is replaced, giving "hello.1" and "hello.%.2". * src/rule.c (snap_implicit_rules): Keep enough space to replace % with $(*F) if necessary. * src/implicit.c (pattern_search): During second expansion break each get_next_word result into individual words and replace the first % in each with $* or $(*F) as needed. * tests/scripts/features/patternrules: Add tests for variations.
* * <all>: Update copyright notices.Paul Smith2022-02-101-1/+1
|
* [SV 61042] Enhance logging of implicit rule searchDmitry Goncharov2021-10-181-11/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logging of implicit rule search gives limited information as to why a given implicit rule was rejected, and if no implicit rule is found we get the confusing "No rule to make target" result when the real issue is that some prerequisite of some implicit rule could not be built. Enhance logging around implicit rule search as follows: 1. The messages which refer to a rule print a description (the targets and prerequisites) of the rule. 2. A new message tells when a rule is rejected, along with the reason. 3. The 'Looking for an implicit rule...' message is printed for every prerequisite, not just the top-level target. 4. "Trying harder" message is printed, when intermediate prerequisites are going to be searched. 5. The 'No rule found...' and 'Found implicit rule...' messages are printed for every prerequisite, not just the top-level target. 6. "Ought to exist...", "Found..." or "Not found..." message is printed for each prerequisite. * src/rule.h (struct rule): Remember the definition of the rule. * src/rule.c (get_rule_defn): Compute the definition of a rule. (install_pattern_rule): Initialize the definition to empty. (create_pattern_rule): Ditto. (freerule): Free the definition. (print_rule): Use the definition when printing rules. * src/remake.c (update_file_1): Push debug output down into try_implicit_rule(). * src/implicit.c (try_implicit_rule): Add debugging (pattern_search): Show the rule definition in various debug output. Add new debug messages for implicit rule search. Additional changes by Paul Smith <psmith@gnu.org>: Since we usually don't need the rule definition, defer computing it until we do. * bootstrap.conf: Include the mempcpy Gnulib module. * src/makeint.h (mempcpy): Declare mempcpy if not available. * src/misc.c (mempcpy): Define mempcpy if not available. * src/config.h-vms.template: Don't set HAVE_MEMPCPY. * src/config.h.W32.template: Ditto. * src/rule.h (get_rule_defn): Return the definition of a rule. * src/rule.c (get_rule_defn): If we don't have a definition compute it; either way return it. * src/implicit.c (pattern_search): Rework the handling of explicit prerequisites to pattern rules to be more clear. There is no change in behavior.
* [SV 40657] Reinstate old behavior for suffix rules with prereqsPaul Smith2020-01-191-3/+15
| | | | | | | | | | | | | | | | | POSIX says that suffix rules cannot have prerequisites, but after making this change we observed a number of makefiles "in the wild" that were relying on this behavior and failed. For .POSIX: makefiles, obey POSIX. Otherwise preserve the old behavior. However, generate a warning so users know this is a problem. In a future version we will change all behavior to be POSIX-conforming. * NEWS: describe the change * src/rule.c (convert_to_pattern): If posix_pedantic don't make a pattern rule if prereqs exist. Otherwise show a warning. * tests/scripts/features/suffixrules: Add tests for the new behavior including .POSIX vs. non-.POSIX.
* Enable compilation with C90 compilersPaul Smith2020-01-041-4/+6
| | | | | | | | | | | | | * configure.ac: Try compiling Guile headers: they don't work with C90. * maintMakefile: Simplify config checks via target-specific variables. * src/makeint.h: Use ATTRIBUTE rather than defining __attribute__, as that causes compile issues with system headers. (ENUM_BITFIELD): Don't use enum bitfields in ANSI mode. * src/main.c: Use ATTRIBUTE instead of __attribute__. * src/job.h: Ditto. * src/file.c: Don't define variables inside for loops. * src/rule.c: Ditto. * src/dep.h (SI): Only use static inline in non-ANSI mode.
* Update copyright statements for 2020Paul Smith2020-01-031-1/+1
|
* Support the .EXTRA_PREREQS special variablePaul Smith2020-01-031-22/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial implementation by Christof Warlich <cwarlich@gmx.de> * NEWS: Announce the new feature. * doc/make.texi (Other Special Variables): Document .EXTRA_PREREQS. * src/dep.h (struct dep): New flag to note extra prereq deps. * src/filedef.h (expand_extra_prereqs): Declare a function to expand the value of .EXTRA_PREREQS. * src/file.c (expand_extra_prereqs): Given a struct variable lookup of .EXTRA_PREREQS, convert it into a list of deps and for each one make sure it has a struct file and has the new flag set. (snap_file): A new function invoked by hash_map that will perform per-file operations: set up second expansion, intermediate, and also .EXTRA_PREREQS. Manage circular dependencies by ignoring them. (snap_deps): Defer per-file operations until the end. Look up the global .EXTRA_PREREQS and pass it along to snap_file for each file. * src/implicit.c (struct patdeps): Remember the extra prereqs flag. (pattern_search): Transfer extra prereqs flag settings into the matched pattern rule. * src/rule.h (snap_implicit_rules): Rename count_implicit_rules to snap_implicit_rules since we now do more than count. * src/rule.c (snap_implicit_rules): As we walk through all the pattern rules, add in any global .EXTRA_PREREQS to the dep list. Ensure we take them into account for the max number of prereqs and name length. * src/main.c (main): Add extra-prereqs to .FEATURES. Call the renamed snap_implicit_rules. * tests/scripts/variables/EXTRA_PREREQS: Add tests.
* Update copyright statements for 2019Paul Smith2019-05-191-1/+1
|
* [SV 40657] Don't create pattern rules for suffix rules with deps.Paul Smith2018-09-151-1/+4
| | | | | | | | | * NEWS: Update with a backward-compatibility warning. * src/rule.c (convert_to_pattern): If a suffix rule has dependencies, do not create a pattern rule for it. According to the manual suffix rules with prerequisites are treated as normal targets. * tests/scrips/features/suffixrules: Create some regression tests for .SUFFIXES and suffix rules.
* Resolve most of the Windows Visual Studio warnings.Paul Smith2018-07-021-15/+15
| | | | | * Convert integer types to size_t where necessary. * Align other integral types to avoid casts and type warnings.
* * all: Update Copyright statements for 2018Paul Smith2018-07-011-1/+1
|
* Rework directory structure to use GNU-recommended "src" directory.Paul Smith2017-11-191-0/+526
Move the source code (other than glob) into the "src" subdirectory. Update all scripting and recommendations to support this change. * *.c, *.h, w32/*: Move to src/ * configure.ac, Makefile.am, maintMakefile: Locate new source files. * Basic.mk.template, mk/*: Update for new source file locations. * NEWS, README.DOS.template: Update for new locations. * build.template, build_w32.bat, builddos.bat: Ditto. * po/POTFILES.in: Ditto * tests/run_make_tests.pl, tests/scripts/features/load*: Ditto. * make.1: Move to doc. * mk/VMS.mk: Add support for building on VMS (hopefully). * makefile.vms, prepare_w32.bat: Remove. * SCOPTIONS: Update to define HAVE_CONFIG_H