Imported Upstream version 4.4
[platform/upstream/make.git] / ChangeLog
1 2022-10-31  Paul Smith  <psmith@gnu.org>
2
3         Release GNU Make 4.4
4         * NEWS: Update the version and date.
5         * configure.ac: Update the version.
6         * doc/make.texi: Update the EDITION.
7
8         * README.git: Update and clarify release operations
9
10         Fix issues found by ASAN and Coverity
11         * tests/test_driver.pl: Preserve the LSAN_OPTIONS variable.
12         * tests/scripts/targets/ONESHELL: Don't set a local variable.
13         * tests/scripts/functions/let: Test empty let variable.
14         * src/posixos.c (osync_parse_mutex): Free existing osync_tmpfile.
15         * src/misc.c (get_tmpfd): Set umask() before invoking mkstemp().
16         * src/ar.c (ar_parse_name): Check invalid name (shouldn't happen).
17         * src/function.c (define_new_function): Free previous function entry
18         when replacing it with a new one.
19         * src/job.c (child_execute_job): Initialize pid for safety.
20         (construct_command_argv_internal): In oneshell mode ensure that the
21         returned argv has the right format (0th element is a pointer to the
22         entire buffer).
23
24 2022-10-29  Paul Smith  <psmith@gnu.org>
25
26         Avoid C99 constructs
27         Although gnulib requires C99, most of the code does compile with a
28         C90 compiler (perhaps with a lot of warnings).  Reinstate our C90
29         configuration test, and clean up a few C99 things that crept in.
30
31         * src/job.c (construct_command_argv_internal): Don't use loop-local
32         variables or C++ comments.
33         * src/read.c (eval_makefile): Don't use loop-local variables.
34
35 2022-10-29  Paul Smith  <psmith@gnu.org>
36
37         * build.sh: Allow a "keep-going" mode during builds
38
39 2022-10-29  Paul Smith  <psmith@gnu.org>
40
41         tests: Avoid the use of File::Temp->newdir()
42         This was added in Perl 5.8 but some systems still only provide older
43         versions such as Perl 5.6.  We don't really need it anyway.
44         Paul Eggert <eggert@cs.ucla.edu> reported this issue.
45
46         * tests/README: Update this to be a bit more modern.
47         * tests/test_driver.pl: Delete the $TEMPDIR variable.
48         * tests/scripts/features/temp_stdin: Use $temppath not $TEMPDIR.
49
50 2022-10-29  Paul Smith  <psmith@gnu.org>
51
52         * src/posixos.c (os_anontmp): [SV 63287] Only fail O_TMPFILE once
53         Reported by Dmitry Goncharov <dgoncharov@users.sf.net>.
54
55 2022-10-28  Paul Smith  <psmith@gnu.org>
56
57         [SV 62174] Force locale to be "C" before retrieving error messages
58         We attempt to do this with POSIX::setlocale() but apparently on some
59         systems (AIX) this isn't sufficient.  So, in addition force the LC
60         environment variables to use "C".
61         Reported by Dmitry Goncharov <dgoncharov@users.sf.net>.
62
63         * tests/run_make_tests.pl: Move the global setup into set_default().
64         Force the %ENV locale variables to use the ones we'll use when running
65         make, then reset them back again after we find error messages.
66
67 2022-10-27  Paul Smith  <psmith@gnu.org>
68
69         * src/job.c: [SV 63185] Don't use ifdef with HAVE_DECL_* macros
70
71 2022-10-25  Paul Smith  <psmith@gnu.org>
72
73         * tests/scripts/features/exec: Don't test with C shells
74         Using C shells (csh, tcsh) with make is known to be problematic due
75         to incorrect ways it handles open file descriptors, at least.  If
76         the user's shell is *csh then don't try it during exec tests.
77
78 2022-10-25  Paul Smith  <psmith@gnu.org>
79
80         Increase the test framework timeout from 5s to 60s
81         It seems that some of the test environments hit the 5s timeout on
82         some tests.  Since it doesn't really matter, as long as we don't
83         hang forever, increase the timeout to 60s.
84
85         * tests/test_driver.pl: Increase $test_timout to 60.  We don't need
86         to handle VMS timeouts specially anymore.
87         * tests/scripts/features/parallelism: We don't need to override the
88         default timeout anymore.
89         * tests/scripts/features/patternrules: Remove confusing comment.
90
91 2022-10-25  Paul Smith  <psmith@gnu.org>
92
93         * Makefile.am (check-regression): Add a random suffix to results file
94         Put the results into a subdirectory for easy unpacking.
95         * .gitignore: Ignore it.
96
97 2022-10-24  Paul Smith  <psmith@gnu.org>
98
99         Release GNU Make 4.3.92
100         * configure.ac: Modify the release version.
101         * NEWS: Update the version and date.
102
103 2022-10-24  Paul Smith  <psmith@gnu.org>
104
105         [SV 63260] Don't recurse forever if setup_tmpfile() fails
106         If we fail during setup_tmpfile() we'll try to write an error, which
107         will invoke setup_tmpfile() again, etc.  Avoid infinite recursion.
108         Original patch by Dmitry Goncharov <dgoncharov@users.sf.net>
109
110         * src/output.c (setup_tmpfile): Remember we're in this function and
111         return immediately if we enter it during recursion.
112         (message): Remember the starting location and use that instead of
113         fmtbuf.buffer.
114         (error): Ditto.
115         (fatal): Ditto.
116
117 2022-10-24  Paul Smith  <psmith@gnu.org>
118
119         * src/output.c (_outputs): Don't use invalid output sync FDs
120         Just write to stdout/stderr in this situation.
121
122         * src/misc.c (get_tmpdir): Report errors if tmpdirs are invalid
123         * src/main.c (main): Set up initial temporary directories.
124
125 2022-10-23  Dmitry Goncharov  <dgoncharov@users.sf.net>
126
127         * src/posixos.c (os_anontmp): If O_TMPFILE fails try dup() method.
128
129 2022-10-23  Paul Smith  <psmith@gnu.org>
130
131         * src/rule.c (get_rule_defn): Don't use STRING_SIZE_TUPLE in mempcpy
132         If mempcpy() is a macro then STRING_SIZE_TUPLE won't compile.
133
134 2022-10-23  Paul Smith  <psmith@gnu.org>
135
136         Provide a maintainer-only debug method
137         Generating debug logs to stdout or stderr makes it impossible to
138         run tests etc. so create a dumb DBG facility to log to a temp file.
139         This exists only in maintainer mode and the DBG macro gives a
140         compile error if it's used in non-maintainer mode.
141
142         * src/makeint.h (DBG): Call dbg() in maintainer mode, else error.
143         (dbg): Define it in maintainer mode.
144         * src/misc.c (dbg): Open a log file for append, write, then close.
145
146 2022-10-22  Paul Smith  <psmith@gnu.org>
147
148         * configure.ac: Check that we can link with Guile
149         On multi-arch systems we may be able to find the header file but
150         not successfully link the library.
151
152 2022-10-22  Paul Smith  <psmith@gnu.org>
153
154         Set PATH_MAX on systems without a default value
155         Some systems (HURD) use fully-dynamic pathnames, with no limit.
156         We can't support this without significant effort so for now set
157         PATH_MAX to a large value.
158
159         * src/makeint.h: Set PATH_MAX to 4096 if not set and MAXPATHLEN
160         is also not set.  Remove MAXPATHLEN setting: we won't use it.
161         * src/misc.c (get_path_max): If we can't get the path max via
162         pathconf() use the default PATH_MAX.
163         * src/dir.c (find_directory) [W32]: Use MAX_PATH not MAXPATHLEN.
164         (local_stat) [W32]: Ditto.
165         * src/job.c (create_batch_file) [W32]: Ditto.
166         * src/remake.c (name_mtime) [W32]: Ditto.
167         * src/w32/w32os.c (os_anontmp) [W32]: Ditto.
168
169 2022-10-22  Paul Smith  <psmith@gnu.org>
170
171         [SV 63098] Enhance detection of missing peer also-make targets
172         The previous attempt to detect missing peer targets for implicit
173         rules had some holes.  Move the detection to notice_finished_file().
174
175         * src/remake.c (check_also_make): If we don't have the current mtime
176         for the file, obtain it.
177         (update_goal_chain): Don't call check_also_make() here.
178         (check_dep): Ditto.
179         (notice_finished_file): If we finished running an implicit rule that
180         has also_make targets, invoke check_also_make().
181
182 2022-10-22  Paul Smith  <psmith@gnu.org>
183
184         Collect failure details when the regression tests fail
185         * README.in: Add a section on running regression tests.
186         * Makefile.am (check-regression): Capture the test run output, and
187         on failure collect configure and test results into a tar file.
188
189 2022-10-22  Paul Smith  <psmith@gnu.org>
190
191         Enhance tests to work on different systems
192         The GNU platform testers reported a number of test errors on
193         different systems; try to address them.
194
195         * tests/thelp.pl: A number of tests timed out with a 4-second
196         timeout.  Increase the default timeout to 10 seconds.
197         * tests/run_make_tests.pl: Executing directories on cygwin behaves
198         differently in Perl than make so skip these tests there.
199         * tests/scripts/options/symlinks: Check for the symlink feature
200         in make, rather than whether the system supports them.
201         * tests/scripts/features/implicit_search: On some systems "false"
202         exits with a different exit code.  Use the helper instead.
203         * tests/scripts/features/loadapi: Ditto.
204         * tests/scripts/features/output-sync: Sleep before make -f bar in
205         the first test as well as the second one.
206         * tests/scripts/features/exec: Skip on cygwin, which seems to
207         be "UNIX" but where scripts don't run normally.
208         * tests/scripts/misc/fopen-fail: Skip on cygwin, where make
209         eventually exits with exit code 0 and no error messages.
210
211 2022-10-22  Dmitry Goncharov  <dgoncharov@users.sf.net>
212
213         [SV 63243] tests: Avoid SIGTERM racing with make error messages
214         Original patch from Frank Heckenbach <f.heckenbach@fh-soft.de>.
215
216         * tests/scripts/features/output-sync: Introduce a sleep to let make
217         write its error message.  Some systems use different names for
218         SIGTERM so match with a regex.
219         * tests/scripts/features/temp_stdin: Ditto.
220
221 2022-10-22  Dmitry Goncharov  <dgoncharov@users.sf.net>
222
223         [SV 63236] Fix getloadavg related error message on AIX
224         On AIX getloadavg keeps errno intact when it fails, resulting in a
225         bogus error message from make.
226
227         * src/job.c (load_too_high): Reset errno before calling getloadavg.
228
229 2022-10-22  Dmitry Goncharov  <dgoncharov@users.sf.net>
230
231         [SV 63248] Ignore SIGPIPE
232         Don't terminate when make's output is redirected to a pipe and the
233         reader exits early; e.g.:
234           $ echo 'all:; sleep 2' | make -f- -j2 -O |:
235
236         This lets us unlink temporary files, and tell the user that make was
237         not able to write its output.
238         Reported by Frank Heckenbach <f.heckenbach@fh-soft.de>.
239
240         * src/main.c (main): Ignore SIGPIPE.
241         * src/posixos.c (osync_clear): Fix a memory leak.
242
243 2022-10-18  Paul Smith  <psmith@gnu.org>
244
245         * NEWS: Release GNU make 4.3.91
246
247         * AUTHORS: Update the authors list.
248
249         * NEWS: Use GNU Make instead of GNU make
250         * README.git: Ditto.
251         * README.Amiga: Ditto.
252         * README.DOS: Ditto.
253         * README.OS2: Ditto.
254         * README.VMS: Ditto.
255         * README.W32: Ditto.
256         * README.customs: Ditto.
257         * make-gdb.py: Ditto.
258         * tests/run_make_tests.pl: Ditto.
259
260         Update URLs to use https rather than http
261         * (all): Change http:// to https://
262         * README.W32: Remove invalid link to mingw.org.
263
264 2022-10-18  Paul Smith  <psmith@gnu.org>
265
266         Rework temp file handling to avoid GNU libc warnings
267         Original patch provided by Paul Eggert <eggert@cs.ucla.edu>.
268         GNU libc will generate a link-time warning if we use mktemp() even
269         though we are using it safely (we only use it with mkfifo()).
270         Avoid this and clean up some handling.
271
272         First, check all calls related to temporary files and exit with a
273         fatal error and a useful message if we can't obtain them.  In some
274         situations it might be possible to continue with reduced capability
275         but it's not worth the effort.
276
277         On POSIX systems we can create anonymous temp files using O_TMPFILE
278         if it's supported, else if we're using the default location and we
279         have dup(2), we can use standard tmpfile() and get an FD from it.
280
281         If we need a named temp file and FILE* and we have mkstemp() we can
282         use that, else if we have fdopen() we can get a temp FD and open it.
283         If none of those are available all we can do is generate a temp name
284         then open it with fopen() which is not secure.
285
286         * src/makeint.h (get_tmpdir): Declare it for use elsewhere.
287         * src/misc.c (get_tmpdir): Make it public not static.
288         (get_tmptemplate): Simplify the implementation.
289         (get_tmppath): Only define this if we have to have it to avoid
290         warnings from GNU libc.
291         (get_tmpfd): Generate fatal errors on error.
292         (get_tmpfile): Ditto.  Open files in "wb+" mode to match tmpfile().
293         Require a filename pointer (all callers want it).
294         * src/os.h (os_anontmp): Implement for posixos.c as well.
295         * src/posix.c (jobserver_setup): Don't use mktemp to avoid GNU libc
296         errors.  Instead construct the FIFO name based on the PID.
297         (osync_setup): get_tmpfd() can't fail so don't check it.
298         (os_anontmp): If the system supports O_TMPFILE use it.  If not, and
299         we want to create the temporary file in the default directory, we
300         can use tmpfile() then use dup() to copy the file descriptor.
301         * src/main.c (main): get_tmpfile() can't fail.
302         * src/vmsjobs.c (child_execute_job): get_tmpfile() can't fail.
303
304 2022-10-18  Paul Smith  <psmith@gnu.org>
305
306         Add ISDIRSEP() helper macro and use it
307         Create a ISDIRSEP() macro to check for directory separator chars
308         using the stopchar_map, and replace inline checks and explicit
309         STOP_SET calls with this macro.
310
311         * src/makeint.h (ISDIRSEP): Create the macro using MAP_DIRSEP.
312         * src/dir.c (find_directory): Replace inline checks with ISDIRSEP.
313         (file_exists_p): Ditto.
314         (file_impossible): Ditto.
315         (file_impossible_p): Ditto.
316         (local_stat): Ditto.
317         * src/file.c (lookup_file): Ditto.
318         * src/function.c (abspath): Ditto.
319         * src/job.c (_is_unixy_shell): Ditto.
320         (is_bourne_compatible_shell): Ditto.
321         (construct_command_argv): Ditto.
322         * src/main.c (find_and_set_default_shell): Ditto.
323         (main): Ditto.
324         * src/read.c (eval): Ditto.
325         (parse_file_seq): Ditto.
326         * src/remake.c (name_mtime): Ditto.
327         * src/vpath.c (construct_vpath_list): Ditto.
328
329 2022-10-18  Paul Smith  <psmith@gnu.org>
330
331         Add preprocessor macros for different platforms
332         * configure.ac: MK_CONFIGURE shows config.h was generated by configure.
333         * src/config.ami: Define MK_AMIGAOS.
334         * src/config.h-vms: Define MK_VMS.
335         * src/configh.dos: Define MK_DJGPP.
336         * src/config.h.W32: Define MK_W32 and WINDOWS32.
337         * src/build_w32.bat: Let WINDOWS32 be defined by config.h.  Remove
338         unused setting of WIN32.
339         * src/job.c: Clean up use of WIN32.
340         * src/main.c: Ditto.
341         * tests/scripts/features/default_names: Ditto.
342
343 2022-10-18  Paul Smith  <psmith@gnu.org>
344
345         Check for recipe line count overflow before it overflows
346         awk 'BEGIN {
347                print "x:"
348                for (i = 0; i < 65536; i++)
349                  printf "\techo %d\n", i}
350             ' | make -f -
351
352         Outputs only "make: 'x' is up to date."  Larger values run only the
353         lines above 65536.  Reported by Paul Eggert <eggert@cs.ucla.edu>.
354
355         * src/commands.c (chop_commands): Check the line count before it has
356         a chance to overflow.  Use size_t for max count so it can't overflow.
357         Remove stray 'd' in diagnostic.
358
359 2022-10-18  Paul Smith  <psmith@gnu.org>
360
361         Remove template files to simplify distribution creation
362         The README templates were not useful since the replacement step
363         didn't have anything to replace: rename them.
364
365         Rather than creating template files for the config variants, create
366         mkconfig.h.in containg PACKAGE_* variables to be replaced, and have
367         config variant header files include it.  Note on POSIX we don't use
368         this, and continue to generate a single config.h.in file.
369
370         Use config.status to convert the README.in and mkconfig.h.in files
371         during distribution creation.
372
373         Modify all users of VERSION to use PACKAGE_VERSION instead.
374
375         * configure.ac: Use GNU Make not GNU make as the package name.
376         * README.in: Use GNU Make not GNU make.
377         * README.git: Remove references to README.W32.template.
378         * .gitignore: Update for new behavior.
379         * Basic.mk.template: Remove unused posix_SOURCES and VERSION, and
380         references to unshipped mk/Posix.mk
381         * Makefile.am: Add src/mkconfig.h as an extra dist file.
382         * bootstrap.bat: Rewrite mkconfig.h.in to mkconfig.h
383         * maintMakefile: Remove obsolete template files; add mkconfig.h.in.
384         * prepare_vms.com: Rewrite mkconfig.h.in to mkconfig.h
385         * mk/VMS.mk: Fix incorrect header file prerequisite.
386         * src/mkconfig.h.in: New file containing PACKAGE variables.
387         * src/config.ami: Include mkconfig.h.
388         * src/config.h.W32: Ditto.
389         * src/configh.dos: Ditto.
390         * src/config.h-vms: Ditto.
391         * src/version.c: Use PACKAGE_VERSION not VERSION.
392
393 2022-10-16  Juan M. Guerrero  <juan.guerrero@gmx.de>
394
395         Support building with DJGPP 2.05
396         * builddos.bat: Use env var settings for paths.  Fix a typo in
397         expand.o.  Add the missing load.o compilation and link.  Enable
398         Guile support.  Copy Basic.mk from the correct location.
399         * src/configh.dos.templage: DJGPP supports strtoll() and ssize_t
400         given new enough versions.  Set preprocessor variables to 1 not 0.
401
402 2022-10-16  Paul Smith  <psmith@gnu.org>
403
404         * src/job.c: [SV 63185] Include sys/loadavg.h if needed.
405
406 2022-10-16  Paul Smith  <psmith@gnu.org>
407
408         [SV 63215] Remember the random seed for shuffle mode
409         Basic fix provided by James Hilliard <james.hilliard1@gmail.com>.
410         Ensure we remember and propagate the random seed we generate during
411         shuffle mode.  Also add a debug statement displaying the seed.
412
413         * src/shuffle.c (shuffle_set_mode): Init and save the randoms seed.
414         * src/misc.c (make_rand): Code cleanups.
415         * src/main.c (main): Show a debug message containing the seed.
416
417 2022-10-15  Paul Smith  <psmith@gnu.org>
418
419         Use (void) rather than () in function declarations
420         In C, a function declaration with () allows any set of arguments.
421         Use (void) to mean "no arguments".
422
423         * src/dep.h: Switch () to (void) for functions with no arguments.
424         * src/makeint.h: Ditto.
425         * src/os.h: Ditto.
426         * src/shuffle.h: Ditto.
427         * src/variable.h: Ditto.
428
429 2022-10-15  Paul Smith  <psmith@gnu.org>
430
431         [SV 63157] Ensure temporary files are removed when signaled
432         Original patch from Dmitry Goncharov <dgoncharov@users.sf.net>.
433         When handling a fatal signal ensure the temporary files for
434         stdin and the jobserver fifo (if in use) are deleted.
435
436         * src/makeint.h (temp_stdin_unlink): Declare a new method.
437         * src/main.c (temp_stdin_unlink): Delete the stdin temporary file
438         if it exists.  If the unlink fails and we're not handling a signal
439         then show an error.
440         (main): Call temp_stdin_unlink() instead of unlinking by hand.
441         * src/commands.c (fatal_error_signal): Invoke cleanup methods if
442         we're handling a fatal signal.
443         * tests/scripts/features/output-sync: Test signal handling during
444         output sync and jobserver with FIFO.
445         * tests/scripts/features/temp_stdin: Test signal handling when
446         makefiles are read from stdin.
447
448 2022-10-15  Paul Smith  <psmith@gnu.org>
449
450         * src/posixos.c (job_root): Remember root jobserver instances
451         (jobserver_setup): Set job_root to true.
452         (jobserver_clear): if we're the root instance and we're using a
453         FIFO, unlink it.  If we're not in a signal handler, free memory.
454         (jobserver_acquire_all): Call jobserver_clear().
455         (sync_root): Rename from sync_parent for consistency.
456
457         Set the proper type for variables set in signal handlers
458         * bootstrap.conf: Get gnulib's sig_atomic_t type checking M4 macro.
459         * configure.ac: Invoke it.
460         * src/makeint.h (handling_fatal_signal): Set the type correctly.
461         * src/commands.c (handling_fatal_signal): Ditto.
462
463 2022-10-08  Dmitry Goncharov  <dgoncharov@users.sf.net>
464
465         * tests/test_driver.pl (toplevel): [SV 63156] Keep temp env vars
466
467 2022-10-03  Paul Smith  <psmith@gnu.org>
468
469         Clean up some warnings on Windows builds
470         * src/arscan.c (parse_int): Avoid conversion from int to char and
471         check for overflow given a max value.
472         (ar_scan): Check intmax sizes then cast to the proper type.
473         (ar_member_touch): Get proper return type from ar_scan and cast it
474         to off_t.
475         * src/function.c (a_word_hash_cmp): Don't cast from size_t to int.
476         (func_filter_filterout): Count using unsigned long to avoid casts.
477         (construct_include_path): Explicitly cast to void*.
478         * src/shuffle.c (reverse_shuffle_array): Use size_t index.
479         * src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects):
480         Initialize the return value in case the count is 0.
481
482         * src/misc.c (make_lltoa): Use printf format macro from makeint.h
483         (make_ulltoa): Ditto.
484
485         * src/arscan.c (ar_scan): Avoid sign comparison warnings
486         Pacify 12.2.1 20220819 (Red Hat 12.2.1-2) -Wsign-compare by checking
487         the readbuf() return explicitly for errors then casting from ssize_t.
488         Initial patch provided by Paul Eggert <eggert@cs.ucla.edu>.
489
490 2022-10-03  Paul Eggert  <eggert@cs.ucla.edu>
491
492         Support systems with 32-bit long and 64-bit time_t
493         Don't assume that time_t fits in long, as some hosts (e.g.,
494         glibc x86 -D_TIME_BITS=64) have 32-bit long and 64-bit time_t.
495
496         * bootstrap.conf (gnulib_modules): Add largefile, to support files
497         with timestamps after Y2038 on hosts with 32-bit long.
498         * configure.ac: Do not call AC_SYS_LARGEFILE, as the largefile module
499         does that for us.
500         * src/makeint.h (PRIdMAX, PRIuMAX, SCNdMAX): Define if not already
501         defined (taken from gnulib).
502         * src/ar.c: Include intprops.h, for TYPE_MAXIMUM, as
503         INTEGER_TYPE_MAXIMUM does not work on time_t without issuing a bunch
504         of warnings.
505         (ar_member_date): Check that result is in time_t range.
506         (ar_member_date_1): Use intmax_t to hold the date.
507         (ar_glob_match): Ditto.
508         * src/arscan.c (VMS_function, VMS_function_ret, ar_scan)
509         (parse_int, ar_scan, ar_member_pos, ar_member_touch)
510         (describe_member): Convert long int to intmax_t.
511         * src/file.c (file_timestamp_sprintf): Use intmax_t/uintmax_t instead
512         of long/unsigned long for values that might be time_t.
513         * src/arscan.c (ar_member_touch): Fix buffer overrun if the timestamp
514         is too large.
515
516 2022-10-03  Paul Smith  <psmith@gnu.org>
517
518         Add support for intmax_t
519         * configure.ac: Ask autoconf to detect it.
520         * src/config.ami.template: Add #define intmax_t for AmigaOS.
521         * src/config.h-vms.template: Add #define intmax_t for VMS.
522         * src/config.h.W32.template: Add #define intmax_t for Windows.
523         * src/configh.dos.template: Add #define intmax_t for MS-DOS/DJPP.
524
525         * NEWS: Deprecate Xenix
526
527 2022-10-02  Paul Smith  <psmith@gnu.org>
528
529         [SV 63098] Temporarily revert the change to pattern rule behavior
530         The fix for SV 12078 caused a backward-compatibility issue with some
531         makefiles.  In order to allow users to resolve this issue, revert
532         that change for this release cycle: it will be reinstated in the
533         next release cycle.  Introduce a warning if we detect that the recipe
534         of a multi-target pattern rule doesn't create all the targets.
535
536         * NEWS: Announce the future backward-incompatibility.
537         * doc/make.texi (Pattern Intro): Describe the behavior and that it
538         will change in the future.
539         * src/remake.c (check_also_make): Check for also_make targets that
540         were not created and generate a warning.
541         (update_goal_chain): Call the new function.
542         (check_dep): Ditto.
543         (update_file_1): Defer implicit rule detection until after we check
544         all the also_make files (as it used to be).
545         * tests/scripts/features/patternrules: Add tests of the new warning.
546         Skip the tests for SV 12078.
547
548 2022-10-02  Paul Smith  <psmith@gnu.org>
549
550         * doc/make.texi (Prerequisite Types): [SV 58056] Clarify ordering.
551
552         * src/filedef.h (is_ordinary_mtime): Check for "ordinary" mod time.
553         * src/remake.c (update_file_1): Use the new macro.
554
555         * src/remake.c (update_file_1): Return valid enum element, not 0.
556
557         * NEWS: Announce deprecation of OS/2 and AmigaOS ports
558
559         * src/main.c (main): Add debug output for jobserver and osync.
560         * src/posixos.c (jobserver_setup): Remove redundant debug output.
561         (jobserver_parse_auth): Ditto.
562
563 2022-10-02  Andreas Schwab  <schwab@suse.de>  (tiny change)
564
565         [SV 63111] Ensure output-sync is cleaned on re-exec and recursion
566         Now that output-sync is using a separate file as a mutex rather than
567         stdout, ensure the new file descriptor is closed before re-exec and
568         not inherited by children.
569
570         * src/main.c (main): Call osync_clear() before re-exec.
571         * src/posixos.c (osync_setup): Reset output-sync handle inheritance.
572         (osync_parse_mutex): Ditto.
573
574 2022-10-01  Paul Smith  <psmith@gnu.org>
575
576         * src/function.c: Change int to uint to align with gmk_func_ptr
577
578 2022-10-01  Dmitry Goncharov  <dgoncharov@users.sf.net>
579
580         * doc/make.texi (Loaded Object API): [SV 63126] Fix typos and examples
581
582 2022-10-01  Paul Smith  <psmith@gnu.org>
583
584         Implement a simple xorshift 32bit random number generator
585         Avoid relying on the system random number generator for our random
586         shuffle, so that the same seed gives the same results on all systems.
587         This generator doesn't need to be amazing, just pretty good, so don't
588         bother with xorshift* or xorshift+, etc.
589
590         * src/makeint.h: Declare make_seed() and make_rand().
591         * src/misc.c (make_seed): Set the seed value for the RNG.
592         (make_rand): Return the next random number.  If the seed was not set
593         initialize it first.
594         * src/shuffle.c (shuffle_set_mode): If we don't get a seed from the
595         user just leave it unset (0).
596         (shuffle_deps_recursive): Use make_seed() not srand().
597         (random_shuffle_array): Use make_rand() not rand().
598
599 2022-09-25  Dmitry Goncharov  <dgoncharov@users.sf.net>
600
601         [SV 63100] Set the floc of every created goal dep struct
602         * src/read.c (eval): Initialize the goaldep floc pointer.
603         * tests/scripts/features/loadapi: Verify that the floc is set after
604         unloading and reloading dynamic objects.
605
606 2022-09-25  Paul Smith  <psmith@gnu.org>
607
608         * doc/make.texi: Update out of date behavior for grouped targets.
609
610         * README.git: Announce releases to the platform-testers list
611
612 2022-09-25  Paul Smith  <psmith@gnu.org>
613
614         Provide new functions to convert long long to string
615         The previous attempt to use PRI* macros to avoid compiler-specific
616         printf format specifiers didn't work because we are using raw
617         long long type, not the uintX_t types.  On systems where long and
618         long long are the same size, uint64_t might be type "long" and PRId64
619         is just "ld".
620
621         Instead write new functions that convert [unsigned] long long to a
622         string and call those instead.
623
624         * src/makeint.h: Declare make_lltoa() and make_ulltoa().
625         * src/misc.c (make_lltoa): New function that writes a long long value
626         into a provided buffer.  Return the buffer for ease-of-use.
627         (make_ulltoa): Ditto, for unsigned long long.
628         * src/function.c (func_wordlist): Call these new methods.  Also
629         rework the error strings so we share the translated string.
630         * src/dir.c (print_dir_data_base): Call the new methods instead of
631         using MSVC macros.
632
633 2022-09-25  Paul Smith  <psmith@gnu.org>
634
635         Always restore global environ if we use vfork
636         We may change the global environ variable in the child; when using
637         vfork() this also sets it in the parent.  Preserve the parent's
638         environ in child_execute_job() so it takes effect for all callers.
639
640         Reported by Denis Excoffier <bug-tar@Denis-Excoffier.org>
641         Root cause found by Martin Dorey <Martin.Dorey@hitachivantara.com>
642
643         * src/job.c (start_job_command): Remove save/restore of the parent
644         environment.
645         (child_execute_job): Add save/restore of the parent environment,
646         if we use vfork().
647         * tests/scripts/functions/shell: Add a test the crashes if we don't
648         reset environ after we run $(shell ...).
649
650 2022-09-25  Dmitry Goncharov  <dgoncharov@users.sf.net>
651
652         * configure.ac: [SV 63070] Clean up the test program for posix_spawn.
653
654 2022-09-25  Paul Smith  <psmith@gnu.org>
655
656         * src/posixos.c (osync_clear): Don't close invalid FDs.
657
658         * maintMakefile: Use gnulib ncftpput-ftp if ncftpput is missing.
659
660         * src/misc.c (strncasecmp): Use size_t for length to match std.
661         * src/misc.h (strncasecmp): Fix the declaration.
662
663         * configure.ac: Update to GNU make 4.3.91
664         * NEWS: Update the version and clarify some backward-compat issues.
665
666 2022-09-25  Eli Zaretskii  <eliz@gnu.org>
667
668         Fix compiler warnings in the MS-Windows build.
669         * src/w32/w32os.c (osync_get_mutex, osync_parse_mutex): Cast to
670         DWORD_PTR when converting integers to HANDLEs and vice versa.
671
672         * src/w32/pathstuff.c (w32ify): Pacify compiler warnings about
673         'strncpy'.
674
675         * src/makeint.h (PRId64) [!HAVE_INTTYPES_H]: Define if undefined.
676         * src/function.c (func_wordlist): Use PRId64 instead of %lld.
677
678 2022-09-24  Eli Zaretskii  <eliz@gnu.org>
679
680         Avoid compilation warnings
681         * src/implicit.c: (pattern_search):
682         * src/main.c: (main): Avoid compilation warnings for variables
683         only used when compiling a debug version with assertions.
684
685 2022-09-20  Paul Smith  <psmith@gnu.org>
686
687         Release GNU make 4.3.90
688         * NEWS: Update for the prerelease.
689         * bootstrap.conf: Choose the latest stable gnulib.
690         * README.git: Updates.
691
692         * tests/script/parallelism: Force wait to remove races.
693
694 2022-09-20  Dmitry Goncharov  <dgoncharov@users.sf.net>
695
696         [SV 56301] Fail if an included makefile can't be built
697         Fail if a mandatory include file fails to be built even if it's
698         built as part of a grouped target where the other include file
699         is optional.
700
701         * src/main.c (main): If a makefile doesn't build set any_failed.
702         * tests/scripts/features/include: Add tests.
703         * tests/scripts/options/dash-k: Stop after include build failure.
704
705 2022-09-20  Paul Smith  <psmith@gnu.org>
706
707         * tests/scripts/features/statipattrules: [SV 17374] Add test
708         Verify that double-colon static pattern rules work.
709
710 2022-09-20  Paul Smith  <psmith@gnu.org>
711
712         [SV 12078, SV 62809] Rebuild grouped targets if any is missing
713         If any of a set of grouped targets is missing or out of date, even
714         if make is not trying to build that target, rebuild them all.
715         Ensure this is true for explicit grouped targets as well as pattern
716         rule grouped targets.
717
718         Original patch by Jonathan Gravel <jo@stashed.dev>
719
720         * src/remake.c (update_file_1): After matching any pattern rules,
721         go through the also_make targets and set noexist as needed.  Also
722         compute the oldest this_mtime.
723         * tests/scripts/features/grouped_targets: Add regression tests.
724         * tests/scripts/features/patternrules: Ditto.
725         * tests/features/vpath: Rewrite to use modern run_make_test().
726         Add a test that we check for VPATH before implicit rule search.
727         Move the tests in vpath2 and vpath3 into this suite.
728         * tests/features/vpathplus: Rewrite to use modern run_make_test().
729
730 2022-09-17  Dmitry Goncharov  <dgoncharov@users.sf.net>
731
732         * tests/scripts/targets/WAIT: [SV 63071] Remove possible test races.
733
734 2022-09-13  Paul Smith  <psmith@gnu.org>
735
736         * doc/make.texi (Parallel Disable): Add clarifications.
737         * NEWS: Suggest how to change makefiles that use $(MAKEFLAGS).
738
739 2022-09-12  Paul Smith  <psmith@gnu.org>
740
741         [SV 13862] Implement the .WAIT special target
742         The next version of the POSIX standard defines parallel execution
743         and requires the .WAIT special target as is implemented in some other
744         versions of make.
745
746         This implementation behaves similarly to others in that it does not
747         create a relationship between targets in the dependency graph, so
748         that the same two targets may be run in parallel if they appear as
749         prerequisites elsewhere without .WAIT between them.
750
751         Now that we support .WAIT it's trivial to also support prerequisites
752         of the .NOTPARALLEL special target, which forces the prerequisites of
753         those targets to be run serially (as if .WAIT was specified between
754         each one).
755
756         * NEWS: Announce the new .WAIT and .NOTPARALLEL support.
757         * doc/make.texi (Parallel Disable): A new section to discuss ways in
758         which parallel execution can be controlled.  Modify cross-refs to
759         refer to this section.
760         * src/dep.h (struct dep): Add a new wait_here boolean.
761         (parse_file_seq): Add PARSEFS_WAIT to check for .WAIT dependencies.
762         * src/file.c (split_prereqs): Use PARSEFS_WAIT.
763         (snap_deps): If .NOTPARALLEL has prerequisites, set .WAIT between
764         each of _their_ prerequisites.
765         (print_prereqs): Add back in .WAIT when printing prerequisites.
766         * src/implicit.c (struct patdeps): Preserve wait_here.
767         (pattern_search): Ditto.  Use PARSEFS_WAIT when parsing prereqs for
768         pattern rule expansion.
769         * src/read.c (check_specials): Don't give up early: remembering to
770         update these options is not worth the rare speedup.
771         (check_special_file): If .WAIT is given as a target show an error--
772         once--if it has prereqs or commands.
773         (record_files): Call check_special_file on each target.
774         (parse_file_seq): If PARSEFS_WAIT is given, look for .WAIT prereqs.
775         If we see one assume that we are building a struct dep chain and set
776         the wait_here option while not putting it into the list.
777         * src/remake.c (update_file_1): If wait_here is set and we are still
778         running, then stop trying to build this target's prerequisites.
779         * src/rule.c (get_rule_defn): Add .WAIT to the prerequisite list.
780         * src/shuffle.c (shuffle_deps): Don't shuffle the prerequisite list
781         if .WAIT appears anywhere in it.
782         * tests/scripts/targets/WAIT: Add a test suite for this feature.
783
784 2022-09-12  Dmitry Goncharov  <dgoncharov@users.sf.net>
785
786         [SV 63045] Reload each intact unloaded shared object
787         If makefile rules do not update an unloaded shared object, load it
788         again.  Avoid double loading of the same object if the setup function
789         returns -1.
790
791         * src/filedef.h (struct file): Add "unloaded" flag.
792         * src/makeint.h (load_file): Take struct file *.
793         (unload_file): Return int.
794         * src/main.c (main): Reload unloaded shared objects if they weren't
795         updated.
796         * src/commands.c (execute_file_commands): Set "unloaded" and reset
797         "loaded" when a shared object is unloaded.
798         * src/read.c (eval): Set "loaded" and reset "unloaded" when a shared
799         object is loaded.  Add successfully loaded files to the db.
800         * src/load.c (load_file): Check "loaded" to avoid double loading the
801         same object.  Fix a memory leak of string loaded.  Return -1, rather
802         than 1, if the object is already loaded. This fixes double loading of
803         the same object when the setup routine returns -1.
804         (load_object): Add a log message.
805         (unload_file): Return an error on dlclose failure.  Log a message.
806         * tests/scripts/features/loadapi: Add new tests.
807
808 2022-09-12  Sergei Trofimovich  <siarheit@google.com>
809
810         [SV 63047] Fix shuffle of SECONDEXPANSION prerequisites
811         Commit 07eea3aa4 `make --shuffle` prevented shuffling prerequisites
812         that use .SECONDEXPANSION, since shuffle happens before expansion.
813         This has two problems:
814         1. No shuffling happens for such prerequisites.
815         2. Use-after-free when outdated '->shuf' links are used.
816
817         Add a reshuffle into expansion phase right after dependency changes.
818
819         * src/file.c (expand_deps): Add reshuffle if dependencies change.
820         * src/shuffle.c (identity_shuffle_array): Fix comment typo.
821         * tests/scripts/options/shuffle: Add new SECONDEXPANSION test.
822
823 2022-09-11  Paul Smith  <psmith@gnu.org>
824
825         * doc/make.texi (How Make Works): Clarify default goal exceptions.
826
827         * src/shuffle.c: Minor coding changes.
828
829 2022-09-11  Paul Smith  <psmith@gnu.org>
830
831         Support the MAKE_TMPDIR environment variable
832         Allow build systems to choose an alternative location for make to
833         store its temporary files.
834
835         * NEWS: Announce the new environment variable.
836         * doc/make.texi (Temporary Files): Provide documentation.
837         * src/misc.c (get_tmpdir): Split into a new function.  Compute the
838         temporary directory and store it in a static location.
839         * tests/scripts/features/jobserver: Add a test of MAKE_TMPDIR.
840
841 2022-09-10  Paul Smith  <psmith@gnu.org>
842
843         [SV 62898] Document ways to hide special chars from make functions
844         * doc/make.texi (Function Call Syntax): Add a subsubheading describing
845         which special characters may need to be hidden from make functions.
846
847 2022-09-10  Dmitry Goncharov  <dgoncharov@users.sf.net>
848
849         [SV 63044] load: Update .LOADED if the setup function returns -1
850         * src/load.c (load_file): Update .LOADED if setup returns non-0.
851         * tests/scripts/features/load: Change the return value based on an
852         environment variable.  Ensure that returning -1 still adds to
853         .LOADED.  Also add a test that verifies that make doesn't try to
854         rebuild the loaded file if -1 is returned.
855
856 2022-09-10  Paul Smith  <psmith@gnu.org>
857
858         Enhance the make.texi formatting
859         Notes provided by Tzvetelin Katchov <katchov@gnu.org>.
860
861         * doc/make.texi: Remove obsolete @refill statements.  Add some breaks
862         to overfull lines.  Fix up some example text.
863
864 2022-09-10  Paul Smith  <psmith@gnu.org>
865
866         Clean up maintMakefile
867         Notes provided by Tzvetelin Katchov <katchov@gnu.org>
868
869         * maintMakefile (git-very-clean): Add -x to git clean.
870         (GNULIBDIR): Use GNULIB_SRCDIR, or the local module if not set.
871
872 2022-09-10  Paul Smith  <psmith@gnu.org>
873
874         [SV 63037] Fix tests for newer OS / compiler
875         * tests/scripts/features/load: Add function prototypes.
876         * tests/scripts/features/temp_stdin: Only set user execute bits.
877         Some configurations don't allow changing the group bits...??
878
879 2022-09-10  Paul Smith  <psmith@gnu.org>
880
881         [SV 63040] shell: Fall back to the callers environment
882         If we detect a recursive variable reference when constructing the
883         environment for the shell function, return the original value from the
884         caller's environment.  Other options such as failing, returning the
885         empty string, or returning the unexpanded make variable value have
886         been shown to not behave well in real-world environments.  If the
887         variable doesn't exist in the caller's environment, return the empty
888         string.
889
890         Found by Sergei Trofimovich <slyich@gmail.com> when testing older
891         versions of autoconf.
892
893         * NEWS: Clarify this behavior.
894         * doc/make.texi (Shell Function): Ditto.  Also add info about !=.
895         * src/expand.c (recursively_expand_for_file): Search the caller's
896         environment if we detect a recursive variable expansion.
897         * tests/scripts/functions/shell: Add tests for this behavior.
898
899 2022-09-08  Paul Smith  <psmith@gnu.org>
900
901         [SV 63016] Don't fail exporting to $(shell ...)
902         The fix for SV 10593 caused recursive expansion errors when exporting
903         a variable that contains a $(shell ...) invocation.  If we see this
904         type of recursion, ignore it and expand to the empty string rather
905         than failing.
906
907         * src/variable.h (env_recursion): New global variable.
908         * src/variable.c (target_environment): If creating the environment
909         for a $(shell ...) function increment env_recursion.  Remove the
910         check for expansion in a shell function context.
911         * src/expand.c (recursively_expand_for_file): Check for recursive
912         expansion in a $(shell ...) environment context and if present,
913         show the verbose message and return the empty string.
914         * tests/scripts/functions/shell: Add a test for this situation.
915
916 2022-09-08  Paul Smith  <psmith@gnu.org>
917
918         Ensure debug output ends in newline
919         * src/load.c (load_object): Debug output strings must include \n.
920         * src/variable.c (target_environment): Ditto.
921         * src/posixos.c: Remove extra newlines.
922
923 2022-09-08  Paul Smith  <psmith@gnu.org>
924
925         Sanitize tar file ownership, mode, and order
926         For reproducibility ensure all files in the dist tar file are owned by
927         root, and sorted by name.  Force the mode on all files to be writable
928         by the owner and not writable by group or user, by default.
929
930         Remove unnecessary execute permissions from build_w32.bat.
931
932         Recommended by Tzvetelin Katchov <katchov@gnu.org>.
933
934 2022-09-08  Paul Smith  <psmith@gnu.org>
935
936         bootstrap: Update to the latest gnulib bootstrap model
937         * README.git: Document the changes.
938         * bootstrap.conf: Set GNULIB_REVISION to avoid random updates.
939         * configure.ac: Set the minimum autoconf version back to 2.69:
940         that's the most common version deployed today, and it still works.
941         * bootstrap: Copy the latest from gnulib.
942         * autogen.sh: Ditto.
943         * autopull.sh: Ditto.
944         * bootstrap-funclib.sh: Ditto.
945
946 2022-08-30  Paul Smith  <psmith@gnu.org>
947
948         Fix tests for MacOS and Windows
949         * maintMakefile: Remove the template headers as prerequisites.
950         * tests/scripts/features/jobserver: Only test fifo if enabled.
951         * tests/scripts/variables/INCLUDE_DIRS: On MacOS none of the default
952         directories exist so .INCLUDE_DIRS is empty by default.
953         * tests/scripts/features/se_explicit: Fail via exit.  cp will show
954         different error messages on different systems.
955         * tests/scripts/features/se_implicit: Ditto.
956         * tests/scripts/features/se_statpat: Ditto.
957
958 2022-08-30  Paul Smith  <psmith@gnu.org>
959
960         [SV 62840] Don't change IO buffering before printing version
961         If users run 'make --version | head -n1' they expect make to exit
962         with a success (0) code.  This works because the pipe forces the
963         default buffering on stdout to be fully buffered so all the output
964         is printed to the pipe in a single write(2) and won't fail.  However
965         due to output sync we forcibly set stdout to line buffered, which
966         means if the reader closes the pipe fast enough make will exit with
967         an error code because the write to stdout failed.
968
969         Move the setup done in output_init() back into main() where it can
970         be done in a proper order.  Rework the order of operations during
971         startup so that we check for help and version flags before we change
972         the buffering.  Clean up the behavior of print_usage().
973
974         Original changes from Dmitry Goncharov <dgoncharov@users.sf.net>.
975
976         * src/main.c (switches): Don't send --version in the environment.
977         (print_usage): Add a blank line after the version before the usage.
978         Move the die() into this function since we always die() afterward.
979         Note the die will flush so no need to do it explicitly.
980         (print_version): The caller will fflush when appropriate.
981         (close_stdout): Move from output.c so it is installed early.
982         (decode_switches): Only call print_usage on error, not for --help.
983         (main): Install the close_stdout handler immediately after start.
984         Move the calls to print_usage() due to --help and --version to be
985         called immediately after we decode the switches.  Move the buffer set
986         here from output_init(), immediately after we know we'll be running.
987         * src/output.c (output_init): Move buffer setting to main().
988         (close_stdout): Move to main().
989
990 2022-08-30  Paul Smith  <psmith@gnu.org>
991
992         Rework output sync to lock a temp file on POSIX
993         Some POSIX systems do not allow locks to be taken on non-files, such
994         as pipes.  This is a problem since very often make is invoked with
995         its stdout redirected to a pipe.  Also, if stdout is redirected to a
996         file that already has a lock on it for some other reason (perhaps a
997         shared file such as /dev/null) it can cause a hang.
998
999         This means our previous method of locking stdout, although it had some
1000         nice advantages, is not portable enough.  Instead, use a temporary
1001         file and take the lock on that.  We pass the name of the file to child
1002         make processes.  On Windows we continue to use a shared mutex for
1003         output sync.
1004
1005         Remove POSIX emulation functions like fcntl from Windows; instead
1006         follow the lead of the jobserver and create an interface in os.h for
1007         output sync, and move the OS-specific content to posixos.c and
1008         w32os.c.
1009
1010         * NEWS: Add a note.
1011         * src/makeint.h (ALL_SET): Check that all bits are set.
1012         * src/os.h: Add bits for checking the state of stdin/stdout/stderr.
1013         Add prototypes for OS-specific output sync methods.
1014         * src/posixos.c (check_io_state): Determine the status of stdin,
1015         stdout, stderr an return a suite of bits describing them.
1016         (osync_enabled): If the global variable holding the FD of the lock
1017         file (osync_handle) is valid return true.
1018         (osync_setup): Create a temporary file and remember its name in a
1019         global variable (osync_tmpfile), and set osync_handle.
1020         (osync_get_mutex): If output sync is enabled, return the filename
1021         of the lock file prefixed with "fnm:" to denote a filename.
1022         (osync_parse_mutex): If the provided filename has the wrong format
1023         disable output sync.  Else open the lock file and set osync_handle.
1024         (osync_clear): Close osync_handle.  If we're the parent make, then
1025         also unlink the temporary file.
1026         (osync_acquire): Take a lock on the osync_handle descriptor.
1027         (osync_release): Release the lock on the osync_handle descriptor.
1028         (fd_set_append): Add APPEND mode to a file descriptor.
1029         * src/w32/w32os.c: Perform the same actions as posixos.c, copying
1030         the details from src/w32/compat/posixfcn.c.  Use a mutex rather
1031         than locking a temporary file.
1032         * src/output.h: Remove all the OS-specific content.
1033         * src/output.c: Remove all the OS-specific content.
1034         (set_append_mode): Remove and replace with fd_set_append().
1035         (sync_init): Remove and replace with check_io_state().
1036         (acquire_semaphore): Remove and replace with osync_acquire().
1037         (release_semaphore): Remove and replace with osync_release().
1038         (setup_tmpfile): If the IO state is not obtained, get it.  If stdout
1039         and/or stderr are valid, set up a tempfile to capture them.
1040         (output_init): Set io_state if not set already, and check it when
1041         deciding whether to close stdout on exit.
1042         * src/main.c (main): If we're syncing, set up the mutex using the
1043         new osync_setup() / osync_parse_mutex() methods.
1044         (prepare_mutex_handl_string): Replace with osync_parse_mutex().
1045         (die): Call osync_clear().
1046         * src/w32/compat/posixfcn.c: Remove implementations of fcntl(),
1047         record_sync_mutex(), create_mutex(), and same_stream().
1048
1049 2022-08-30  Paul Smith  <psmith@gnu.org>
1050
1051         Add get_tmpfd() and allow anonymous temp files
1052         The output sync feature wants a file descriptor not a FILE*.  We were
1053         using tmpfile() but this returns FILE* which means we needed to dup()
1054         the descriptor then fclose() the original, which is just unnecessary
1055         overhead for every command we run.
1056
1057         Create a get_tmpfd() method that returns a file descriptor directly
1058         by using mkstemp() if available, else do the best we can.
1059
1060         Also allow anonymous temp files if the filename pointer is NULL.
1061         This causes the file to be unlinked.  On Windows this requires a
1062         special open so add an os_anontmp() method to handle this.
1063
1064         * src/makeint.h: Add prototype for get_tmpfd().
1065         * src/misc.c (get_tmpfd): If we have mkstemp() use that, else just
1066         open(2).  If we don't want to keep the filename, unlink the file.
1067         (get_tmpfile): Use get_tmpfd() if we have fdopen(), else use fopen().
1068         * src/output.c (output_tmpfd): Call get_tmpfd() with NULL.
1069         * src/os.h (os_anontmp): On Windows make this a function, else fails.
1070         * src/w32/compat/posixcfn.c (tmpfile): Move to w32os.c:os_anontmp().
1071         * src/w32/w32os.c (os_anontmp): Create a temp file that will be deleted
1072         when the process exits, and return a file descriptor to it.
1073
1074 2022-08-29  Paul Smith  <psmith@gnu.org>
1075
1076         test_driver: check for leftover temp files after each test
1077         Reset the temp directory for every test to a local directory, then
1078         after each test see if any new temp files were created and not
1079         deleted: if they were then fail the test.  Rather than delete the
1080         temp files we leave them there and avoid reporting files that were
1081         seen before, so the user can investigate them.
1082
1083         Rewrite the temp_stdin tests to rely on this built-in behavior
1084         rather than implementing the checks directly.
1085
1086         * tests/test_driver.pl: Create a $TEMPDIR variable pointing to a
1087         temporary directory outside the test temp directory.
1088         (toplevel) Before starting any tests create a temp directory and set
1089         the POSIX and Windows temp directory environment variables to use it.
1090         (compare_output) Check the contents of the temp directory.  If any
1091         new files have appeared, fail the test.
1092         * tests/scripts/features/temp_stdin: Remove check_tempfile() and
1093         all users of it, plus setting of temp environment variables.
1094
1095 2022-08-22  Dmitry Goncharov  <dgoncharov@users.sf.net>
1096
1097         [SV 62908] Don't free fifo_name twice during error handling
1098         * src/posixos.c (jobserver_setup): Set fifo_name to NULL after free.
1099         * tests/scripts/features/jobserver: Add tests.
1100
1101 2022-08-22  Paul Smith  <psmith@gnu.org>
1102
1103         Fix bootstrap.bat for bootstrapping on Windows
1104         * README.git: Clarify that these methods are lightly tested.
1105         * build_w32.bat: Don't support any config step: fail if not completed.
1106         Move the config steps into bootstrap.bat.  Don't print compile lines
1107         by default and add a --verbose option to show them.
1108         * bootstrap.bat: Ensure we have curl and sed before we do anything.
1109         Pull the latest necessary files from gnulib.  Create a convert.sed
1110         script that can update the various template files, and update
1111         Basic.mk, config.h.W32, and gmk-default.h.
1112         * tests/run_make_tests.pl: Remove CRLF rather than using chop.  If we
1113         run perl in Git for Bash it seems to handle newlines differently.
1114         * tests/scripts/features/temp_stdin: Remove the make copy and close
1115         STDIN so we can delete the temp file on Windows.
1116         * .gitignore: Ignore the convert.sed script.
1117
1118 2022-08-14  Paul Smith  <psmith@gnu.org>
1119
1120         * doc/make.texi (Variables/Recursion): [SV 56446] Clarify export docs
1121
1122 2022-08-07  Paul Smith  <psmith@gnu.org>
1123
1124         * doc/make.texi (Goals): [SV 51306] Improve MAKECMDGOALS example
1125
1126 2022-08-07  Dmitry Goncharov  <dgoncharov@users.sf.net>
1127
1128         * doc/make.texi (Remaking Makefiles): [SV 61623] Add optimization
1129
1130 2022-08-03  Paul Smith  <psmith@gnu.org>
1131
1132         * doc/make.texi (Chained Rules): [SV 61957] Clarify NOTINTERMEDIATE
1133
1134         [SV 62496] Fix example of testing MAKEFLAGS
1135         * doc/make.texi (Options/Recursion): Define the layout of MAKEFLAGS.
1136         (Testing Flags): Fix the example to test the first word.
1137
1138 2022-08-02  Paul Smith  <psmith@gnu.org>
1139
1140         Support implementing the jobserver using named pipes
1141         Using anonymous pipes for jobserver support has some advantages:
1142         for example there is nothing on disk that needs to be cleaned up.
1143         However it has many obscure problems, related to the fact that in
1144         order for it to work we need to ensure these resources are properly
1145         passed through to child processes that want to use the jobserver.
1146         At the same time we don't want to pass the pipe to process which
1147         DON'T know about the jobserver.
1148
1149         Other processes can open file descriptors which we then think are
1150         our jobserver, but aren't.  And, we open the pipe file descriptors
1151         in blocking mode which doesn't work for all users.
1152
1153         See issues such as SV 57178, SV 57242, and SV 62397
1154
1155         To avoid these issues, use named pipes (on systems where they are
1156         available) instead of anonoymous pipes.  This simplifies many things:
1157         we never need to pass open file descriptors to our children; they
1158         can open the jobserver named pipe.  We don't need to worry about
1159         recursive vs. non-recursive children.  Users don't have to "pass
1160         through" the resources if they are invoking sub-makes.  Each child
1161         can open its own file descriptor and set blocking as needed.
1162
1163         The downside is the named pipe exists on disk and so must be cleaned
1164         up when the "top-level" make instance exits.
1165
1166         In order to allow make to continue to be used in build systems where
1167         older versions of GNU make, or other tools that want to use the
1168         jobserver, but don't understand named pipes, introduce a new option
1169         --jobserver-style that allows the user to choose anonymous pipes.
1170
1171         * NEWS: Announce the change and the --jobserver-style option.
1172         * doc/make.1: Add --jobserver-style documentation.
1173         * doc/make.texi (Special Variables): Add missing items to .FEATURES.
1174         (Options Summary): Add --jobserver-style.
1175         (POSIX Jobserver): Named pipes, changes to --jobserver-auth, and the
1176         --jobserver-style option.
1177         (Windows Jobserver): Document --jobserver-style for Windows.
1178         * configure.ac: Check for mkfifo.
1179         * src/config.h-vms.template: Undefined HAVE_MKFIFO.
1180         * src/config.h.W32.template: Ditto.
1181         * src/main.c: Add jobserver-style as a new command line option.
1182         (main): Add jobserver-fifo to .FEATURES if supported.  Pass the style
1183         option to jobserver_setup().
1184         * src/os.h (jobserver_setup): Accept a style string option.
1185         * src/posixos.c (enum js_type): Enumeration of the jobserver style.
1186         (js_type): Which style we are currently using.
1187         (fifo_name): The path to the named pipe (if in use).
1188         (jobserver_setup): If no style is given, or "fifo" is given, set up a
1189         named pipe: get a temporary file and use mkfifo() on it, then open it
1190         for reading and writing.  If something fails fall back to anonymous
1191         pipes.
1192         (jobserver_parse_auth): Parse jobserver-auth to determine the style.
1193         If we are using a named pipe, open it.  If we're using anonymous pipes
1194         ensure they're valid as before.
1195         (jobserver_get_invalid_auth): Don't invalidate the jobserver when
1196         using named pipes.
1197         (jobserver_clear): Clean up memory used for named pipes.
1198         (jobserver_acquire_all): Unlink the named pipe when done.
1199         * src/w32/w32os.c (jobserver_setup): Check the style argument.
1200         * tests/scripts/features/jobserver: Use --jobserver-style to test
1201         the anonymous pipe behavior, and also test named pipe/semaphore
1202         behavior.  Check invalid jobserver-style options.
1203         * tests/scripts/functions/shell: Use --jobserver-style to test the
1204         anonymous pipe behavior, and also test named pipe/semaphore
1205         behavior.
1206
1207 2022-08-02  Paul Smith  <psmith@gnu.org>
1208
1209         Enhance get_tmpfile() and add get_tmppath()
1210         Move all the logic on creating temporary files into misc.c, and add
1211         a new function get_tmppath() that returns the pathname to a temporary
1212         file without creating or opening it.
1213
1214         * src/makeint.h: Add a declaration for get_tmppath().  Remove the
1215         template argument from get_tmpfile(): it will compute its own.
1216         * src/main.c (main): Remove the logic for computing templates.
1217         * src/vmsjobs.c (child_execute_job): Ditto.
1218         * src/misc.c (get_tmptemplate): New function to return an allocated
1219         template string for use with various mktemp-style functions.
1220         (get_tmppath): Return an allocated path to a temporary file, but do
1221         not create it.  Generally this should be avoided due to TOCTOU issues.
1222         (get_tmpfile): Use get_tmptemplate() to generate a template rather
1223         than using one passed in.  If we don't have mkstemp() then use
1224         get_tmppath() to compute the path of a temp file.
1225
1226 2022-07-30  Dmitry Goncharov  <dgoncharov@users.sf.net>
1227
1228         [SV 62706] Only second-expand targets that might be built
1229         Second-expand only the prerequisites of the targets being built.
1230         Defer second-expanding the prerequisites of targets until we need
1231         to decide if they should be built.
1232
1233         * NEWS: Mention the change in behavior.
1234         * doc/make.texi (Secondary Expansion): Document the new behavior.
1235         * src/filedef.h (struct file): Add flag snapped.
1236         (expand_deps): Declare a function to second expand the
1237         prerequisites of a target.
1238         * src/file.c (rehash_file): Merge flag snapped.
1239         (expand_deps): Remove qualifier static. Check flag snapped.
1240         (snap_deps): Remove the loop which performed second expansion for all
1241         targets.
1242         * src/remake.c (update_file_1): Second expand the prerequisites of
1243         the considered target.
1244         * tests/scripts/features/se_explicit: Add tests.
1245         * tests/scripts/features/se_implicit: Ditto.
1246         * tests/scripts/features/se_statpat: Ditto.
1247
1248 2022-07-30  Paul Smith  <psmith@gnu.org>
1249
1250         Disable the jobserver in non-recursive children
1251         Savannah issues such as SV 57242 and SV 62397 show how passing
1252         references to closed file descriptors via the --jobserver-auth option
1253         in MAKEFLAGS can lead to problematic outcomes.
1254
1255         When computing the child environment for a non-recursive shell, add
1256         an extra option to MAKEFLAGS to disable the file descriptors for the
1257         jobserver.
1258
1259         Unfortunately this doesn't modify the value of the make variable
1260         MAKEFLAGS, it only modifies the value of the sub-shell environment
1261         variable MAKEFLAGS.  This can lead to confusion if the user is not
1262         considering the distinction.
1263
1264         * src/makeint.h: Publish the jobserver-auth value.  Add a global
1265         definition of the name of the command line option.
1266         * src/os.h (jobserver_get_invalid_auth): New function to return a
1267         string invalidating the jobserver-auth option.
1268         * src/w32/w32os.c (jobserver_get_invaid_auth): Implement it.  On
1269         Windows we use a semaphore so there's no need to invalidate.
1270         * src/posixos.c (jobserver_parse_auth): If we parse the invalid
1271         auth string, don't set up the jobserver.
1272         (jobserver_get_invalid_auth): Return an invalid option.
1273         * src/variable.h (target_environment): Specify if the target
1274         environment is for a recursive shell or non-recursive shell.
1275         * src/variable.c (target_environment): Move checking for MAKELEVEL
1276         into the loop rather than doing it at the end.
1277         Along with this, check for MAKEFLAGS and MFLAGS, and update them
1278         based on whether we're invoking a recursive or non-recursive child,
1279         and also on whether it's necessary to invalidate the jobserver.
1280         * src/function.c (func_shell_base): Shell functions can never be
1281         recursive to pass 0 to target_environment().
1282         * src/job.c (start_job_command): Specify whether the child is
1283         recursive when calling target_environment().
1284         * src/main.c: Export jobserver_auth.  sync_mutex doesn't need to
1285         be exported.  Use the global definition for the option name.
1286         * tests/scripts/variables/MAKEFLAGS: Add tests for $MAKEFLAGS.
1287
1288 2022-07-30  Paul Smith  <psmith@gnu.org>
1289
1290         Ensure that MAKEFLAGS is set when invoking $(shell ...)
1291         * src/main.c (main): Don't reset the jobserver if the number of
1292         slots has not changed.
1293         (define_makeflags): Add all normal flags even when ALL is not set.
1294         * tests/scripts/functions/shell: Test invoking make in $(shell ...).
1295         * tests/scripts/variables/MAKEFLAGS: Test the value of MAKEFLAGS in
1296         $(shell ...).
1297
1298         Take advantage of mempcpy() and stpcpy()
1299         * src/makeint.h (stpcpy): Add missing declaration.
1300         * src/amiga.c (MyExecute): Avoid extra strlen using stpcpy.
1301         * src/function.c (func_shell_base): Ditto.
1302         (func_error): Use memcpy() not strcpy() when we know the length.
1303         * src/job.c (construct_command_argv_internal): Use stpcpy().
1304         * src/main.c (main): Ditto.
1305         (define_makeflags): Ditto.
1306         * src/variable.c (print_target_variables): Use memcpy() when we know
1307         the length.
1308         * src/commands.c (set_file_variables): Use mempcpy().
1309         * src/expand.c (variable_buffer_output): Ditto.
1310         * src/file.c (expand_deps): Ditto.
1311         * src/function.c (abspath): Ditto.
1312         (handle_function): Ditto.
1313         * src/implicit.c (pattern_search): Ditto.
1314         * src/job.c (construct_command_argv_internal): Use mempcpy() and
1315         don't add multiple spaces when there are no shell flags.
1316         * src/main.c (decode_env_switches): Use mempcpy() to simplify.
1317         (define_makeflags): Ditto.
1318         * src/variable.c (selective_vpath_search): Ditto.
1319
1320 2022-07-09  Paul Smith  <psmith@gnu.org>
1321
1322         Convert HAVE_GETLOADAVG to HAVE_DECL_GETLOADAVG
1323         We want to know if getloadavg() is declared, not if we have it.
1324
1325         * configure.ac: Add it as a define (why is this not the default?)
1326         * src/job.c: Conditionalize declaration on HAVE_DECL_GETLOADAVG.
1327         * config.ami.template: Rename HAVE_GETLOADAVG to HAVE_DECL_GETLOADAVG.
1328         * config.h-vms.template: Ditto.
1329         * config.h.W32.template: Ditto.
1330         Clean up and add new elements from latest config.h.
1331
1332 2022-07-09  Paul Smith  <psmith@gnu.org>
1333
1334         Merge in the latest gnulib findprog-in module
1335
1336         Merge in the latest gnulib concat-filename module
1337
1338         Merge in the latest gnulib getloadavg module
1339
1340         Initial merge of the gnulib-port branch
1341
1342 2022-07-09  Paul Smith  <psmith@gnu.org>
1343
1344         Move our local m4 macros to gl/m4
1345         The gl subdirectory contains our local versions of gnulib module
1346         implementations, so move m4/acinclude.m4 and m4/dospaths.m4 there.
1347
1348         * gl/modules/make-macros: Create a new module to handle the macros.
1349         * bootstrap.conf: Add the new module.
1350         * configure.ac: Macro invocation is moved to make-macros.
1351         * m4/.gitignore: Delete unnecessary ignore file: m4 is empty.
1352         * .gitignore: Add m4/ as an ignored directory.
1353
1354 2022-07-09  Paul Smith  <psmith@gnu.org>
1355
1356         Move our fnmatch/glob implementation into gl/lib
1357         The gl subdirectory contains our local versions of gnulib module
1358         implementations, so move fnmatch* and glob* from lib to gl/lib.
1359
1360         * gl/modules/make-glob: Add a proper Files: section.
1361         * lib/.gitignore: Delete unnecessary ignore file: lib is empty.
1362         * .gitignore: Add lib/ as an ignored directory.
1363
1364 2022-07-09  Paul Smith  <psmith@gnu.org>
1365
1366         * tests/run_make_tests.pl: Exit 1 if we detect an error.
1367
1368         * configure.ac: Remove AC_FUNC_SETVBUF_REVERSED.
1369         This macro is obsolete: no useful system has this problem anymore.
1370         * src/output.c (output_init): Remove reference to SETVBUF_REVERSED.
1371         * src/config.ami.template: Remove undef of SETVBUF_REVERSED.
1372         * src/config.h-vms.template: Ditto.
1373         * src/config.h.W32.template: Ditto.
1374
1375         * configure.ac: Check for stpcpy() support.
1376         * src/misc.c (stpcpy): Define it if not provided.
1377
1378 2022-07-09  Paul Smith  <psmith@gnu.org>
1379
1380         getloadavg: Remove support for privileged invocation
1381         This was needed when getloadavg required privileged access; in this
1382         case GNU make needed to be installed as a setgid program.  But this
1383         hasn't been supported by gnulib getloadavg() since 2011 and systems
1384         are no longer using it, so remove it.
1385
1386         * src/makeint.h (user_access): Remove unnecessary function.
1387         (make_access): Ditto.
1388         (child_access): Ditto.
1389         * src/misc.c: Remove implementations of the *_access() functions.
1390         * src/main.c (main): Remove unneeded call to user_access().
1391         * src/job.c (load_too_high): Remove calls to {make,user}_access().
1392         (exec_command): Remove call to child_access().
1393         * src/remote-cstms.c: Remove calls to these methods.  I suppose it
1394         might be possible this is needed and was piggy-backing on the
1395         privileged setting but since that's been broken for a while I doubt
1396         this is needed.  If so we can bring back the implementation into
1397         this source file.
1398         * src/config.h.W32.template: Remove GETLOADAVG_PRIVILEGED undef.
1399         * src/config.h-vms.template: Ditto.
1400         * src/config.ami.template: Ditto.
1401
1402 2022-07-09  Paul Smith  <psmith@gnu.org>
1403
1404         * maintMakefile: Allow checkcfg rules to succeed.
1405         We can no longer pass our mondo-warnings options to the builds,
1406         as these will impact all the code including gnulib code, and this
1407         won't work.  Also allow the caller to disable either the build.sh
1408         or makefile invocation, for testing.
1409         * Makefile.am: Allow the caller to reset the path to the make
1410         binary to be tested.  Remove c90 test: gnulib doesn't support it.
1411
1412         * build.sh: Manage libgnu_a-prefixed source files
1413
1414         bootstrap: Remove strerror()
1415         * bootstrap.conf: Remove strerror module
1416         * configure.ac: Add a check for strerror
1417         * src/misc.c: Add a default strerror() if not found
1418
1419 2022-07-09  Paul Smith  <psmith@gnu.org>
1420
1421         bootstrap: Remove strtoll()
1422         This pulls in entirely too much stuff we don't need.  Instead grab
1423         just the gnulib source file, then include it in src/misc.c.
1424
1425         * bootstrap.conf: Add just the lib/strtol.c source file.
1426         * configure.ac: Check for strtoll.
1427         * src/misc.c: Include strtol.c, with QUAD set, if needed.
1428
1429 2022-07-09  Paul Smith  <psmith@gnu.org>
1430
1431         bootstrap: Remove gnulib version of mempcpy()
1432         This pulls in a metric ton of stuff that we otherwise don't need, just
1433         for a one-liner that we already have a replacement for in src/misc.c.
1434
1435         * bootstrap.conf: Remove mempcpy
1436         * configure.ac: Add mempcpy to AC_CHECK_FUNCS
1437
1438 2022-07-09  Paul Smith  <psmith@gnu.org>
1439
1440         Run autoupdate and clean up autoconf usage
1441         We can assume that the return type of a signal handler is void.
1442         We can assume that, if sys/time.h exists, it can be included
1443         with time.h.
1444
1445         * bootstrap: Get the latest version
1446         * configure.ac: Require a newer version of autoconf.
1447         Remove unnecessary AC_PROG_CC_C99 (already have AC_PROC_CC).
1448         Remove unnecessary AC_AIX, AC_ISC_POSIX, AC_MINIX.
1449         Remove unnecessary AC_HEADER_STDC, AC_HEADER_TIME, AC_TYPE_SIGNAL.
1450         Use strerror to search for the cposix library.
1451         * src/commands.c (fatal_error_signal): Assume return type is void.
1452         * src/commands.h: Ditto.
1453         * src/job.c: Ditto.
1454         * src/job.h: Ditto.
1455         * src/main.c: Ditto.
1456         * src/makeint.h: Ditto.
1457         Don't bother with TIME_WITH_SYS_TIME.
1458         * src/remote-cstms.c: Check HAVE_SYS_TIME_H.
1459         * src/config.ami.template: Remove RETSIGTYPE.
1460         * src/config.h-vms.template: Ditto.
1461         * src/config.h.W32.template: Ditto.
1462         Remove TIME_WITH_SYS_TIME.
1463
1464 2022-07-09  Paul Smith  <psmith@gnu.org>
1465
1466         [SV 10593] Export variables to $(shell ...) commands
1467         Export all variables, including exported makefile variables, when
1468         invoking a shell for the $(shell ...) function.  If we detect a
1469         recursive variable expansion, silently ignore that variable and do
1470         not export it.  We do print a debug message.
1471
1472         * NEWS: Announce the potential backward-incompatibility.
1473         * doc/make.texi (Shell Function): Document the export behavior.
1474         * src/main.c (main): Add "shell-export" to .FEATURES.
1475         * src/job.h: New function to free struct childbase.
1476         * src/job.c (free_childbase): Implement it; call from free_child.
1477         * src/function.c (func_shell_base): Use target_environment() to
1478         obtain the proper environment for the shell function.
1479         Use free_childbase() to free memory.
1480         (windows32_openpipe): Don't reset the environment: the caller
1481         already provided a proper PATH variable in envp.
1482         * src/variable.c (target_environment): If we detect a recursive
1483         expansion and we're called from func_shell, ignore the variable.
1484         (sync_Path_environment): Simplify and reduce memory allocation.
1485         * tests/scripts/functions/shell: Add tests for this.
1486
1487 2022-07-09  Dmitry Goncharov  <dgoncharov@users.sf.net>
1488
1489         [SV 62650] Show correct warning when combining targets
1490         * src/file.c (rehash_file): Fix warning message.
1491         (rehash_file): Fix comment to match the behavior.
1492         * tests/scripts/features/se_explicit: Fix test.
1493         * tests/scripts/features/mult_rules: Add a new test.
1494
1495 2022-07-09  Dmitry Goncharov  <dgoncharov@users.sf.net>
1496
1497         [SV 62514] Honor command line interface flags
1498         Commit f2771aa614 introduced a bug where some switches were left out
1499         of MAKEFLAGS.  Instead of resetting switches, get the same results by
1500         filtering out duplicates.
1501
1502         * src/makeint.h: Remove reset_switches.
1503         * src/main.c: (reset_switches): Remove reset_switches.
1504         * (main): Remove call to reset_switches.
1505         * (decode_switches): Filter out duplicate flags.
1506         * src/variable.c: (set_special_var):  Remove call to reset_switches.
1507         * tests/scripts/variables/MAKEFLAGS: Verify that duplicate flags are
1508         properly filtered out.
1509
1510 2022-07-07  Paul Smith  <psmith@gnu.org>
1511
1512         Add gnulib findprog-in
1513
1514         Add gnulib concat-filename
1515
1516         Add gnulib getloadavg
1517
1518         Initial gnulib-port branch commit
1519
1520 2022-06-19  Paul Smith  <psmith@gnu.org>
1521
1522         Don't add GNUMAKEFLAGS to the environment
1523         If GNUMAKEFLAGS was not present in the environment when we started,
1524         don't add it.
1525
1526         * src/main.c (main): Don't mess with GNUMAKEFLAGS unless it exists.
1527         * tests/scripts/variables/GNUMAKEFLAGS: Test this behavior.
1528
1529 2022-06-18  Paul Smith  <psmith@gnu.org>
1530
1531         * tests/test_driver.pl: Don't freak if diff can't be found
1532
1533         * build_w32.bat [WIN]: Use call for all invocations
1534
1535 2022-06-17  Paul Smith  <psmith@gnu.org>
1536
1537         Avoid overwriting buffers with long pathnames
1538         Reported, with initial patch, by Gisle Vanem <gvanem@online.no>
1539
1540         * src/main.c (find_and_set_default_shell) [W32]: Pass search_token
1541         directly to w32ify: no need to make a copy first.  When we need to
1542         construct a path, use snprintf() to be sure we don't overwrite
1543         the locally-allocated buffer.
1544         * src/w32/pathstuff.c (w32ify) [W32]: Use the malloc version of
1545         _fullpath(), followed by strncpy(), to avoid overwriting buffers.
1546
1547 2022-06-04  Paul Smith  <psmith@gnu.org>
1548
1549         * tests/scripts/features/temp_stdin: Remove nested "my"
1550         * tests/scripts/features/statipattrules: Remove unset variable refs.
1551
1552 2022-06-04  Dmitry Goncharov  <dgoncharov@users.sf.net>
1553
1554         * tests/scripts/features/archives: Fix typo
1555
1556 2022-06-04  Sergei Trofimovich  <siarheit@google.com>
1557
1558         [SV 62100] Add '--shuffle' option support
1559         Introduce non-deterministic ordering into goal and prerequisite
1560         traversal to help tease out inconsistent failures that may happen
1561         when running in parallel build mode.
1562
1563         Introduce second order into each dependency chain:
1564         1. Existing order is syntactic order reachable via 'dep->next'
1565         2. New order is shuffled order stored as 'dep->shuf' in each 'dep'
1566
1567         When updating goals and prerequisites and '--shuffle' is provided,
1568         use the shuffled order to walk the graph.  When automatic variable
1569         are set always use the syntactic order of parameters.
1570
1571         * Makefile.am: Add new src/shuffle.c and src/shuffle.h file.
1572         * build_w32.bat: Ditto.
1573         * builddos.bat: Ditto.
1574         * makefile.com: Ditto.
1575         * po/POTFILES.in: Ditto.
1576         * doc/make.texi: Add documentation for --shuffle.
1577         * doc/make.1: Ditto.
1578         * src/dep.h (DEP): Add the shuf pointer.
1579         * src/filedef.h (struct file): Add was_shuffled flag.
1580         * src/main.c: (shuffle_mode): Global flag for the shuffle mode.
1581         (usage): Add the --shuffle option.
1582         (switches): Ditto.
1583         (main): Set shuffle_mode based on the command line parameter.
1584         Reshuffle prerequisites if requested.
1585         * src/remake.c (update_goal_chain): Walk the shuffled list if enabled.
1586         (update_file_1): Ditto.
1587         * src/shuffle.h: Provide an interface for shuffling prerequisites.
1588         * src/shuffle.c: Implement option parsing and prerequisite shuffling.
1589         * tests/scripts/options/shuffle: Test shuffle option and modes.
1590
1591 2022-06-04  Paul Smith  <psmith@gnu.org>
1592
1593         * src/misc.c (make_toui): Parse a string into an unsigned int
1594         * src/makeint.h: Declare it.
1595         * src/arscan.c (ar_scan): Replace atoi() calls with make_toui().
1596         Modify some integral types to be more correct.
1597         * src/job.c (load_too_high): Replace atoi() calls with make_toui().
1598         * src/main.c (main): Ditto.
1599         (decode_switches): Ditto.
1600
1601         * src/misc.c (make_pid): A function to return the PID
1602         * src/makeint.h: Declare it.
1603         * src/commands.c (fatal_error_signal): Call it.
1604
1605         * po/LINGUAS: Add a translation for Romanian
1606
1607 2022-04-24  Noah Goldstein  <goldstein.w.n@gmail.com>
1608
1609         Replace strcmp() with memcmp() where possible
1610         memcmp() is always faster than strcmp().  In places where we already
1611         know that both buffers have sufficient size, replace strcmp() with
1612         memcmp().
1613
1614         * src/main.c (main): Replace strncmp() with memcmp()==0.
1615         * src/read.c (word1eq): Ditto.
1616         * src/commands.c (set_file_variables): Ditto.
1617         * src/function.c (func_filter_filterout): Ditto.
1618         (a_word_hash_cmp): Use STRING_N_COMPARE since we know the length.
1619         (func_sort): Replace strcmp() with memcmp().
1620
1621 2022-04-24  Noah Goldstein  <goldstein.w.n@gmail.com>
1622
1623         hash: Remove unnecessary isupper() check before tolower()
1624         The standard requires that tolower() returns its argument if there's
1625         no valid lowercase conversion: it's not necessary to check isupper()
1626         before invoking tolower().
1627
1628         Comparing the performance of the old ISTRING_HASH to the new one
1629         on all the files present in GLIBC.
1630
1631           Data Type            Old Time   New Time
1632           Alternating case    24985.754  13883.422
1633           random case         35211.777  13569.051
1634           all lower           18818.974  13706.645
1635           all upper           38859.454  13506.315
1636
1637         * src/hash.h (ISTRING_HASH_1): Omit isupper() check.
1638         (ISTRING_HASH_2): Ditto.
1639
1640 2022-04-24  Dmitry Goncharov  <dgoncharov@users.sf.net>
1641
1642         [SV 62206] Fix %-substitution in second expansion of pattern rules
1643         During second expansion of pattern rules only the first pattern in
1644         each "group" was being substituted.  E.g. in this makefile:
1645
1646           .SECONDEXPANSION:
1647           all: hello.x
1648           %.x: $$(wordlist 1, 99, %.1 %.%.2) ; $(info $@ from $^)
1649           hello.1 hello.\%.2 \%.1 \%.\%.2: ;
1650
1651         the output would build "hello.1" and "%.%.2" because each function
1652         is considered a single "word" and only the first pattern is replaced.
1653
1654         Fix the expansion so each whitespace-separated string is considered a
1655         word and the first pattern is replaced, giving "hello.1" and
1656         "hello.%.2".
1657
1658         * src/rule.c (snap_implicit_rules): Keep enough space to replace %
1659         with $(*F) if necessary.
1660         * src/implicit.c (pattern_search): During second expansion break each
1661         get_next_word result into individual words and replace the first % in
1662         each with $* or $(*F) as needed.
1663         * tests/scripts/features/patternrules: Add tests for variations.
1664
1665 2022-04-24  Dmitry Goncharov  <dgoncharov@users.sf.net>
1666
1667         [SV 62175] Rework secondary expansion tests
1668         The hash function we use can yield different results on big- and
1669         little-endian systems which makes test output different.  Choose
1670         names to avoid this.
1671
1672         * tests/scripts/features/patternrules: Choose portable target names.
1673         * tests/scripts/features/se_explicit: Ditto.
1674         * tests/scripts/features/se_implicit: Ditto.
1675
1676 2022-04-24  Paul Smith  <psmith@gnu.org>
1677
1678         * Makefile.am (check-regression): Rename jhelp to thelp
1679
1680         * tests/scripts/options/dash-f: [SV 62118] Close STDIN
1681         On Windows we can't delete open files, so close STDIN before
1682         removing the temporary input file.
1683
1684         * tests/scripts/features/reinvoke: [SV 62088] Close STDIN
1685         On Windows we can't delete open files, so close STDIN before
1686         removing the temporary input file.
1687
1688         * tests/test_driver.pl (run_all_tests): Keep one copy of STDIN
1689
1690         * Makefile.am: Add INSTALL to the EXTRA_DIST files
1691
1692 2022-04-24  Dmitry Goncharov  <dgoncharov@users.sf.net>
1693
1694         [SV 62356] If -R is set in the makefile, disable -r
1695         If -R is given on the command line it implies -r as well; make this
1696         same assumption if -R is provided in MAKEFLAGS set in the makefile.
1697
1698         * src/main.c (main): Check no_builtin_variables_flag after reading
1699         makefiles.
1700         * tests/scripts/options/dash-r: Add a test.
1701
1702 2022-04-24  Dmitry Goncharov  <dgoncharov@users.sf.net>
1703
1704         [SV 62324] Simplify set_file_variables by passing in the stem
1705         Previously we always used the file->stem value as our stem in
1706         set_file_variables(); when that wasn't correct we had to temporarily
1707         set that value while the function was called, then reset it afterward.
1708         This led to issues (for example when we assumed the stem was a cached
1709         string but it wasn't).
1710
1711         Avoid this by passing in the stem as an argument so that different
1712         values can be provided.
1713
1714         Add tests to verify this.
1715
1716         * src/commands.c (set_file_variables): Take second parameter stem to
1717         relieve the callers of set_file_variables() from setting/restoring
1718         file->stem.
1719         * src/commands.h (set_file_variables): Ditto.
1720         (execute_file_commands): Pass file->stem to set_file_variables().
1721         * src/file.c (expand_deps): Pass d->stem to set_file_variables() and
1722         remove set and restore of file->stem.
1723         * src/implicit.c (pattern_search): Pass stem to set_file_variables()
1724         and remove set and restore of file->stem.
1725         * tests/scripts/features/se_explicit: Add new tests.
1726         * tests/scripts/features/se_implicit: Ditto.
1727         * tests/scripts/features/se_statpat: Ditto.
1728         * tests/scripts/variables/automatic: Ditto.
1729
1730 2022-04-24  Dmitry Goncharov  <dgoncharov@users.sf.net>
1731
1732         [SV 62278] Only expand the first pattern during secondary expansion
1733         During normal pattern rule expansion only the first pattern (%) is
1734         expanded; however during secondary expansion all patterns were
1735         expanded.  Modify secondary expansion to match the behavior of normal
1736         expansion.
1737
1738         Implementation tweaked by Paul Smith <psmith@gnu.org>
1739
1740         * src/file.c (expand_deps): Don't use subst_expand() which replaces
1741         all % with $*: instead replace only the first one, by hand.
1742         Fix a memory leak where the dep structure was not always freed.
1743         * tests/scripts/features/statipattrules: Use .RECIPEPREFIX not TAB.
1744         Add a series of tests verifying that static pattern rules with and
1745         without secondary expansion both return the same results.
1746
1747 2022-04-24  Paul Smith  <psmith@gnu.org>
1748
1749         * src/commands.h: [SV 62213] Forward-declare struct file / child
1750
1751         * tests/test_driver.pl (toplevel): [SV 62174] Enforce the C locale
1752
1753 2022-04-24  Paul Smith  <psmith@gnu.org>
1754
1755         [SV 62173] Fix archive tests for non-GNU systems
1756         Original patch from Dmitry Goncharov <dgoncharov@users.sf.net>
1757
1758         Fix the ar flags to match the default values in make.  If the
1759         U option is supported, add it to the end not the beginning,
1760         since ARFLAGS now starts with a "-".
1761
1762         * tests/test_driver.pl: Add defaults for global variables.
1763         (get_osname): Preserve $osname if it's set from $^O
1764         * tests/scripts/features/archive: Set the default arflags.
1765         If "U" is available add it to the end of the flags.
1766
1767 2022-04-24  Dmitry Goncharov  <dgoncharov@users.sf.net>
1768
1769         * tests/scripts/options/dash-l: [SV 62172] Skip if not available
1770
1771         * src/read.c (check_specials): [SV 62171] Reset ARFLAGS under .POSIX
1772
1773 2022-04-24  Dmitry Goncharov  <dgoncharov@users.sf.net>
1774
1775         [SV 62145] Remove a stdin temp file on re-exec failure.
1776         If the re-exec fails, be sure to remove a temp makefile that was
1777         created to read from stdin.
1778
1779         * src/job.c (exec_command): Return on failure.
1780         (child_execute_job): Call exit if exec_command returns.
1781         * src/job.h (exec_command): Don't mark as NORETURN.
1782         * src/main.c (main): Unlink stdin temporary file if re-exec fails.
1783         * tests/run_make_tests.pl: Get value for ERR_nonexe_file/ERR_exe_dir.
1784         * tests/scripts/features/temp_stdin: Test that temp file unlink works.
1785
1786 2022-04-18  Paul Smith  <psmith@gnu.org>
1787
1788         * tests/scripts/features/errors: Fix Perl warnings
1789         * tests/scripts/options/dash-f: Ditto.
1790
1791 2022-02-27  Paul Smith  <psmith@gnu.org>
1792
1793         [SV 62118] Correctly handle -f- options on re-exec
1794         The -f, -file, and --makefile options were not properly handled when
1795         re-exec'ing due to makefile updates.  This problem, plus a patch and
1796         tests, was reported by Dmitry Goncharov <dgoncharov@users.sf.net>.
1797
1798         While examining this I found another bug: after re-exec we forgot the
1799         batch file was temporary and never deleted it.
1800
1801         I decided to fix all these problems at once using a different fix
1802         than Dmitry's: I created a new internal-only command-line option,
1803         --temp-stdin.  When reconstructing the make options for a re-exec,
1804         replace the -f/--file/--makefile option that reads from stdin with
1805         --temp-stdin=<filename> so that the re-exec'd version of make knows
1806         it's a temporary batch file and will delete it.
1807
1808         We no longer need to add the -o options because the re-exec'd make
1809         knows this is a temporary makefile and treats it as such.
1810
1811         To simplify, replace the --file and --makefile options taking a
1812         filename, with just -f<filename> on re-exec.
1813
1814         Some examples of the rewrite:
1815
1816           User command line               Re-exec command line
1817           -----------------               --------------------
1818           -f-                             --temp-stdin=<batch>
1819           --file -                        --temp-stdin=<batch>
1820           -f - --makefile a.mk            --temp-stdin=<batch> -fa.mk
1821           --file=a.mk                     -fa.mk
1822           -fa.mk                          -fa.mk
1823           -Rf a.mk                        -Rf a.mk
1824           -Rf-                            -R --temp-stdin=<batch>
1825
1826         * src/main.c (stdin_offset): Remember the offset into the makefiles
1827         list of the batch file read from stdin.  Remove stdin_nm.
1828         (struct command_switch): Create a new --temp-stdin option, which
1829         also updates the makefiles list.
1830         (main): Add the temporary filename to the string cache.
1831         Move the tempfile handling after checking makefile arguments for "-"
1832         so that files provided via --temp-stdin are also handled specially.
1833         When rewriting re-exec options, we may need one more than we had
1834         originally so create a new argv list.  Walk through the original
1835         list and convert it to the new list, following the above process.
1836         (decode_switches): Set the stdin_offset flag if we see --temp-stdin.
1837         * tests/scripts/options/dash-f: Add many more tests, provided by
1838         Dmitry Goncharov <dgoncharov@users.sf.net>.
1839
1840 2022-02-27  Paul Smith  <psmith@gnu.org>
1841
1842         * tests/scripts/variables/MAKE_RESTARTS: Remove TAB chars
1843
1844         * README.git: Fix compiler options for ASAN
1845
1846 2022-02-27  Paul Smith  <psmith@gnu.org>
1847
1848         Remove extraneous characters from fatal() calls
1849         The fatal() method adds ".  Stop.\n" to every message.
1850
1851         * src/amiga.c (MyExecute): Remove newline from fatal() message.
1852         * src/job.c (<various>): Ditto.
1853         * src/file.c (snap_deps): Remove "." from fatal() message.
1854         * src/main.c (main): Ditto.
1855         * src/load.c: Ditto.
1856         * tests/scripts/targets/NOTINTERMEDIATE: Fix expected output.
1857
1858 2022-02-27  Paul Smith  <psmith@gnu.org>
1859
1860         * src/main.c: Ensure the stdin temp file is deleted when dying.
1861
1862 2022-02-27  Dmitry Goncharov  <dgoncharov@users.sf.net>
1863
1864         [SV 62088] Avoid re-exec due to stdin.
1865         The fix for SV 60595 causes make to re-execute when the makefile is
1866         read from stdin.  E.g.
1867             $ printf 'all:; $(info hello)' | make -sf -
1868
1869         Reported by Sergei Trofimovich <siarheit@google.com>
1870         Test added by Paul Smith <psmith@gnu.org>
1871
1872         * src/main.c (main): Set the mtime of the stdin temporary file.
1873         * tests/scripts/features/reinvoke: Add a test.
1874
1875 2022-02-27  Paul Smith  <psmith@gnu.org>
1876
1877         tests: Allow run_make_test() to avoid passing -f
1878         We already use undef makefile strings to mean "re-use the previous
1879         makefile", so if the string is empty we'll assume it means "don't
1880         use a makefile at all" (don't add -f).
1881
1882         * tests/run_make_tests.pl (run_make_test): If the makefile string
1883         is empty, don't create a makefile or add -f.
1884         * tests/scripts/features/include: Change empty makefile to "\n".
1885         * tests/scripts/misc/close_stdout: Ditto.
1886         * tests/scripts/options/dash-r: Ditto.
1887
1888 2022-02-27  Paul Smith  <psmith@gnu.org>
1889
1890         tests: Preserve Windows temp environment variables
1891         * src/main.c (main): Show the temp filename on error.  Also on
1892         Windows prefer TMP, then TEMP, and only lastly TMPDIR.
1893         * tests/test_driver.pl: Add TMP, TEMP, and USERPROFILE to the list
1894         of environment variables to preserve.
1895
1896 2022-02-26  Paul Smith  <psmith@gnu.org>
1897
1898         * tests/test_driver.pl: Support STDIN redirection.
1899         Before running tests, duplicate STDIN then reset it after the test
1900         completes.  Also when -keep is provided, preserve the base and run
1901         files.
1902
1903 2022-02-21  Paul Smith  <psmith@gnu.org>
1904
1905         Ensure buffers are large enough for integer values
1906         Issue raised by Sergei Trofimovich <siarheit@google.com>
1907
1908         * src/makeint.h (INTSTR_LENGTH): Update for unsigned values.
1909         * src/function.c (func_lastword): Use INTSTR_LENGTH as buffer size.
1910         (shell_function_completed): Ditto.
1911         (func_call): Ditto.
1912         * src/remote-cstms.c (start_remote_job): Ditto.
1913
1914 2022-02-10  Paul Smith  <psmith@gnu.org>
1915
1916         * <all>: Update copyright notices.
1917
1918 2022-02-06  Paul Smith  <psmith@gnu.org>
1919
1920         * doc/make.1: Use "target" from the SYNOPSIS.
1921         Reported by Helge Kreutzmann <debian@helgefjell.de>
1922
1923 2022-02-06  Paul Smith  <psmith@gnu.org>
1924
1925         Don't write $(shell ...) stdout to stderr on failure
1926         If a $(shell ...) invocation failed due to a command-not-found error,
1927         make wrote the stdout of that shell to our stderr for some reason.
1928         That seems very wrong.
1929
1930         If the command's stderr was not redirected then its output would have
1931         already been written to its stderr, and if it was redirected then we
1932         shouldn't take it upon ourselves to force it to go to stderr!
1933
1934         * src/function.c (func_shell_base): Append shell stdout even if the
1935         shell command failed.
1936         * tests/run_make_tests.pl: Determine the error generated for
1937         command-not-found situations.
1938         * tests/scripts/functions/shell: Verify that redirecting stderr to
1939         stdout will behave properly if the command is not found.
1940
1941 2022-02-06  Paul Smith  <psmith@gnu.org>
1942
1943         * Basic.mk.template: Allow arguments to the check target.
1944
1945 2022-02-06  Dmitry Goncharov  <dgoncharov@users.sf.net>
1946
1947         [SV 61805] Support quoted whitespace in .SHELLFLAGS with .ONESHELL
1948         * src/job.c (construct_command_argv_internal): Call recursively to
1949         parse .SHELLFLAGS when .ONESHELL is active.
1950         * tests/scripts/targets/ONESHELL: Add tests.
1951
1952 2022-02-06  Paul Smith  <psmith@gnu.org>
1953
1954         * tests/scripts/features/double_colon: Update for modern tests.
1955
1956         * tests/scripts/features/implicit_search: Add -r for safety.
1957
1958 2022-02-06  Dmitry Goncharov  <dgoncharov@users.sf.net>
1959
1960         [SV 48643] Add more tests of intermediates and unrelated targets
1961         If a prereq of a pattern is explicitly mentioned as a prereq of an
1962         unrelated rule, it should not be considered an intermediate file.
1963
1964         * tests/scripts/features/double_colon: Add tests mentioning unrelated
1965         explicit targets.
1966         * tests/scripts/features/grouped_targets: Ditto.
1967         * tests/scripts/features/implicit_search: Ditto.
1968         * tests/scripts/features/patternrules: Ditto.
1969         * tests/scripts/features/se_implicit: Ditto.
1970         * tests/scripts/features/statipattrules: Ditto.
1971
1972 2022-02-06  Dmitry Goncharov  <dgoncharov@users.sf.net>
1973
1974         [SV 48643] Make prereqs mentioned in unrelated rules explicit
1975         * src/implicit.c (pattern_search): Set is_explicit when a prereq
1976         is mentioned in an unrelated rule.
1977
1978         * src/implicit.c (pattern_search): [SV 61864] Fix debug output.
1979
1980 2022-02-06  Paul Smith  <psmith@gnu.org>
1981
1982         Avoid interleaved $(info ) output
1983         Since $(info ) function output is written using two system calls for
1984         the message and the newline, it's possible for output from another
1985         parallel make job to sneak in between them.
1986
1987         Reported by Paul Eggert <eggert@cs.ucla.edu>, who saw the report from
1988         Lars Ingebrigtsen <https://bugs.gnu.org/53358>.
1989
1990         * src/function.c (func_error): Paul provided a fix but instead I
1991         rewrote the entire function: it's not possible for it to be invoked
1992         with anything other than exactly one argument so don't worry about
1993         re-combining the arguments.
1994
1995 2022-02-06  Paul Smith  <psmith@gnu.org>
1996
1997         * tests/scripts/features/implicit_search: [SV 48643] Cleanups.
1998
1999         * src/implicit.c (pattern_search): Use const ptrs when possible.
2000         Change suggested by Joe Filion <joefilion4@gmail.com>
2001
2002         * src/job.c (load_too_high): Re-enable Linux /proc/loadavg checks.
2003         Further experimentation shows that my previous thinking that there
2004         was a problem using this was woefully mistaken.  The value generated
2005         by the kernel shows runn*ABLE* processes not runn*ING* processes.
2006         * NEWS: Announce the change.
2007
2008         * doc/make.texi (Using One Shell): Correct example to use $<.
2009
2010 2022-01-17  Jouke Witteveen  <j.witteveen@gmail.com>
2011
2012         * src/function.c (parse_textint): Handle ints without 0 properly.
2013         * tests/scripts/functions/intcmp: Add tests for values without 0.
2014
2015 2022-01-17  Paul Smith  <psmith@gnu.org>
2016
2017         [SV 61226] Revert changes to detect missing included files
2018         The fix for SV 60595 introduced a backward-incompatibility: rules that
2019         purported to rebuild included files, but didn't actually do so, were
2020         treated as errors whereas before they were ignored.  This breaks a
2021         common idiom in makefiles where an empty recipe is created for an
2022         included makefile so make doesn't complain if it doesn't exist.
2023
2024         Unfortunately this means make cannot diagnose some types of errors.
2025
2026         Extra tests supplied by Dmitry Goncharov <dgoncharov@users.sf.net>.
2027
2028         * doc/make.texi (Including Other Makefiles): Clarify this behavior.
2029         * src/main.c (main): Don't run the new check-for-errors behavior.
2030         * tests/scripts/features/reinvoke: Reset tests of the "old" behavior
2031         and add new tests for this situation.
2032
2033 2022-01-17  Paul Smith  <psmith@gnu.org>
2034
2035         Ensure that loaded functions increment the command count
2036         Since we don't know what a loaded function (via Guile or load) may
2037         do, increment the command count just in case.
2038
2039         * src/function.c (struct file_table_entry): New adds_command bool.
2040         (FT_ENTRY): Initialize it to 0 for built-in functions.
2041         (expand_builtin_function): If adds_command, increment the count.
2042         (define_new_function): Set adds_command for loaded functions.
2043
2044 2022-01-17  Paul Smith  <psmith@gnu.org>
2045
2046         * src/read.c (tilde_expand): Put back '/' before returning.
2047         Joe Filion <joefilion4@gmail.com> noted that the string is modified,
2048         and Henrik Carlqvist <hc94@poolhem.se> noticed that it wasn't put
2049         back in all cases.
2050
2051 2021-12-29  Paul Smith  <psmith@gnu.org>
2052
2053         * tests/scripts/targets/INTERMEDIATE: Rewrite for new test method
2054
2055 2021-12-29  Paul Smith  <psmith@gnu.org>
2056
2057         Do not force targets to be SECONDARY
2058         In SV 43677 we forced targets to be secondary if we found an
2059         intermediate file that was listed as a prerequisite of another
2060         target.  This overrides .INTERMEDIATE settings, so doesn't work.
2061         Now that we have an is_explicit flag in targets, use that instead.
2062
2063         * src/implicit.c (pattern_search): Remove setting of secondary.
2064         Preserve the value of the is_explicit flag when creating a new
2065         file target, and consider it when setting the intermediate flag.
2066         * tests/scripts/features/patternrules: Add a test w/out INTERMEDIATE
2067         * tests/scripts/targets/INTERMEDIATE: Add a test with INTERMEDIATE
2068
2069 2021-12-29  Dmitry Goncharov  <dgoncharov@users.sf.net>
2070
2071         [SV 48643] Preserve target-specific variables on intermediate files
2072         Target-specific variables used to define the target as "ought to
2073         exist" so they could never be intermediate.  Now they can be, so
2074         merge the target-specific variables from the intermediate target
2075         so they're not lost.
2076
2077         * src/implicit.c (pattern_search): Use merge_variable_set_lists
2078         to merge target-specific variables.
2079         * tests/scripts/features/implicit_search: Add tests of target-
2080         specific variable assignments and implicit rules.
2081
2082 2021-12-29  Paul Smith  <psmith@gnu.org>
2083
2084         * README.template: Clean up patch submission information
2085
2086 2021-12-19  Jouke Witteveen  <j.witteveen@gmail.com>
2087
2088         * src/read.c (find_percent_cached): [SV 60798] Silence GCC11 warnings
2089
2090         [SV 60798] Silence bogus GCC10 and GCC11 warnings
2091         * src/main.c (main): Use a separate variable to track final character.
2092         * src/read.c (eval): Track the semicolon position not one beyond it.
2093         * src/variable.c (do_variable_definition): Include a default switch
2094         case to ease the work of the exhaustiveness prover.
2095
2096 2021-12-19  Paul Smith  <psmith@gnu.org>
2097
2098         Update documentation with instructions for patch submission
2099         * README.template: Add notes on how to submit patches.
2100         * README.git: Point to the README.
2101         * doc/make.texi: Ditto.
2102
2103 2021-12-19  Paul Smith  <psmith@gnu.org>
2104
2105         Change HTTP URLs to use HTTPS instead
2106         Also remove unnecessary tests/COPYING file.
2107
2108         * README.template: Change http: to https:
2109         * README.git: Ditto
2110         * doc/make.texi: Ditto
2111         * doc/make.1: Ditto
2112         * src/main.c: Ditto
2113         * maintMakefile: Remove invalid URL
2114
2115 2021-12-19  Paul Smith  <psmith@gnu.org>
2116
2117         * src/makeint.h: Compute INTSTR_LENGTH based on size of intmax_t
2118         Math suggested by Edward Welbourne <edward.welbourne@qt.io>
2119
2120 2021-12-19  Paul Eggert  <eggert@cs.ucla.edu>
2121
2122         Remove arbitrary limits on intcmp integers
2123         We don't need to parse strings into C integer values to compare them.
2124
2125         * src/function.c (parse_textint): Find boundaries of a numeric string.
2126         (func_intcmp): Use parse_textint() to compare integers textually.
2127         * tests/scripts/functions/intcmp: Test with extra-large numbers.
2128
2129 2021-12-19  Paul Smith  <psmith@gnu.org>
2130
2131         Use a well-known error string for out-of-bound function arguments
2132         * src/function.c (parse_numeric): Check for empty value and error.
2133         If we find ERANGE just print our own error, not strerror.
2134         (func_word): Use a generic "not good" error message.
2135         (func_wordlist): Ditto
2136         (func_intcmp): Ditto
2137         * tests/run_make_tests.pl: Remove code to find strerror(ERANGE)
2138         * tests/scrips/functions/intcmp: Update the error message.
2139         * tests/scrips/functions/word: Ditto.
2140
2141         * doc/make.text (Wildcards): Document that glob results are sorted.
2142
2143 2021-12-19  Paul Smith  <psmith@gnu.org>
2144
2145         [SV 61621] Don't use POSIX_SPAWN_RESETIDS with posix_spawn()
2146         When make is invoked in a environment where the user namespace is
2147         restricted, such as under unshare(1) (on GNU/Linux), it won't be able
2148         to find its real UID so the effective UID can't be set to it and
2149         posix_spawn() will fail with EINVAL.
2150
2151         It's not less safe to run recipe jobs using the same UID values that
2152         make was invoked with, so don't worry about this flag.
2153
2154         * src/job.c (child_execute_job): Don't set POSIX_SPAWN_RESETIDS flag.
2155
2156 2021-12-05  Paul Smith  <psmith@gnu.org>
2157
2158         * .gitignore: Ignore patch files.
2159
2160 2021-11-28  U2FsdGVkX1  <u2fsdgvkx1@gmail.com>  (tiny change)
2161
2162         * src/commands.c (fatal_error_signal) [W32]: Use %lu for DWORD.
2163         * src/function.c (windows32_openpipe) [W32]: Ditto.
2164
2165 2021-11-28  Paul Smith  <psmith@gnu.org>
2166
2167         * NEWS: Update with author details
2168
2169         Special-case Windows error results
2170         * tests/scripts/features/errors: Match Windows-specific errors.
2171         * tests/scripts/features/targetvars: Match Windows-specific errors.
2172         * tests/scripts/misc/general4: Match Windows-specific errors.
2173
2174 2021-11-28  Paul Smith  <psmith@gnu.org>
2175
2176         Convert word, wordlist, and intcmp functions to use long long
2177         Modify make functions that parse integer values to use long long
2178         values instead of long: on Windows long is the same as int (4 bytes)
2179         and we don't want behavior to differ between different platforms.
2180
2181         * bootstrap.conf: Change strtol module to strtoll module.
2182         * src/function.c (parse_numeric): Use strtoll() and return long long.
2183         (func_word): Use long long.
2184         (func_wordlist): Use long long.  Verify second argument is >= 0.
2185         (func_intcmp): Use long long.
2186         * src/config.ami.template: Don't define HAVE_STRTOLL.
2187         * src/config-vms.template: Define HAVE_STRTOLL.
2188         * src/config.W32.template: Define HAVE_STRTOLL.
2189         * tests/run_make_tests.pl: Set $ERR_out_of_range to the proper string.
2190         * tests/scripts/functions/word: Rework to use the new style and avoid
2191         TAB characters.  Verify trailing whitespace is ignored.  Add a test
2192         for a negative second argument to wordlist.  Add tests for max signed
2193         integer values.  Use $ERR_out_of_range for the error string.
2194         * tests/scripts/functions/intcmp: Add tests for min and max signed
2195         integer values.  Use $ERR_out_of_range for the error string.
2196
2197 2021-11-28  Jouke Witteveen  <j.witteveen@gmail.com>
2198
2199         Introduce $(intcmp ...) for numerical comparison
2200         Numbers can come from $(words ...), automatic variables such as
2201         $(MAKELEVEL), from environment variables, or from shell output such as
2202         through $(shell expr ...).  The $(intcmp ...) function allows
2203         conditional evaluation controlled by numerical variables.
2204
2205         * NEWS: Announce this feature.
2206         * doc/make.texi (Functions for Conditionals): Document 'intcmp'.
2207         * src/function.c (func_intcmp): Create the 'intcmp' built-in function.
2208         * tests/scripts/functions/intcmp: Test the 'intcmp' built-in function.
2209
2210 2021-11-28  Jouke Witteveen  <j.witteveen@gmail.com>
2211
2212         Use strtol() instead of atoi()
2213         strtol() is part of C89 and a fallback is provided by gnulib.
2214
2215         * src/function.c (func_word, func_wordlist): Change atoi to strtol.
2216         * test/scripts/functions/word: Add out-of-range verification testing.
2217
2218 2021-11-27  Jouke Witteveen  <j.witteveen@gmail.com>
2219
2220         * src/makeint.h: Removed unused atol declaration
2221
2222 2021-11-27  Paul Smith  <psmith@gnu.org>
2223
2224         * src/implicit.c (pattern_search): Fix text for easier translation.
2225
2226         [SV 48643] Update the implicit rule search docs
2227         * NEWS: Announce the change.
2228         * doc/make.texi (Implicit Rule Search): Update the definition of
2229         "ought to exist" and add the extra step for compatibility mode.
2230
2231 2021-11-27  Dmitry Goncharov  <dgoncharov@users.sf.net>
2232
2233         [SV 48643] Enhance "ought to exist" definition
2234         The traditional definition of "ought to exist" in the user's manual can
2235         lead to make choosing a poor series of chained implicit rules.  Modify
2236         that rule so that we first attempt to resolve implicit rules by
2237         considering targets which are only (a) targets or (b) explicit
2238         prerequisites of the current target.
2239
2240         For backward-compatibility, if we don't find a solution using that
2241         algorithm use the previous definition where "ought to exist" means
2242         "mentioned as a prerequisite of any target".
2243
2244         * src/implicit.c (pattern_search): An extra argument controls whether
2245         to perform the backward-compatible rule search or not.  If a prereq is
2246         a target, or if it's a prerequisite of THIS target, then choose it.
2247         If we get to the end and haven't found a match, but we have found a
2248         potential compatibility rule, then retry with compat rules enabled.
2249         If we're searching with compat rules enabled and we find a file
2250         mentioned as a prerequisite of ANY target, then use it.
2251         * tests/features/implicit_search: Provide a large suite of tests for
2252         different steps of implicit rule search.
2253
2254 2021-11-27  Paul Smith  <psmith@gnu.org>
2255
2256         tests: Enhance output to contain filename/line number info
2257         * tests/scripts/options/dash-I: Use string comparison operator.
2258         * tests/test_driver.pl (cmd2str): New method to convert a
2259         command line to a string with proper quoting.
2260         * tests/run_make_tests.pl (create_command): Call cmd2str() to format
2261         the command.  Add the filename/line number to the output.
2262
2263 2021-10-18  Dmitry Goncharov  <dgoncharov@users.sf.net>
2264
2265         [SV 61042] Enhance logging of implicit rule search
2266         Logging of implicit rule search gives limited information as to why a
2267         given implicit rule was rejected, and if no implicit rule is found we
2268         get the confusing "No rule to make target" result when the real issue
2269         is that some prerequisite of some implicit rule could not be built.
2270
2271         Enhance logging around implicit rule search as follows:
2272         1. The messages which refer to a rule print a description (the targets
2273            and prerequisites) of the rule.
2274         2. A new message tells when a rule is rejected, along with the reason.
2275         3. The 'Looking for an implicit rule...' message is printed for every
2276            prerequisite, not just the top-level target.
2277         4. "Trying harder" message is printed, when intermediate prerequisites
2278            are going to be searched.
2279         5. The 'No rule found...' and 'Found implicit rule...' messages are
2280            printed for every prerequisite, not just the top-level target.
2281         6. "Ought to exist...", "Found..." or "Not found..." message is
2282            printed for each prerequisite.
2283
2284         * src/rule.h (struct rule): Remember the definition of the rule.
2285         * src/rule.c (get_rule_defn): Compute the definition of a rule.
2286         (install_pattern_rule): Initialize the definition to empty.
2287         (create_pattern_rule): Ditto.
2288         (freerule): Free the definition.
2289         (print_rule): Use the definition when printing rules.
2290         * src/remake.c (update_file_1): Push debug output down into
2291         try_implicit_rule().
2292         * src/implicit.c (try_implicit_rule): Add debugging
2293         (pattern_search): Show the rule definition in various debug output.
2294         Add new debug messages for implicit rule search.
2295
2296         Additional changes by Paul Smith <psmith@gnu.org>:
2297
2298         Since we usually don't need the rule definition, defer computing it
2299         until we do.
2300
2301         * bootstrap.conf: Include the mempcpy Gnulib module.
2302         * src/makeint.h (mempcpy): Declare mempcpy if not available.
2303         * src/misc.c (mempcpy): Define mempcpy if not available.
2304         * src/config.h-vms.template: Don't set HAVE_MEMPCPY.
2305         * src/config.h.W32.template: Ditto.
2306         * src/rule.h (get_rule_defn): Return the definition of a rule.
2307         * src/rule.c (get_rule_defn): If we don't have a definition compute
2308         it; either way return it.
2309         * src/implicit.c (pattern_search): Rework the handling of explicit
2310         prerequisites to pattern rules to be more clear.  There is no change
2311         in behavior.
2312
2313 2021-10-17  Dmitry Goncharov  <dgoncharov@users.sf.net>
2314
2315         * doc/make.texi (Special Targets): [SV 61122] Add .SECONDARY example
2316
2317 2021-10-17  Paul Smith  <psmith@gnu.org>
2318
2319         * README.git: Update C version prerequisite
2320
2321 2021-09-20  Paul Smith  <psmith@gnu.org>
2322
2323         Add support for the POSIX :::= assignment operator.
2324         POSIX Issue 8 will require a new assignment operator, :::=.
2325         This operator behaves similarly to the BSD make := operator: the
2326         right-hand side is expanded immediately, but then the value is
2327         re-escaped (all '$' are converted to '$$') and the resulting variable
2328         is considered a recursive variable: the value is re-expanded on use.
2329
2330         * src/variable.h (enum variable_flavor): Add f_expand flavor.
2331         * src/variable.c (do_variable_definition): When defining f_expand,
2332         post-process the result to re-escape '$' characters.
2333         Remove default: to the compiler warns about un-handled enum values.
2334         Set recursive values for both f_recursive and f_expand.
2335         (parse_variable_definition): Rewrite this method.
2336         The previous version was annoying to extend to ':::='.
2337         (print_variable): Remove default: so the compiler warns us about
2338         un-handled enum values.
2339         * src/function.c (func_origin): Remove default: so the compiler warns
2340         us about un-handled enum values.
2341         * doc/make.texi: Add documentation for :::=.
2342         * tests/scripts/variables/define: Add a test for define :::=.
2343         * tests/scripts/variables/flavors: Add tests for :::=.
2344         * tests/scripts/variables/negative: Add tests for :::=.
2345
2346 2021-09-07  Paul Smith  <psmith@gnu.org>
2347
2348         Clean up more Windows warnings.
2349         * src/config.h.W32.template: Re-enable warnings that we don't violate.
2350         Add a new disabled warning: 4130 (logical operation on address of
2351         string constant).
2352         * src/w32/compat/posixfcn.c: Make makeint.h the first included header.
2353         * src/w32/subproc/sub_proc.c: Ditto.  It includes config.h already.
2354
2355 2021-09-07  Dmitry Goncharov  <dgoncharov@users.sf.net>
2356
2357         [SV 60435] Ensure intermediate grouped files are removed
2358         If multiple intermediate files are built together be sure all of them
2359         are removed after make is finished.  Continue to ensure that targets
2360         that exist before make starts are not removed even if they appear to be
2361         intermediate.
2362
2363         Add a number of tests to pattern rules to verify this behavior.
2364
2365         * src/filedef.h (struct file): Add a new is_explicit bitfield.
2366         * src/file.c (rehash_file): Merge the is_explicit bit.
2367         (enter_prereqs): Set is_explicit if the file is explicitly mentioned.
2368         * src/implicit.c (pattern_search): Set intermediate on the file if it's
2369         not explicit.
2370         (record_files): Set is_explicit if a file is mentioned as a target.
2371         * src/remake.c (update_file_1): Set secondary on files that already
2372         exist so they won't be removed.
2373         * tests/scripts/features/double_colon: Add a test for double-colon
2374         pattern rules.
2375         * tests/scripts/features/patternrules: Update KGO for tests where more
2376         files are removed.
2377         Add new tests to verify handling removal of intermediate files in the
2378         context of grouped pattern targets.
2379
2380 2021-09-06  Paul Smith  <psmith@gnu.org>
2381
2382         * src/default.c (default_variables): Use CPP in PREPROCESS.S.
2383
2384 2021-09-06  Dmitry Goncharov  <dgoncharov@users.sf.net>
2385
2386         * src/main.c (decode_debug_flags): [SV 607777] Preserve -d options
2387         * tests/scripts/options/dash-d: Test that -d --trace keeps -d.
2388
2389 2021-09-06  Dmitry Goncharov  <dgoncharov@users.sf.net>
2390
2391         [SV 57778] Don't ignore included makefiles that can't be read
2392         If we find an included makefile but it's not readable, stop
2393         immediately with an error rather than continuing to look in other
2394         directories.
2395
2396         * src/read.c (eval_makefile): Only keep searching if the fopen error
2397         is ENOENT, else stop and fail.
2398         * tests/scripts/features/include: Add tests to verify this behavior.
2399
2400 2021-09-06  Paul Smith  <psmith@gnu.org>
2401
2402         [SV 60795] Don't remake phony included makefiles and show errors
2403         Change the handling of included makefiles which are phony targets to
2404         be similar to double-colon rules with no prerequisites: simply don't
2405         build them at all during the remake a makefile phase.
2406
2407         Ensure that any included makefile which is needed but not built
2408         results in an error.
2409
2410         Update the documentation to make this clear.
2411         Add tests to verify this behavior.
2412
2413         * doc/make.texi (Remaking Makefiles): Clarify double-colon exception.
2414         Document that phony targets are handled the same way.
2415         (Phony Targets): Ditto.
2416         * src/main.c (main): Check for phony targets when skipping goals.
2417         Rather than throwing out skipped but failed goals keep them
2418         separately then report them as errors.
2419         * src/read.c (eval): Set the file location on included makefiles even
2420         when there's no error.
2421         * tests/scripts/features/include: Add tests for handling included
2422         makefiles with both phony and double-colon rules to rebuild them.
2423
2424 2021-09-06  Paul Smith  <psmith@gnu.org>
2425
2426         * doc/make.texi (Environment): [SV 60841] Clarify variable exporting.
2427
2428         * doc/make.texi (Chained Rules): [SV 60904] Clarify intermediate files.
2429
2430 2021-09-06  Paul Smith  <psmith@gnu.org>
2431
2432         Remove UBSAN issues discovered via fuzzing tests.
2433         The arithmetic conversions in C say that if a binary operator has an
2434         unsigned and signed type as operands and the unsigned type has a greater
2435         rank then the signed value is converted to unsigned.  This is bad if the
2436         signed value is negative.
2437
2438         There are a few places in the code which have this situation; convert
2439         the signed value to positive and add instead of subtracting.
2440
2441         Reported by He Jingxuan <jingxuan.he@inf.ethz.ch>
2442
2443         * src/read.c (find_map_unquote): Use a positive int in memmove().
2444         (find_char_unquote): Ditto.
2445         (find_percent_cached): Ditto.
2446
2447 2021-09-05  Paul Smith  <psmith@gnu.org>
2448
2449         * doc/make.texi (Prerequisite Types): [SV 61069] Mention PHONY prereqs
2450
2451         * doc/make.1: Clean up man page text.
2452
2453         * README.git: Add a section on ways to test.
2454
2455         * src/main.c (decode_switches): Fix memory leak.
2456
2457         Clean up a few Windows build warnings (not all!)
2458         * build_w32.bat: Quote uses of %VSWHERE% so it can contain spaces
2459         * src/hash.c (hash_init): Avoid use of an undefined struct.
2460         (hash_rehash): Ditto.
2461         * src/vpath.c (construct_vpath_list): Cast explicitly to void*.
2462
2463 2021-09-05  Paul Smith  <psmith@gnu.org>
2464
2465         [SV 45211] Parse MAKEFLAGS immediately when it's reset
2466         When MAKEFLAGS is set in a makefile, reparse it immediately rather
2467         than waiting until after all makefiles have been read and parsed.
2468         This change doesn't actually fix the SV bug referenced because, even
2469         though we do reparse MAKEFLAGS, we don't handle the -r or -R options
2470         immediately.  Doing this will require more effort.
2471
2472         * NEWS: Announce the change.
2473         * src/makeint.h: Publish reset_switches() and decode_env_switches()
2474         from main.c
2475         * src/main.c (main): Don't call construct_include_path(); it will be
2476         invoked decode_switches().
2477         Preserve the old values of builtin_rules, builtin_variables, and
2478         job_slots before we read makefiles since they can be changed now.
2479         (reset_switches): Publish (remove static).  Set the initial value of
2480         the stringlist list to NULL.
2481         (decode_switches): Call construct_include_path() after decoding.
2482         (decode_env_switches): Publish (remove static).
2483         (define_makeflags): Set the MAKEFLAGS variable for special handling.
2484         * src/read.c (eval_makefile): Check for empty include_directories.
2485         (construct_include_path): Clear any old value of .INCLUDE_DIRS before
2486         appending new values.  Free the previous include_directories.
2487         * src/variable.c (lookup_special_var): When MAKEFLAGS is set, first
2488         reset the switches then re-parse the variable.
2489         * tests/run_make_tests.pl: Memo-ize some default variable values.
2490         * tests/scripts/options/dash-r: Create tests for setting -r and -R.
2491         * tests/scripts/variables/MAKEFLAGS: Test that resetting -I from
2492         within the makefile takes effect immediately.
2493
2494 2021-09-05  Paul Smith  <psmith@gnu.org>
2495
2496         * make-gdb.py: Add pretty-printers and clean up.
2497         Create a pretty-printer for next-pointer lists.
2498         Create a pretty-printer for stringlists.
2499         Change showargv from a function to a command (easier to use).
2500
2501         Clean up some Python PEP violations.  Add support for testing null
2502         pointers and caching gdb.Types.
2503
2504 2021-09-03  Paul Smith  <psmith@gnu.org>
2505
2506         [SV 60595] Restart whenever any makefile is rebuilt
2507         Previously if an included makefile was rebuilt as a prerequisite of
2508         another included makefile which didn't need to be rebuilt, make would
2509         not realize that it needed to re-exec itself.
2510
2511         Ensure that if any included makefile target is rebuilt we re-exec.
2512         Also ensure that if an included makefile is not readable, and our rule
2513         for rebuilding it doesn't actually change it, we will still fail.
2514
2515         * src/remake.c (update_goal_chain): If a goal's update was successful
2516         then check its status, even if no actual commands were run because it
2517         was already up to date.
2518         (show_goal_error): Remove superfluous cast.
2519         * src/main.c (main): If the makefile remake did nothing, check that we
2520         were able to successfully include all the makefiles we care about; if
2521         not fail.  When generating error messages about included makefiles be
2522         sure to show the filename/linenumber information.
2523         * test/scripts/features/reinvoke: Add tests for this behavior.
2524         * test/scripts/options/dash-k: Update error messages.
2525
2526 2021-09-03  Paul Smith  <psmith@gnu.org>
2527
2528         [SV 60412] Allow -I- to throw out the current directory path
2529         Accept a "-" directory value to the -I option to clear the set of
2530         directories to be searched up to that point, including the default
2531         directories.
2532
2533         * NEWS: Announce the change.
2534         * doc/make.texi (Summary of Options): Add documentation.
2535         * src/read.c (construct_include_path): Check for '-' and if found,
2536         clear the list of directories to be searched.
2537         * tests/scripts/options/dash-I: Add tests for -I-.
2538         * tests/scripts/variables/INCLUDE_DIRS: Add tests for -I-.
2539
2540 2021-07-25  Dmitry Goncharov  <dgoncharov@users.sf.net>
2541
2542         [SV 60699] Avoid calling strlen() repeatedly in a loop
2543         * src/variable.c (lookup_pattern_var): Accept target length parameter.
2544         (initialize_file_variables): Pass computed target length to lookup.
2545
2546 2021-07-25  Paul Smith  <psmith@gnu.org>
2547
2548         * NEWS: Add a few missing attributions
2549         * AUTHORS: Add some missing attributions
2550
2551 2021-07-25  Dmitry Goncharov  <dgoncharov@users.sf.net>
2552
2553         [SV 60297] Add .NOTINTERMEDIATE special target
2554         Support a new special target, .NOTINTERMEDIATE.  Any file or pattern
2555         prerequisite of this target will never be considered intermediate.
2556         This differs from .SECONDARY in that .SECONDARY files won't be deleted
2557         but they will still not be built if they are missing.
2558
2559         .NOTINTERMEDIATE files are treated the same way as a target which is
2560         explicitly mentioned in the makefile.  This is mostly useful with
2561         patterns; obviously mentioning a target explicitly here is enough in
2562         and of itself to make something not intermediate.
2563
2564         Some adjustments made by psmith@gnu.org
2565
2566         * NEWS: Announce the new feature.
2567         * doc/make.texi (Special Targets): Document .NOTINTERMEDIATE.
2568         (Chained Rules): Describe how to use .NOTINTERMEDIATE.
2569         * src/main.c (main): Add "notintermediate" to the .FEATURES variable.
2570         * src/filedef.h (struct file): Add "notintermediate" flag.
2571         * src/file.c (no_intermediates): Mark global .NOTINTERMEDIATE.
2572         (snap_file): Support .NOTINTERMEDIATE special target.  Throw an error
2573         if the same target is marked both .NOTINTERMEDIATE and .SECONDARY or
2574         .INTERMEDIATE.
2575         (rehash_file): Merge intermediate, notintermediate, secondary flags.
2576         (remove_intermediates): Check notintermediate flag before removing.
2577         (print_file):
2578         * src/implicit.c (pattern_search): Set notintermediate based on the
2579         pattern.
2580         * tests/scripts/targets/NOTINTERMEDIATE: Add a new test suite.
2581
2582 2021-05-30  Paul Smith  <psmith@gnu.org>
2583
2584         * make.texi (Reading Makefiles): != creates recursive variables.
2585         Reported by Ronald Hoogenboom <RHoogenboom@irdeto.com>.
2586
2587 2021-05-30  Dmitry Goncharov  <dgoncharov@users.sf.net>
2588
2589         [SV 60659] Set $$< properly in second expansion
2590         Set the $$< automatic variable as best we can during secondary
2591         expansion of prerequisites.
2592
2593         * src/commands.c (set_file_variables): Don't break without setting
2594         'less' if secondary expansion is enabled.
2595         * tests/scripts/features/se_explicit: Test secondary expansion results.
2596         * tests/scripts/features/se_implicit: Test secondary expansion results.
2597
2598 2021-05-30  Paul Smith  <psmith@gnu.org>
2599
2600         [SV 58341] Add non-trivial options to $(MAKEFLAGS)
2601         Previously only trivial (single-letter) options were available in
2602         $(MAKEFLAGS) when it is examined from inside a makefile (the full
2603         value was set before expanding recipes).
2604
2605         Ensure that all options (but, not command line variable overrides!)
2606         are visible in the $(MAKEFLAGS) variable.  In order to do this
2607         reset the default values of options, particularly options which are
2608         lists, before re-reading MAKEFLAGS after makefiles have been read.
2609         Otherwise we'll get duplicate values for options such as -I.
2610
2611         Unfortunately there are complications here as well: sometimes (for
2612         jobserver options in particular) we modify the values of these
2613         options while running: we must not reset these modifications.
2614
2615         * NEWS: Announce this change
2616         * src/main.c (main): Call new reset_switches() before re-parsing
2617         MAKEFLAGS.
2618         (reset_switches): Reset the value of non-special options to their
2619         defaults.
2620         (define_makeflags): Add non-special options into MAKEFLAGS even
2621         if 'all' is not set.
2622
2623 2021-05-30  Dmitry Goncharov  <dgoncharov@users.sf.net>
2624
2625         [SV 60378] Don't add duplicate default search directories
2626         Depending on how make was configured it may add duplicate
2627         directories in the default include search path: avoid this.
2628
2629         (Tweaked by psmith@gnu.org)
2630
2631         * configure.ac: Set AM variable KNOWN_PREFIX if --prefix is known
2632         * Makefile.am: Only set INCLUDEDIR if prefix is not known
2633         * read.c [default_include_directories]: Only add INCLUDEDIR if set
2634
2635 2021-05-30  Dmitry Goncharov  <dgoncharov@users.sf.net>
2636
2637         * tests/scripts/targets/INTERMEDIATE: [SV 60188] Add one more test
2638
2639 2021-05-29  Eli Zaretskii  <eliz@gnu.org>
2640
2641         [SV 58656] Fix mtime for large files on MS-Windows
2642         In MSVC builds, 'stat' fails when called on files larger than
2643         2GB.  Call '_stat64' instead to work around this.
2644
2645         * src/remake.c (STAT): Define to '_stat64' for MSVC builds.
2646         (name_mtime) [WINDOWS32]: Use STAT instead of 'stat'.
2647         Suggested by Makoto Kato <m_kato@ga2.so-net.ne.jp>.
2648
2649 2021-03-28  Paul Smith  <psmith@gnu.org>
2650
2651         Fix build and test issues on Windows
2652         * src/dep.h (DEP): Remove extraneous semicolon.
2653         * src/dir.c (find_directory) [W32]: Replace removed variable.
2654         * tests/scripts/features/include: Allow the extra default makefile
2655         searched for on Windows.
2656         * tests/scripts/functions/file: Use $(info ...) to avoid "command
2657         too long" errors on Windows.
2658
2659 2021-03-28  Tobias Stoeckmann  <tobias@stoeckmann.org>  (tiny change)
2660
2661         * src/remake.c (name_mtime): Reserve space for nul in readlink result
2662
2663 2021-03-25  Cao jin  <caoj.fnst@cn.fujitsu.com>  (tiny change)
2664
2665         * doc/make.texi (Call Function): Apply consistent formatting
2666
2667 2021-03-25  Pete Dietl  <petedietl@gmail.com>  (tiny change)
2668
2669         * src/job.c (child_execute_job): Update gnulib find_in_given_path()
2670
2671 2021-03-25  Mike Frysinger  <vapier@gentoo.org>  (tiny change)
2672
2673         * doc/make.texi (Automatic Variables): Relocate the $? example
2674
2675 2021-03-15  Paul Smith  <psmith@gnu.org>
2676
2677         [SV 58497] Ensure $(file <) newline removal succeeds
2678         Keep a count of bytes read rather than comparing pointers since the
2679         variable_buffer might get reallocated.
2680
2681         Bug and patch by Ken Tossell <ken@tossell.net>
2682         Regression tests by Dmitry Goncharov <dgoncharov@users.sf.net>
2683         Tweaked by Paul Smith <psmith@gnu.org>
2684
2685         * src/function.c (func_file): Use bytes read rather than a pointer.
2686         * tests/scripts/functions/file: Provide various tests for reading
2687         empty files, files with/without newlines, and large files.
2688
2689 2021-03-15  Dmitry Goncharov  <dgoncharov@users.sf.net>
2690
2691         [SV 60188] Explicit prereqs cannot be intermediate files
2692         If a prereq of a pattern is an explicit target, it should not be
2693         considered an intermediate file.
2694
2695         (Minor tweaks by Paul Smith <psmith@gnu.org>)
2696
2697         * src/dep.h (struct nameseq): Add is_explicit flag.
2698         * src/implicit.c (struct patdeps): Ditto.
2699         (pattern_search): Set the is_explicit flag appropriately for each
2700         prerequisite, based on whether it contained a pattern or not.
2701         Update the help output to note implicit vs. explicit prereqs.
2702         * tests/scripts/features/double_colon: Add tests.
2703         * tests/scripts/features/grouped_targets: Ditto.
2704         * tests/scripts/features/patternrules: Ditto.
2705         * tests/scripts/features/se_implicit: Ditto.
2706         * tests/scripts/features/statipattrules: Ditto.
2707
2708 2021-03-15  Paul Smith  <psmith@gnu.org>
2709
2710         * tests/scripts/features/exec: Small cleanup
2711
2712 2021-03-15  Paul Smith  <psmith@gnu.org>
2713
2714         Ensure variable_buffer is always set.
2715         Initialize the global variable_buffer in main() so that it is never
2716         a null pointer.  Then invoking variable_expand("") is never needed:
2717         simply use the variable_buffer pointer when we want to restart the
2718         variable buffer.  The main point of this simplification is not to
2719         keep a separate pointer to the beginning of the buffer: this is
2720         dangerous because the buffer may be re-allocated.  Instead always
2721         use the variable_buffer pointer itself.
2722
2723         * src/variable.h (initialize_variable_output): Publish.
2724         * src/expand.c (initialize_variable_output): Remove static.
2725         * src/main.c (main): Initialize variable_buffer.
2726         * src/file.c (enter_prereqs): Don't call variable_expand("") and
2727         don't save a separate buffer pointer than might be outdated.
2728         (expand_deps): Ditto.
2729         * src/read.c (record_files): Ditto.
2730         * src/remake.c (library_search): Ditto.
2731
2732 2021-03-15  Paul Smith  <psmith@gnu.org>
2733
2734         [SV 59881] Handle vertical TAB consistently
2735         While parsing makefiles get_next_mword() was treating VTAB as a word
2736         character rather than a word separator.  However, when using
2737         find_next_token(), for example in patsubst_expand_pat(), we treated
2738         VTAB as a word separator causing multiple words to appear where we
2739         didn't expect them.
2740
2741         * src/makeint.h (END_OF_TOKEN): Change from a loop to a boolean check.
2742         * src/misc.c (end_of_token): Move the loop here.
2743         * src/read.c (get_next_mword): Skip whitespace, not just blank, to
2744         find the start of the word and use END_OF_TOKEN() to decide when the
2745         current word is finished.
2746
2747 2021-03-14  Paul Smith  <psmith@gnu.org>
2748
2749         [SV 59870] define/undefine prerequisites are not target-specific vars
2750         * src/read.c (parse_var_assignment): If called in a target-specific
2751         variable context don't allow define/undefine as variable assignments.
2752         * test/scripts/variables/define: Add a test.
2753         * test/scripts/variables/undefine: Add a test.
2754
2755         * maintMakefile: Don't make .check-git-HEAD .PHONY
2756
2757 2021-03-07  Jouke Witteveen  <j.witteveen@gmail.com>
2758
2759         More correctly describe the scope of variables
2760         * NEWS: Use "local" instead of the incorrect "lexically-scoped".
2761         * doc/make.texi: Refer to let/foreach variables as local variables.
2762
2763 2021-03-07  Paul Smith  <psmith@gnu.org>
2764
2765         * doc/make.text: Clarify that patsubst doesn't touch unmatched words
2766
2767         * .dir-locals.el: Update for newer LSP config
2768
2769         * file.c (remove_intermediates): Restart "rm ..." on error
2770
2771 2020-12-07  Paul Smith  <psmith@gnu.org>
2772
2773         * doc/make.texi (How Patterns Match): [SV 58639] Fix chaining info.
2774
2775 2020-12-06  Jouke Witteveen  <j.witteveen@gmail.com>
2776
2777         Create $(let ...) providing lexically scoped variables
2778         Add a new function $(let ...) which allows lexically scoped variables.
2779
2780         * NEWS: Add information on this feature.
2781         * doc/make.texi (Let Function): Document the 'let' function.
2782         * src/function.c (func_let): Create the 'let' built-in function.
2783         * tests/scripts/functions/let: Test the 'let' built-in function.
2784
2785 2020-12-06  Paul Smith  <psmith@gnu.org>
2786
2787         * doc/make.texi (Phony Targets): [SV 58961] Clarify pattern handling
2788
2789         * doc/make.texi (Synchronized Terminal Output): [SV 58960] Fix link
2790
2791 2020-12-05  Paul Smith  <psmith@gnu.org>
2792
2793         [SV 59169] Add --debug=why and --debug=print options
2794         Add debug options to print recipes even if they would otherwise be
2795         silent, and to print the reason that a target was considered out of
2796         date.
2797
2798         Modify --trace to simply be a shorthand for --debug=print,why.
2799
2800         * NEWS: Announce changes.
2801         * doc/make.texi (Summary of Options): Document the new options.
2802         * doc/make.1: Ditto.
2803         * src/debug.h: Add new flags DB_PRINT and DB_WHY.
2804         * src/makeint.h: Remove the trace_flag variable.
2805         * src/job.c (start_job_command): Check debug flags not trace_flag.
2806         (new_job): Ditto.
2807         * src/main.c (trace_flag): Make a static variable for switches.
2808         (decode_debug_flags): Set DB_PRINT and DB_WHY if trace_flag is set.
2809         * tests/scripts/variables/GNUMAKEFLAGS: Update known-good messages.
2810         * tests/scripts/variables/MAKEFLAGS: Ditto.
2811
2812 2020-12-05  Paul Smith  <psmith@gnu.org>
2813
2814         * configure.ac: [SV 58836] Copy build.sh to the build directory
2815
2816 2020-12-05  Paul Smith  <psmith@gnu.org>
2817
2818         [SV 57676] Support included files being built after failing
2819         If a -include file does not exist, then some subsequent operation
2820         creates it, then allow it to be successfully included.
2821
2822         * src/read.c (eval_makefile): If our last mtime was NONEXISTENT then
2823         reset it to 0 so we'll check it again.
2824         * tests/scripts/features/include: Add a test for this behavior.
2825
2826 2020-12-02  Paul Smith  <psmith@gnu.org>
2827
2828         * src/makeint.h (free_alloca): Check for builtin alloca
2829
2830         * src/main.c (main): [SV 59601] Check for malformed env. variables
2831
2832 2020-11-29  Paul Smith  <psmith@gnu.org>
2833
2834         * maintMakefile: [SV 58794] Check for file existence in the release
2835
2836         * Makefile.am (HAVE_GUILE): Only use Guile options if HAVE_GUILE.
2837
2838         * tests/scripts/features/vpathgpath: Avoid duplicate function name.
2839
2840         Resolve unused-result warnings for alloca(0)
2841         * src/makeint.h (free_alloca): New macro to defeat warn_unused_result.
2842         * src/read.c (eval_makefile): Call it.
2843         (eval_buffer): Ditto.
2844         * src/remake.c (update_file): Ditto.
2845
2846 2020-11-29  Paul Smith  <psmith@gnu.org>
2847
2848         Avoid some valgrind warnings
2849         Using sscanf() to parse archive header values (struct ar_hdr) can lead
2850         to valgrind warnings which are probably bogus but are annoying.
2851         To be safer, create a local method to convert the ASCII integer
2852         strings into integers.
2853
2854         * src/arscan.c (parse_int): Turn integer strings into integers.
2855         (ar_scan): Initialize struct ar_hdr memory.
2856         Call parse_int() rather than sscanf/atol.
2857
2858 2020-11-29  Paul Smith  <psmith@gnu.org>
2859
2860         [SV 41273] Allow the directory cache to be invalidated
2861         Each time we invoke a command it's possible that it will change the
2862         filesystem in ways that were not described by the target.  If that
2863         happens but we have cached previous directory contents then we may
2864         make decisions or report results based on obsolete information.
2865
2866         Keep a count of how many commands we've invoked, and remember the
2867         current command count every time we load the contents of a directory.
2868         If we request the directory and the current command count has changed
2869         we know the cache is outdated so reload from scratch.
2870
2871         * NEWS: Announce the change.
2872         * src/makeint.h (command_count): Create a global counter.
2873         * src/main.c (command_count): Ditto.
2874         * src/job.c (reap_children): Increment the counter on job completion.
2875         * src/function.c (func_file): Increment if we write a file.
2876         * src/dir.c (clear_directory_contents): Clear the current contents of
2877         a cached directory.
2878         (struct directory_contents): Remember the counter value.
2879         (struct directory): Remember the counter value for non-existing dirs.
2880         (find_directory): If we have a cached directory and the count hasn't
2881         changed then return it.  Else, clear the previous contents and re-read
2882         from scratch.
2883         * tests/scripts/features/dircache: Add tests of the directory cache.
2884
2885 2020-11-29  Paul Smith  <psmith@gnu.org>
2886
2887         Support "unexport" in target-specific variables.
2888         Rewrite the environment variable algorithm to correctly inherit
2889         export settings from parent variable sets.  The new algorithm
2890         for computing the table of environment variables is:
2891
2892         - Start with the most local variable set and proceed to global.
2893         - If the variable already exists in the table and we don't know
2894           its export status, update it with the current variable's status.
2895         - If the variable is not in the table and it's not global, add it
2896           regardless of its status so if it's unexported we remember that.
2897         - If the variable is not in the table and is global, check its
2898           export status and don't add it if we won't export it.
2899
2900         Then when generating the environment variables, check the export
2901         status of each variable in case it was a target-specific variable
2902         and we have determined it should not be exported.
2903
2904         Rework SHELL handling to check at the end whether we added it or
2905         not and if we didn't, add the value from the environment.
2906
2907         * NEWS: Announce support for target-specific "unexport"."
2908         * doc/make.texi (Target-specific): Document the support.
2909         * src/variable.h (enum variable_export): Make into a global type.
2910         * src/read.c (struct vmodifiers): Use enum variable_export rather
2911         than individual booleans.
2912         (parse_var_assignment): Parse the "unexport" keyword.
2913         (eval): Remember the vmodifier value in the variable.
2914         (record_target_var): Ditto.
2915         * src/variable.c (should_export): Check if the variable should be
2916         exported.
2917         (target_environment): Implement the above algorithm.
2918         * tests/scripts/features/export: Test export/unexport with variable
2919         assignments on the same line.
2920         * tests/scripts/features/targetvars: Add a comprehensive suite of
2921         tests for different types of target-specific export / unexport.
2922         * tests/scripts/variables/SHELL: Update the comment.
2923
2924 2020-11-29  Dmitry Goncharov  <dgoncharov@users.sf.net>
2925
2926         [SV 59230] Preserve export settings for target-specific vars
2927         * src/read.c (record_target_var): Don't overwrite pre-existing export
2928         flag unless we're changing it.
2929         * tests/scripts/features/targetvars: Add a test.
2930
2931 2020-11-29  Paul Smith  <psmith@gnu.org>
2932
2933         [SV 59230] Ensure environment variables are exportable
2934         When checking for invalid environment variable names we searched the
2935         entire name string instead of just the first LENGTH chars; this could
2936         cause us to incorrectly decide the variable was not exportable.
2937
2938         Dmitry Goncharov <dgoncharov@users.sf.net> found this bug and
2939         provided a test case and sample fix: I used the test but chose a
2940         slightly different fix.
2941
2942         * src/variable.c (define_variable_in_set): check the variable name
2943         not the input string.
2944         * tests/scripts/features/targetvars: Ensure environment variable
2945         values are exported.
2946
2947 2020-11-29  Paul Smith  <psmith@gnu.org>
2948
2949         * src/default.c (default_variables) [AIX]: [SV 59096] Fix ARFLAGS
2950         Reported by Dmitry Goncharov <dgoncharov@users.sf.net>, with a patch
2951         changing the pattern rule for building archives.  I decided to
2952         change the default value of ARFLAGS on AIX instead.
2953
2954 2020-11-29  Paul Smith  <psmith@gnu.org>
2955
2956         [SV 35711] Check for special targets earlier
2957         GNU make must recognize some special targets as they are defined.
2958         Because of the way targets are defined, we were not recognizing these
2959         special targets until we were handling the NEXT statement.  However
2960         that's too late for some special targets such as .POSIX etc. which can
2961         change the behavior of make during parsing.
2962
2963         Check for special targets earlier, as soon as we've finished parsing
2964         the target introduction line (before we've even parsed the recipe).
2965
2966         * NEWS: Mention the change.
2967         * src/read.c (check_specials): New function to look for special
2968         targets.  Move checks from eval() and record_files() to this new
2969         function.
2970         (eval): Call check_specials() after we've completed parsing the target
2971         introduction line.  Move default goal detection to check_specials().
2972         (record_files): Move handling of .POSIX, .SECONDEXPANSION, and
2973         .ONESHELL to check_specials().
2974         * tests/scripts/misc/bs-nl: Remove workaround for late .POSIX issue.
2975         * tests/scripts/targets/POSIX: Add a comment.
2976
2977 2020-11-29  Paul Smith  <psmith@gnu.org>
2978
2979         * .ccls: Disable clang compare against static string warning
2980
2981 2020-11-13  Paul Smith  <psmith@gnu.org>
2982
2983         [SV 59093] Rewrite filter/filter-out to avoid large stack usage
2984         * src/function.c (func_filter_filterout): Allocate arrays to hold
2985         pattern and word information rather than creating linked lists on
2986         the stack.
2987         * tests/scripts/functions/filter-out: Test large filters.
2988
2989 2020-10-28  Paul Smith  <psmith@gnu.org>
2990
2991         * doc/make.texi (Include): Update behavior for missing included files
2992
2993 2020-07-19  Paul Smith  <psmith@gnu.org>
2994
2995         * NEWS: [SV 58435] Document minimum C compiler version requirement
2996         * configure.ac: Require c99 via AC_PROG_CC_C99
2997
2998 2020-07-19  Paul Smith  <psmith@gnu.org>
2999
3000         [SV 58735] Define the order that makefiles are rebuilt.
3001         Ensure that makefiles are rebuilt in the order in which make first
3002         considered them, and document this behavior in the manual.
3003
3004         * NEWS: Add a note about the new behavior
3005         * doc/make.text (How make Processes a Makefile): Document it.
3006         * main.c (main): Inverse the list of makefile goals.
3007         * read.c (read_all_makefiles): Add default makefiles to the list at
3008         the front in reverse order, the same way other makefiles are added.
3009         * tests/scripts/features/include: Add tests to verify rebuild order.
3010
3011 2020-07-10  Paul Smith  <psmith@gnu.org>
3012
3013         * src/makeint.h: [ARM] [SV 58347] Don't assume ARM is not POSIX
3014
3015         * src/job.c (unblock_sigs): [!POSIX] [SV 58743]  Fix syntax errors
3016
3017 2020-05-14  Paul Smith  <psmith@gnu.org>
3018
3019         * NEWS: Fix some tortured grammar.
3020
3021 2020-05-03  Paul Smith  <psmith@gnu.org>
3022
3023         [SV 57930] Cast char to unsigned char to call ctype functions
3024         This cast was already done almost everywhere: fix some stragglers.
3025
3026         * src/load.c (load_file): Cast char to unsigned char.
3027         * src/misc.c (strcasecmp, strncasecmp): [!POSIX] Ditto.
3028         * src/dir.c (vms_hash): [VMS] Ditto.
3029         * src/vms_progname.c (set_program_name): [VMS] Ditto.
3030         * src/vms_jobs.c (posix_parse_dq): [VMS] Ditto.
3031         (posix_parse_dollar): [VMS] Ditto.
3032         (build_vms_cmd): [VMS] Ditto.
3033         (child_execute_job): [VMS] Ditto.
3034
3035 2020-05-03  Paul Smith  <psmith@gnu.org>
3036
3037         Convert [ ... ] to test ... in scripting.
3038         The "[" link may be missing during OS boostrapping.
3039
3040         * build.sh: Convert "[ ... ]" to "test ..."
3041         * maintMakefile: Ditto.
3042         * scripts/copyright-update: Ditto
3043         * tests/scripts/features/reinvoke: Ditto
3044         * tests/scripts/features/targetvars: Ditto
3045
3046 2020-05-03  Paul Smith  <psmith@gnu.org>
3047
3048         * maintMakefile: Clean up output
3049
3050         * mainMakefile: Check that INSTALL exists in the dist file
3051         For some reason the INSTALL file symlinked to gnulib was omitted from
3052         the 4.3 release package: I can't reproduce this but check for it.
3053
3054 2020-05-02  Kevin Buettner  <kevinb@redhat.com>  (tiny change)
3055
3056         [SV 58232] Disable inheritance of jobserver FDs for recursive make
3057         A parent make will invoke a sub-make with close-on-exec disabled for
3058         the jobserver pipe FDs.  Force close-on-exec to be to be enabled in
3059         the sub-make so the pipe is not always passed to child jobs.
3060
3061         I have a test case which, when invoked with a suitable -j switch,
3062         will hang if the recipe inherits the jobserver pipe.  This test case
3063         was inspired by a real world case in which testing GDB on Fedora
3064         would hang due to some poorly written test GDB cases having been
3065         passed the jobserver file descriptors.
3066
3067         * src/posixos.c (jobserver_parse_auth): Call fd_noinherit() for
3068         jobserver pipe descriptors.
3069
3070 2020-04-01  Paul Smith  <psmith@gnu.org>
3071
3072         [SV 57674] Use the system default PATH if $PATH is not set
3073         When using execvp() if $PATH is not present in the environment
3074         it will automatically search the system default PATH string.  Emulate
3075         this by passing the system default PATH to find_in_given_path() if
3076         we don't find PATH in the environment.
3077
3078         * src/job.c (child_execute_job): Use confstr(_CS_PATH) if PATH is not
3079         found.
3080
3081 2020-04-01  Paul Smith  <psmith@gnu.org>
3082
3083         tests: Simplify customization of %ENV
3084         Rather than having an %extraENV that is added to the default %ENV
3085         and resetting %ENV _before_ each test, allow the test setup to
3086         modify %ENV directly as needed then reset %ENV _after_ each test.
3087
3088         * tests/test_driver.pl: Remove unused %extraENV.
3089         (resetENV): Don't add in %extraENV.
3090         (_run_command): Reset after we run the command rather than before.
3091         * tests/scripts/features/export: Convert %extraENV to %ENV
3092         * tests/scripts/features/jobserver: Ditto
3093         * tests/scripts/features/parallelism: Ditto
3094         * tests/scripts/features/targetvars: Ditto
3095         * tests/scripts/functions/eval: Ditto
3096         * tests/scripts/functions/foreach: Ditto
3097         * tests/scripts/functions/origin: Ditto
3098         * tests/scripts/misc/general4: Ditto
3099         * tests/scripts/options/dash-e: Ditto
3100         * tests/scripts/targets/POSIX: Ditto
3101         * tests/scripts/variables/GNUMAKEFLAGS: Ditto
3102         * tests/scripts/variables/SHELL: Ditto
3103
3104 2020-03-31  Jens Rehsack  <sno@netbsd.org>  (tiny change)
3105
3106         * src/output.h: [WINDOWS32] [SV 57888] Use gnulib fcntl if available
3107         If gnulib fcntl is available (for MinGW32) use it rather than our
3108         homegrown version.
3109
3110         * src/w32/compat/dirent.c: [SV 57888] Use gnulib opendir on MinGW32
3111
3112         * src/dir.c (local_stat): [WINDOWS32] Fix buffer-overflow warning.
3113         [SV 57888] Provide space for the path to use MAXPATHLEN plus nul.
3114
3115 2020-03-31  Paul Smith  <psmith@gnu.org>
3116
3117         [SV 57896] Change directories before checking jobserver auth
3118         We want to process -C options as early as possible, before we might
3119         write informational messages, so that Entering/Leaving messages have
3120         the correct directory.
3121
3122         * src/main.c (main): Move code dealing with changing directories
3123         before parsing of the jobserver auth flag.
3124         * tests/scripts/features/jobserver: Test the order of enter/leave.
3125
3126 2020-03-31  Paul Smith  <psmith@gnu.org>  (tiny change)
3127
3128         [SV 57967] Only set APPEND mode for regular files
3129         APPEND is a permanent mode shared by all users of a file.  If we
3130         set it on a tty, pipe, etc. it will stay in effect even after make
3131         exits, which can cause problems.
3132
3133         Patch provided by 0xef967c36@gmail.com
3134
3135         * src/output.c (set_append_mode): Check for a regular file.
3136
3137 2020-03-31  Paul Smith  <psmith@gnu.org>
3138
3139         Obey order of multiple print/no-print directory options
3140         Previously if --no-print-directory was seen anywhere even once
3141         (environment, command line, etc.) it would always take precedence
3142         over any --print-directory option.  Change this so that the last
3143         seen option (which will be the command line, if present there) takes
3144         precedence.
3145
3146         * NEWS: Mark this change in behavior.
3147         * src/makeint.h (print_directory): A new variable to control printing.
3148         * src/output.c (output_dump): Use the new variable.
3149         (output_start): Ditto.
3150         * src/main.c: Add a new variable print_directory.  Use -1 for
3151         print_directory_flag so we know of the option was seen or not.  Add a
3152         new default_print_directory_flag set to -1 to keep options from being
3153         added.
3154         (switches): Use flag_off for --no-print-directory, rather than a
3155         separate inhibit_print_directory_flag.
3156         (main): If print_directory_flag was set by the user, use that for
3157         print_directory.  If not, compute the print_directory value based on
3158         -s, -C, and sub-makes as before.
3159         * tests/scripts/variables/GNUMAKEFLAGS: -w is not added automatically
3160         * tests/scripts/options/print-directory: Add tests for overriding
3161         print-directory options.
3162
3163 2020-03-29  Paul Smith  <psmith@gnu.org>
3164
3165         * NEWS: Update 4.3 with information on .SILENT / -s
3166
3167 2020-02-29  Eli Zaretskii  <eliz@gnu.org>
3168
3169         * NEWS: Mention the new tcc support.
3170
3171 2020-02-29  Christian Jullien  <eligis@orange.fr>
3172
3173         Add support for building with Tiny C for MS-Windows
3174         * src/config.h.W32.template (HAVE_DIRECT_H, HAVE_STRCASECMP)
3175         (HAVE_STRNCASECMP, HAVE_UMASK): Add __TINYC__ to MinGW condition.
3176         (BATCH_MODE_ONLY_SHELL): Make this the default for Tiny C.
3177
3178         * build_w32.bat: Support building with Tiny C's tcc compiler.
3179
3180 2020-01-20  Paul Smith  <psmith@gnu.org>
3181
3182         Apply spelling corrections from Fossies spellcheck
3183         See https://fossies.org/features.html#codespell
3184         Spelling issues in Git commit messages or lib/* source are not applied.
3185
3186         * README.OS2.template: Apply spelling corrections.
3187         * README.VMS: Ditto.
3188         * src/commands.c: Ditto.
3189         * src/config.ami.template: Ditto.
3190         * src/configh.dos.template: Ditto.
3191         * src/job.c: Ditto.
3192         * src/job.h: Ditto.
3193         * src/read.c: Ditto.
3194         * src/variable.c: Ditto.
3195         * src/vms_exit.c: Ditto.
3196         * src/vms_export_symbol.c: Ditto.
3197         * src/vms_progname.c: Ditto.
3198         * src/vmsfunctions.c: Ditto.
3199         * src/vmsjobs.c: Ditto.
3200         * src/w32/pathstuff.c: Ditto.
3201         * tests/scripts/variables/automatic: Ditto.
3202         * tests/test_driver.pl: Ditto.
3203
3204 2020-01-20  Paul Smith  <psmith@gnu.org>
3205
3206         Update to GNU make 4.3.90
3207         * NEWS: Add a 4.3.90 section and update Savannah bug URL
3208         * configure.ac (AC_INIT): Change release to 4.3.90
3209
3210 2020-01-19  Paul Smith  <psmith@gnu.org>
3211
3212         GNU Make release 4.3
3213         * NEWS: Update for the release
3214         * configure.ac: New release number
3215         * doc/make.texi: New edition number
3216
3217         * configure.ac (guile): Check for Guile 3.0 installations
3218
3219         * src/job.c (sh_cmds): [SV 57625] Update builtin shell command list
3220
3221         Resolve some documentation issues
3222         * doc/make.texi (Interrupts): [SV 46193] Recommend defensive recipes
3223         * doc/make.texi: [SV 49262] Clarify interaction of prerequisites and
3224         non-terminal match-anything rules.
3225
3226 2020-01-19  Paul Smith  <psmith@gnu.org>
3227
3228         [SV 40657] Reinstate old behavior for suffix rules with prereqs
3229         POSIX says that suffix rules cannot have prerequisites, but after
3230         making this change we observed a number of makefiles "in the wild"
3231         that were relying on this behavior and failed.
3232
3233         For .POSIX: makefiles, obey POSIX.  Otherwise preserve the old
3234         behavior.  However, generate a warning so users know this is a
3235         problem.  In a future version we will change all behavior to be
3236         POSIX-conforming.
3237
3238         * NEWS: describe the change
3239         * src/rule.c (convert_to_pattern): If posix_pedantic don't make a
3240         pattern rule if prereqs exist.  Otherwise show a warning.
3241         * tests/scripts/features/suffixrules: Add tests for the new behavior
3242         including .POSIX vs. non-.POSIX.
3243
3244 2020-01-05  Dmitry Goncharov  <dgoncharov@users.sf.net>
3245
3246         * tests/test_driver.pl: Enhance error messages
3247
3248 2020-01-04  Paul Smith  <psmith@gnu.org>
3249
3250         * doc/make.texi: Change the GFDL to an Appendix
3251
3252         * NEWS: Clarify authorship of new features.
3253
3254         Enable compilation with C90 compilers
3255         * configure.ac: Try compiling Guile headers: they don't work with C90.
3256         * maintMakefile: Simplify config checks via target-specific variables.
3257         * src/makeint.h: Use ATTRIBUTE rather than defining __attribute__,
3258         as that causes compile issues with system headers.
3259         (ENUM_BITFIELD): Don't use enum bitfields in ANSI mode.
3260         * src/main.c: Use ATTRIBUTE instead of __attribute__.
3261         * src/job.h: Ditto.
3262         * src/file.c: Don't define variables inside for loops.
3263         * src/rule.c: Ditto.
3264         * src/dep.h (SI): Only use static inline in non-ANSI mode.
3265
3266 2020-01-03  Paul Smith  <psmith@gnu.org>
3267
3268         * bootstrap: Update to the latest gnulib version
3269
3270         Release GNU make 4.2.93
3271         * NEWS: Update the release and date
3272         * configure.ac: Update the release number
3273
3274         Update copyright statements for 2020
3275
3276 2020-01-03  Paul Smith  <psmith@gnu.org>
3277
3278         Support the .EXTRA_PREREQS special variable
3279         Initial implementation by Christof Warlich <cwarlich@gmx.de>
3280
3281         * NEWS: Announce the new feature.
3282         * doc/make.texi (Other Special Variables): Document .EXTRA_PREREQS.
3283         * src/dep.h (struct dep): New flag to note extra prereq deps.
3284         * src/filedef.h (expand_extra_prereqs): Declare a function to expand
3285         the value of .EXTRA_PREREQS.
3286         * src/file.c (expand_extra_prereqs): Given a struct variable lookup
3287         of .EXTRA_PREREQS, convert it into a list of deps and for each one
3288         make sure it has a struct file and has the new flag set.
3289         (snap_file): A new function invoked by hash_map that will perform
3290         per-file operations: set up second expansion, intermediate, and also
3291         .EXTRA_PREREQS.  Manage circular dependencies by ignoring them.
3292         (snap_deps): Defer per-file operations until the end.  Look up the
3293         global .EXTRA_PREREQS and pass it along to snap_file for each file.
3294         * src/implicit.c (struct patdeps): Remember the extra prereqs flag.
3295         (pattern_search): Transfer extra prereqs flag settings into the
3296         matched pattern rule.
3297         * src/rule.h (snap_implicit_rules): Rename count_implicit_rules to
3298         snap_implicit_rules since we now do more than count.
3299         * src/rule.c (snap_implicit_rules): As we walk through all the pattern
3300         rules, add in any global .EXTRA_PREREQS to the dep list.  Ensure we
3301         take them into account for the max number of prereqs and name length.
3302         * src/main.c (main): Add extra-prereqs to .FEATURES.
3303         Call the renamed snap_implicit_rules.
3304         * tests/scripts/variables/EXTRA_PREREQS: Add tests.
3305
3306 2020-01-03  Paul Smith  <psmith@gnu.org>
3307
3308         * tests/scripts/features/patternrules: Use Windows-compatible quoting
3309
3310         * tests/test_driver.pl: Compute full path to Perl interpreter
3311
3312         * tests/scripts/features/exec: Don't use $ENV in the description
3313
3314         * src/makeint.h: Add a declaration for memrchr()
3315
3316 2019-12-27  Paul Smith  <psmith@gnu.org>
3317
3318         * NEWS: Remove info about disabled /proc/loadavg usage.
3319
3320 2019-12-27  Paul Smith  <psmith@gnu.org>
3321
3322         [SV 57022] Avoid posix_spawn which fails asynchronously
3323         Avoid using posix_spawn implementations that fail asynchronously when
3324         the spawned program can't be invoked: this means instead of getting
3325         an error such as "No such file or directory" we get just "Exit 127".
3326
3327         Original implementation of the configure.ac macro provided by
3328         Martin Dorey <martin.dorey@hds.com>
3329
3330         Original implementation of the regression tests provided by
3331         Dmitry Goncharov <dgoncharov@users.sf.net>
3332
3333         * configure.ac: Test whether posix_spawn fails asynchronously.  In a
3334         cross-compilation environment, assume that it does not.  If we detect
3335         that it does, fall back to fork/exec.
3336         * tests/scripts/features/exec: Add regression tests for different
3337         shebang invocation methods.
3338
3339 2019-12-26  Paul Smith  <psmith@gnu.org>
3340
3341         [SV 56655] Allow pattern expansion to contain spaces
3342         * src/dep.h: Add a new flag PARSEFS_ONEWORD
3343         * src/read.c (parse_file_seq): If PARSEFS_ONEWORD is given, treat the
3344         entire incoming string as a single pattern.
3345         * src/implicit.c (pattern_search): Pass PARSEFS_ONEWORD when parsing
3346         patterns for wildcards.
3347         * tests/scripts/features/patternrules: Add a new test.
3348
3349 2019-12-18  Ben Wijen  <ben@wijen.net>
3350
3351         * src/misc.c (spin): On WINDOWS32 use Sleep() instead of sleep()
3352
3353         * bootstrap.bat: Fix typo in batch file name
3354
3355 2019-12-18  Paul Smith  <psmith@gnu.org>
3356
3357         * src/config.h.W32.template: [SV 57152] MinGW32 doesn't support d_type
3358
3359 2019-12-18  Jouke Witteveen  <j.witteveen@gmail.com>
3360
3361         [SV 54161] Fix second expansion of $* for paths
3362         If the stem matches a path containing a directory not just a
3363         filename, make sure the second expansion of $* in the
3364         prerequisites matches $* in the recipe.  This requires using
3365         $(*F) when replacing % in the first expansion to preserve the
3366         simple filename.
3367
3368         * src/implicit.c (pattern_search): If lastslash is set prepend
3369         the directory onto the stem.  Then use $(*F) when expanding %.
3370         * tests/scripts/features/se_implicit: Add a test case
3371
3372 2019-12-17  Jouke Witteveen  <j.witteveen@gmail.com>
3373
3374         * src/implicit.c (pattern_search): Set lastslash correctly
3375         If filename contained multiple slashes lastslash is wrongly set to 0.
3376         * configure.ac: Check for the GNU memrchr() extension function.
3377         * src/misc.c (memrchr): Supply memrchr() if not available.
3378
3379         * src/implicit.c (pattern-search): Remove unneeded 'dir' variable
3380
3381 2019-12-17  Paul Smith  <psmith@gnu.org>
3382
3383         * Makefile.am: Build lzip package instead of bzip2
3384         * README.git: Mention changed requirements.
3385
3386         * src/job.c (load_too_high): Disable Linux /proc/loadavg for now
3387         This new feature has a problem: if you provide a load which is
3388         larger than the number of cores then it will always run every job.
3389         Before we can enable it we need to at the least learn how to clamp
3390         this value to the number of cores.  To experiment with it, set
3391         PROC_FD_INIT to -2 in job.c to re-enable the feature.
3392
3393         * tests/run_make_tests.pl (set_more_defaults): Fix typo
3394
3395 2019-12-16  Paul Smith  <psmith@gnu.org>
3396
3397         * tests/run_make_tests.pl (subst_make_string): Force use of /
3398         On Windows the path to the helper tool will contain '\': this will
3399         fail if recipes are run with a POSIX shell.  Convert '\' to '/'
3400         on Windows.  While here, escape any spaces in the path as well.
3401
3402         Rename jhelp.pl to thelp.pl and make it a generic test helper.
3403         * tests/thelp.pl: Rename from tests/jhelp.pl.
3404         (op): Use names instead of options for the operations.
3405         (op): Add new operations for sleep, mkdir, and rm.
3406         (op): Enhance wait to time out
3407         * tests/run_make_tests.pl: Add a new #HELPER# replacement
3408         (subst_make_string): Use fully-qualified path to thelp.pl
3409         * tests/scripts/features/parallelism: Update to use thelp.pl
3410         and the new named operations.  Use thelp.pl sleep instead of
3411         system-specific sleep commands.
3412         * tests/scripts/features/output-sync: Update to use thelp.pl
3413         instead of complex shell scripts.
3414         * Makefile.am: Distribute tests/thelp.pl instead of tests/jhelp.pl
3415
3416 2019-10-10  Paul Eggert  <eggert@cs.ucla.edu>
3417
3418         Port functions/shell test to Solaris 10
3419         * tests/scripts/functions/shell: Port exit-status calculation
3420         to Solaris 10 with Perl 5.8.4.
3421
3422 2019-10-08  Paul Smith  <psmith@gnu.org>
3423
3424         Release GNU make 4.2.92
3425         * NEWS: Update the release and date
3426         * configure.ac: Update the release number
3427
3428 2019-10-06  Paul Smith  <psmith@gnu.org>
3429
3430         * doc/make.text (Reading Makefiles): Rewrite to be more clear.
3431
3432 2019-10-05  Paul Smith  <psmith@gnu.org>
3433
3434         * Makefile.am (check-regression): Use PERLFLAGS when running Perl
3435         * maintMakefile: Set PERLFLAGS to enable warnings.
3436         * tests/run_make_tests.pl: Clean up issues pointed out by perl -w.
3437
3438         * tests/scripts/functions/wildcard: Skip slash tests for local glob.
3439
3440         tests: Convert %CONFIG_FLAGS to get_config()
3441         * tests/config-flags.pm.W32: Create a predefined Windows file.
3442         * Makefile.am (test_FILES): Add it to the distribution.
3443         * build_w32.bat: Install tests/config-flags.pm if not existing.
3444         * tests/run_make_tests.pl (get_config): Create new function.
3445         * tests/scripts/features/archives: Call get_config() rather than
3446         using %CONFIG_FLAGS directly.
3447         * tests/scripts/features/load: Ditto.
3448         * tests/scripts/features/loadapi: Ditto.
3449         * tests/scripts/functions/wildcard: Ditto.
3450
3451         * src/hash.c (jhash_string): Don't read past end of string.
3452         Original patch from Dmitry Goncharov <dgoncharov@users.sf.net>.
3453
3454         * tests/run_make_tests.pl (valid_option): Add missing File::Spec
3455
3456 2019-09-23  Paul Smith  <psmith@gnu.org>
3457
3458         * src/function.c (func_realpath) [AIX]: Remove trailing slashes.
3459
3460 2019-09-22  Paul Smith  <psmith@gnu.org>
3461
3462         * tests/scripts/features/vpathplus: Fix output for big-endian systems.
3463         Our hashing algorithm gives different ordering on LE vs BE systems.
3464         Patch from Dmitry Goncharov <dgoncharov@users.sf.net>.
3465
3466 2019-09-22  Florian Weimer  <fweimer@redhat.com>  (tiny change)
3467
3468         * configure.ac (HAVE_GETTIMEOFDAY): Avoid undeclared exit function.
3469
3470 2019-09-22  Paul Smith  <psmith@gnu.org>
3471
3472         * test/test_driver.el (_run_with_timeout): Show error message.
3473
3474         * job.c (child_error): Modify error message string.
3475         This reverts commit 6264deece3bb77798240a906ceed79097adbcf48.
3476         Further investigation discovers that the real issue is that
3477         GNU Emacs compile mode doesn't have a matching regex for GNU
3478         make error messages generated when targets fail.  I submitted
3479         a patch to GNU Emacs adding a matcher for compile mode.
3480
3481 2019-09-21  Paul Smith  <psmith@gnu.org>
3482
3483         * tests: Convert from File::Spec::Functions to File::Spec.
3484         Users report the Functions version doesn't work correctly for some
3485         older versions of Perl.
3486
3487         * tests/scripts/function/guile: Valgrind doesn't work with Guile.
3488
3489         * src/job.c (child_execute_job): Allocate space for argv NULL.
3490
3491 2019-09-21  Paul Smith  <psmith@gnu.org>
3492
3493         [SV 56918] Compute job slots properly on failing command
3494         Ensure we properly reduce job_slots_used if a command fails because
3495         it doesn't exist/can't be started.
3496
3497         * src/job.h (struct child): Add a field jobslot to be set when using
3498         a job slot.
3499         * src/job.c (start_waiting_job): Remember if we are using a job slot.
3500         (reap_children): Reduce number of job slots used by jobslot.
3501
3502 2019-09-21  Paul Smith  <psmith@gnu.org>
3503
3504         * src/arscan.c (ar_scan): Restrict length for sscanf of ar_mode.
3505
3506         * tests/scripts/functions/shell: Detect correct SHELLSTATUS code.
3507
3508         * tests/run_make_test.pl: Fix support for valgrind.
3509         Change the variable holding the make command to be a list that can
3510         hold extra commands and options, not just a string.
3511
3512         * tests/run_make_tests.pl (find_prog): Fix syntax error.
3513
3514 2019-09-16  Paul Smith  <psmith@gnu.org>
3515
3516         * NEWS: Update date and clarify -l change.
3517
3518         * tests/run_make_tests.pl: Create $scriptsuffix for Windows/VMS.
3519         * tests/scripts/features/targetvars: Add a suffix to scripts.
3520         * tests/scripts/misc/general4: Ditto.
3521
3522 2019-09-16  Paul Smith  <psmith@gnu.org>
3523
3524         Refresh the test suite framework implementation.
3525         Go through both run_make_tests.pl and test_driver.pl and slightly
3526         modernize the Perl and clean up indentation etc.  Fix a number of
3527         warnings in the test scripts detected by running with -w.
3528
3529         * tests/test_driver.pl: Move make error string detection out of the
3530         base test driver.
3531         (run_all_tests): Ensure that we always look for tests in the cwd.
3532         * tests/run_make_tests.pl: Use File::Spec for path manipulations.
3533         Correctly use setlocale() when detecting error strings.
3534         Get configuration from the config-flags.pm file not config.status.
3535         * tests/scripts/features/archives: Use new $cwddir variable.
3536         * tests/scripts/features/reinvoke: Add missing semicolon.
3537         * tests/scripts/features/vpath2: Avoid non-existent variable.
3538         * tests/scripts/functions/foreach: Escape variables.
3539         * tests/scripts/misc/bs-nl: Remove non-existing \v escape sequence.
3540         * tests/scripts/misc/general4: Use handy create_file().
3541         * tests/scripts/options/dash-C: Use Cwd/$cwddir.
3542         * tests/scripts/options/dash-I: Use subst_make_string() and #PWD#.
3543         * tests/scripts/options/symlinks: Use File::Spec.
3544         * tests/scripts/targets/DEFAULT: Use create_file and run_make_test.
3545         * tests/scripts/variables/CURDIR: Use run_make_test.
3546         * tests/scripts/variables/automatic: Remove extraneous "\".
3547         * tests/scripts/vms/library: Remove extra "my" and extraneous "\".
3548
3549 2019-09-16  Paul Smith  <psmith@gnu.org>
3550
3551         * tests/config-flags.pm.in: Add USE_SYSTEM_GLOB.
3552         * tests/config_flags_pm.com [VMS]: Ditto.
3553
3554         * README.git: [SV 56895] Provide more info about "maintainer mode".
3555         * src/read.c (get_next_mword) [HAVE_DOS_PATHS]: Don't fall through to
3556         parsing variable references if we find a drivespec in a word!
3557
3558         * tests/test_driver.pl: Remember error for "running" a directory.
3559         * tests/scripts/features/errors: Check errors "running" a directory.
3560
3561         * src/job.c (child_execute_job): Use errno from find_in_given_path().
3562         * tests/test_driver.pl: Determine non-executable error message.
3563         * tests/scripts/features/errors: Use the local non-executable error.
3564
3565         * src/job.c (child_execute_job): Use newer gnulib findprog version.
3566
3567 2019-09-10  Eli Zaretskii  <eliz@gnu.org>
3568
3569         Revert "[SV 56449] (Windows) Use slow path if '%' appears in the command"
3570         This reverts commit 38e96eadea6e2cd42a0f414959bac327de9f468a.
3571         Per discussion on Savannah, the modified behavior matches
3572         the way % is handled in batch files, but not in cmd command
3573         lines.  And since Make mostly tries to emulate the command
3574         line, the new behavior is unexpected and backward-incompatible.
3575
3576 2019-09-09  Paul Smith  <psmith@gnu.org>
3577
3578         Rework the creation of build.sh so it's not a template.
3579         * build.sh: Rename from build.template.  Get the list of objects
3580         from the Makefile.  Move configure-replaced variables ...
3581         * build.cfg.in: to this new .in file.
3582         * configure.ac: Remove special handling of build.sh.in and add
3583         build.cfg as a generated file.
3584         * Makefile.am (EXTRA_DIST): Remove build.sh.in and add build.sh
3585         and build.cfg.in for build.sh.in.
3586         * maintMakefile: Remove handling for build.template.  Treat
3587         build.sh as a source file, not a generated file.
3588         * .gitignore: Ignore generated build.cfg file.
3589
3590 2019-09-08  Paul Smith  <psmith@gnu.org>
3591
3592         * gl/modules/make-glob: Move local glob configure.ac to here
3593         * configure.ac: from here.
3594
3595 2019-09-08  Paul Smith  <psmith@gnu.org>
3596
3597         [SV 56834] Support local PATH search with posix_spawnp
3598         When using exec we install the child's environment before invoking
3599         execlp(), so commands are found on the child's PATH.  posix_spawnp
3600         searches on the parent's PATH, which we don't want.
3601
3602         Import gnulib's findprog-in module and use it to search the child's
3603         PATH, then use posix_spawn() to run it.
3604
3605         Also, posix_spawn() does not fall back to trying sh on ENOEXEC, as
3606         execlp() does, so implement that as well.
3607
3608         * bootstrap.conf: Add the findprog-in gnulib module
3609         * src/job.c: Include findprog.h if we're using posix_spawn.
3610         (start_job_command): Remove the handling of child->cmd_name,
3611         (child_execute_job): and add it here.  Look up the command to be
3612         run in the child's path and invoke it if found.  If it fails with
3613         ENOEXEC then retry it as an argument to the default shell.
3614         * tests/scripts/misc/general4: Test makefile PATH assignments.
3615         * tests/scripts/features/targetvars: Ditto, for target variables.
3616
3617 2019-09-07  Paul Smith  <psmith@gnu.org>
3618
3619         * doc/make.texi (Recipe Execution): Correct example to use $(<[DF])
3620
3621         * configure.ac: Check whether struct dirent has a d_type field
3622         * src/dir.c (dir_contents_file_exists_p): Use the autoconf macro
3623         HAVE_STRUCT_DIRENT_D_TYPE rather than relying on the GNU libc-
3624         specific _DIRENT_HAVE_D_TYPE.
3625         * lib/glob.c: Set HAVE_D_TYPE if HAVE_STRUCT_DIRENT_D_TYPE.
3626
3627         * src/config.h.W32.template [W32]: Add support for dirent.d_type
3628         * src/w32/include/dirent.h: Add DT_* values for dirent.d_type
3629         (struct dirent): Add d_type
3630         * src/w32/compat/durent.c (readdir): Set dirent.d_type based on
3631         Windows file attributes.
3632
3633         * src/makeint.h: Add typedef for mode_t if !HAVE_UMASK
3634
3635         * build.template: Rewrite to allow gnulib support.
3636
3637         * doc/make.texi: Clarify that the jobserver pipe is "blocking"
3638
3639 2019-09-07  Paul Smith  <psmith@gnu.org>
3640
3641         Align child_execute_job among different ports
3642         Create a struct childbase which is the basics of struct child needed
3643         to invoke child_execute_job(), and can be cast back and forth to a
3644         struct child.  Ensure all implementations of child_execute_job() take
3645         the same arguments.
3646
3647         * src/job.h (CHILDBASE): Create a macro to hold the base parts.
3648         (struct childbase): A structure containing CHILDBASE.
3649         (struct child): Use CHILDBASE as the initial part of child.
3650         [VMS]: Remove declaration of VMS version of child_execute_job.
3651         * src/job.c (start_job_command): Use new child_execute_job() call.
3652         (child_execute_job) [__EMX__]: Implement new calling signature.
3653         (child_execute_job): Implement new calling signature.
3654         * src/main.c (main) [__EMX__]: Use new child_execute_job() call.
3655         * src/function.c (func_shell_base): Use new child_execute_job() call.
3656         * src/vmsjobs.c (vmsHandleChildTerm): Accept struct childbase.
3657         * src/vmsjobs.c (child_execute_job): Implement new calling signature.
3658         Modify the return value to be pid_t, not a boolean, and return the
3659         PID rather than setting it in the child.  This is OK because our only
3660         caller immediately reset PID to -1 anyway if we return 0.
3661
3662 2019-09-07  Paul Smith  <psmith@gnu.org>
3663
3664         * doc/make.tex (Substitution Refs): Clarify patsubst relationship.
3665
3666         * src/job.c (start_job_command) [VMS]: Correct VMS comment.
3667
3668 2019-09-07  Paul Smith  <psmith@gnu.org>
3669
3670         Show useful errors when posix_spawn() doesn't do so
3671         The posix_spawn() function may not detect that the command to run is
3672         invalid when it's invoked.  Instead, it will run then exit with
3673         error code 127.  If that happens do our best to present the user
3674         with a useful error message.
3675
3676         * src/job.h (struct child): Add cmd_name to hold the command we ran.
3677         * src/job.c (start_job_command): On success, remember the cmd_name.
3678         (reap_children): On exit 127, stat cmd_name and show a useful error.
3679         (free_child): Free cmd_name.
3680
3681 2019-09-07  Paul Smith  <psmith@gnu.org>
3682
3683         * README.git: Describe GCC and GNU make requirements
3684         * maintMakefile: Put custom C flags into a separate variable
3685         so they can be overridden more easily on the command line.
3686
3687         * tests/scripts/features/archives: Fix expected long ar name output.
3688
3689         * tetss/run_make_test.pl: Avoid 'sh -c' for Windows portability.
3690
3691         Update to GNU make release candidate 4.2.91
3692
3693         * tests/scripts/functions/wildcard: Skip dangling symlink test.
3694         The built-in glob implementation does not correctly handle dangling
3695         symlinks.  This needs to be fixed by switching to the latest glob
3696         implementation from gnulib but that's a big job: for now avoid the
3697         test if we know it will fail.
3698
3699         * maintMakefile: Use check-local when testing build.sh.
3700         Running 'make check' will rebuild 'make' so we're not testing the
3701         build.sh-generated make binary.
3702
3703 2019-09-07  Paul Smith  <psmith@gnu.org>
3704
3705         Don't reset stack size when using posix_spawn()
3706         There's no way to run setrlimit() from posix_spawn() so we can't reset
3707         the stack limit in children; thus, don't change it in the parent.
3708
3709         * src/makeint.h (SET_STACK_SIZE): Don't set this when HAVE_POSIX_SPAWN.
3710         * src/job.c (child_execute_job): Remove useless comment.
3711
3712 2019-09-07  Paul Smith  <psmith@gnu.org>
3713
3714         * configure.ac: Remove redundant getloadavg gnulib support
3715
3716         * src/dir.c (dir_setup_glob): Initialize unused gl_offs.
3717         * tests/scripts/functions/wildcard: Add trailing slash tests.
3718         Initial changes by Dmitry Goncharov <dgoncharov@users.sf.net>
3719
3720 2019-09-02  Paul Eggert  <eggert@cs.ucla.edu>
3721
3722         Pacify Oracle Studio c99
3723         * src/dep.h (DEP):
3724         * src/function.c (struct function_table_entry):
3725         Use unsigned int, not unsigned short.  Without this patch, c99
3726         complains â€˜warning: nonportable bit-field type’.
3727
3728         Port grouped_targets test to Solaris 10
3729         * tests/scripts/features/grouped_targets: Use â€˜printf ''’
3730         instead of â€˜echo -n’, as POSIX says the latter is not portable.
3731
3732         Remove useless code in eval
3733         * src/read.c (eval): Remove useless code.  Without this patch,
3734         Oracle Studio 12.6 complains â€˜"src/read.c", line 1405: warning:
3735         loop not entered at top’.
3736
3737         Pacify Oracle Studio 12.6 in init_switches
3738         * src/main.c (init_switches): Use a cast to convert char const *
3739         to char *.  Without this patch, the compiler complains
3740         â€˜"src/main.c", line 2643: warning: assignment type mismatch:
3741         pointer to char "=" pointer to const char’.
3742
3743         Pacify Oracle Studio 12.6
3744         * src/arscan.c [VMS]: Use â€˜#if !defined LBR$_HDRTRUNC’ instead
3745         of â€˜#ifndef LBR$_HDRTRUNC’ to pacify Oracle Studio 12.6, which
3746         looks inside unused #if branches for preprocessor syntax errors.
3747         Without this patch it complains â€˜"src/arscan.c", line 43: warning:
3748         tokens ignored at end of directive line’.
3749
3750 2019-09-02  Paul Smith  <psmith@gnu.org>
3751
3752         * NEWS: Fix incorrect notes.
3753
3754         * src/read.c (parse_file_seq): [SV 52076] Don't reverse glob() results.
3755
3756 2019-08-28  Eli Zaretskii  <eliz@gnu.org>
3757
3758         Fix MS-Windows MinGW build
3759         * src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects):
3760         Fix format specifier for GetLastError's value.
3761
3762         * src/job.c (reap_children): Define the 'remote_status_lose' label
3763         only for Posix platforms, to avoid compiler warning.
3764
3765         * build_w32.bat (LNKOUT): New variable, using forward slashes.
3766         Use forward slashes in calls to :Compile, so that linking with GNU
3767         ld works.
3768
3769         * src/makeint.h [!HAVE_UMASK]: Prototype for 'umask'.
3770         (UMASK, MODE_T): Don't define.
3771
3772         * src/misc.c (get_tmpfile): Don't call UMASK, call umask, to
3773         avoid compilation warning on !HAVE_UMASK platforms.
3774         * src/output.c (output_tmpfd): Likewise.
3775
3776         * src/misc.c (umask) [!HAVE_UMASK]: New no-op function.
3777
3778         * src/config.h.W32.template (__USE_MINGW_ANSI_STDIO)
3779         [__MINGW32__]: Define to 1, to force Make use ANSI-compatible
3780         stdio functions, which also support the non-standard 'Id' and 'Ix'
3781         specifiers.
3782         (HAVE_UMASK) [__MINGW32__]: Define to 1.
3783
3784         * src/arscan.c (ar_member_touch): Type-cast argument of strlen to
3785         avoid compiler warnings.
3786
3787 2019-08-26  Paul Smith  <psmith@gnu.org>
3788
3789         * NEWS: Update for pre-release
3790
3791 2019-08-26  Paul Smith  <psmith@gnu.org>
3792
3793         Update maintainer mode to support debug wait points.
3794         Make a spin() method available when compiled in maintainer mode.
3795         If a file exists in the working directory with a specific name,
3796         make will sleep until the file is deleted.
3797
3798         Ensure that maintainer mode is enabled on Windows, using the same
3799         algorithm we use on POSIX / autoconf systems.
3800
3801         * build_w32.bat: If maintMakefile exists, enable maintainer mode.
3802         * src/main.c (main): Replace Windows-only suspend flag with spin().
3803         * src/makeint.h: A SPIN() macro calls spin() in maintainer mode.
3804         * src/misc.c (spin): If a spin file exists sleep until it's deleted.
3805
3806 2019-08-26  Paul Smith  <psmith@gnu.org>
3807
3808         * tests/scripts/features/archives: [SV 54395] Support non-GNU ar.
3809
3810         * tests/scripts/misc/general3: Add more tests for SHELL/.SHELLFLAGS
3811
3812 2019-08-25  Paul Smith  <psmith@gnu.org>
3813
3814         * src/job.c (construct_command_argv): Remove unused VMS code
3815
3816         * src/job.c (child_execute_job): Set pid to -1 on posix_spawn failure.
3817
3818 2019-08-24  Paul Smith  <psmith@gnu.org>
3819
3820         * bootstrap: Update from latest gnulib version
3821
3822         * scripts/copyright-update: Use git ls-files for controlled files
3823
3824         * po/LINGUAS: Add a translation for Bulgarian.
3825
3826 2019-07-14  Christian Eggers  <ceggers@arri.de>  (tiny change)
3827
3828         [SV 56449] (Windows) Use slow path if '%' appears in the command
3829         * src/job.c (sh_chars_dos): Add '%' as a special character
3830         * src/job.c (construct_command_argv_internal): Check for '%' in quotes
3831
3832         For the windows version of make, a recipe line cannot be executed
3833         diretly by make (without a shell) if a '%' character is present. This
3834         character starts a cmd.exe escape sequence.
3835
3836 2019-07-14  Paul Smith  <psmith@gnu.org>
3837
3838         * src/read.c (parse_file_seq): Update comments.
3839
3840 2019-07-13  Mike Haboustak  <haboustak@gmail.com>  (tiny change)
3841
3842         [SV 28456] Don't override $< when no default rule has been defined
3843         The check for matching a file's command to the default rule's command
3844         does not account for null. If no .DEFAULT is defined a rule with no
3845         recipe has it's $< variable set to the value of $@. This breaks second
3846         expansion, particularly when used with pattern rules.
3847
3848         * src/commands.c [set_file_variables]: Check that cmds is set
3849         * tests/scripts/features/se_explicit: Test case
3850         * tests/scripts/features/se_implicit: Test case
3851
3852 2019-07-13  Paul Smith  <psmith@gnu.org>
3853
3854         Switch to the gnulib version of strerror()
3855         * bootstrap.conf: Add strerror module
3856         * configure.ac: Remove strerror check
3857         * src/misc.c: Remove local strerror() implementation
3858         * src/config.ami.template: Remove HAVE_STRERROR
3859         * src/config.h-vms.template: Ditto.
3860         * src/config.h.W32.template: Ditto.
3861
3862 2019-05-19  Paul Smith  <psmith@gnu.org>
3863
3864         * doc/make.texi: [SV 51974] Clarify makefile parsing operations.
3865
3866         * doc/make.texi: [SV 54116] Document whitespace removal trick.
3867         Discovered and explained by Michael Henry <gnu@drmikehenry.com>
3868         * tests/scripts/variables/flavors: Add a test to preserve the behavior.
3869
3870 2019-05-19  Paul Smith  <psmith@gnu.org>
3871
3872         [SV 46013] Allow recursive variable overrides from Makefiles
3873         Ensure that variable overrides are passed to recursive make instances
3874         even if no overrides were provided on the command line.
3875         Fix suggested by Rici Lake <ricilake@gmail.com>
3876
3877         * src/main.c (define_makeflags): Add overrides without respect to the
3878         value of command_variables.
3879         * tests/scripts/features/recursion: Add a test.
3880
3881 2019-05-19  Paul Smith  <psmith@gnu.org>
3882
3883         Update developer customizations
3884         * .ccls: Remove -std=c99: it disables __attribute__ causing warnings.
3885         * .dir-locals.el: Force the C coding style to "gnu".
3886         * make-gdb.py: Add GDB macros for pretty-printing GNU make structs.
3887         * scripts/copyright-update: Use GNULIB_SRCDIR to find update-copyright.
3888
3889 2019-05-19  Paul Smith  <psmith@gnu.org>
3890
3891         [SV 54549] Don't free used set_lists during merge
3892         When merging the variable_set_lists for two targets it could be
3893         that the "from" set list is a subset of the "to" set list: check
3894         for this situation to avoid freeing used memory.
3895
3896         * src/variable.c (merge_variable_set_lists): Walk the "to" list and
3897         if the "from" list is contained in it, nothing to do.
3898         * tests/scripts/features/se_explicit: Add a test.
3899
3900 2019-05-19  Paul Smith  <psmith@gnu.org>
3901
3902         * src/hash.c (jash_string): [SV 54980] Avoid ASAN error
3903
3904 2019-05-19  Paul Smith  <psmith@gnu.org>
3905
3906         [SV 54740] Ensure .SILENT settings do not leak into sub-makes
3907         Create a new variable run_silent to hold the current instance's global
3908         silence setting, allowing silent_flag to represent only whether the -s
3909         option was provided on the command line.
3910
3911         * src/makeint.h: Change silent_flag variable to run_silent.
3912         * src/job.c: Ditto.
3913         * src/remake.c: Ditto.
3914         * src/file.c: Ditto.
3915         * src/main.c: Add a new global variable run_silent.
3916         (decode_switches): After switches are decoded, initialize run_silent.
3917         * tests/scripts/targets/SILENT: Add a test for recursive behavior.
3918
3919 2019-05-19  Paul Smith  <psmith@gnu.org>
3920
3921         Update copyright statements for 2019
3922
3923 2019-05-12  Kaz Kylheku  <kaz@kylheku.com>
3924
3925         [SV 8297] Implement "grouped targets" for explicit rules.
3926         This patch allows "grouped targets" using the &: syntax:
3927
3928           tgt1 tgt2 ... tgtn &: pre1 pre2 ...
3929                 recipe
3930
3931         When the &: separator is used (in single or double colon forms), all
3932         the targets are understood to be built by a single invocation of the
3933         recipe.  This is accomplished by piggy-backing on the already-existing
3934         pattern rule feature, using the file's "also_make" list.
3935
3936         * NEWS: Add information about grouped targets.
3937         * doc/make.texi (Multiple Targets): Add information on grouped targets.
3938         (Pattern Intro): Refer to the new section to discuss multiple patterns.
3939         * src/main.c (main): Add "grouped-targets" to .FEATURES
3940         * src/read.c (make_word_type): Add new types for &: and &::.
3941         (eval): Recognize the &: and &:: separator and remember when used.
3942         (record_files): Accept an indicator of whether the rule is grouped.
3943         If so, update also_make for each file to depend on the other files.
3944         (get_next_mword): Recognize the &: and &:: word types.
3945         * tests/scripts/features/grouped_targets: New test script.
3946         * AUTHORS: Add Kaz Kylheku
3947
3948 2019-05-12  Paul Smith  <psmith@gnu.org>
3949
3950         * variable.c (define_variable_in_set): Clear new structs
3951
3952         * po/LINGUAS: Add Portuguese translation
3953
3954         Add developer customizations
3955         * .ccls: Configure the ccls LSP server
3956         * .dir-locals.el: Reset some parameters for ccls and lsp-mode
3957         * .gitignore: Update for GTAGS and ccls
3958         * maintMakefile: Don't search hidden directories for sources
3959
3960 2018-09-16  Paul Smith  <psmith@gnu.org>
3961
3962         * src/arscan.c (ar_member_touch): [SV 54533] Stop \0 in archive headers
3963
3964         Change output_write() to writebuf(), add readbuf() helper.
3965         * src/misc.c (writebuf, readbuf): Create helper functions that will
3966         reliably write a buffer to a file descriptor in the face of EINTR
3967         causing short writes, and read from a file descriptor into a buffer
3968         in the face of EINTR causing short reads.
3969         * src/makeint.h: Declare these functions.
3970         * src/output.c: Remove output_write() and replace with writebuf().
3971         (_outputs, out_of_memory): Call writebuf(), not output_write().
3972         * src/arscan.c (ar_scan): Call readbuf() instead of read(2).
3973         (ar_member_touch): Remove duplicate header write, call writebuf()
3974         instead of output_write(), and readbuf() instead of read(2).
3975
3976 2018-09-15  Paul Smith  <psmith@gnu.org>
3977
3978         * doc/make.texi (Remaking Makefiles): [SV 52273] Note MAKE_RESTARTS
3979
3980         * src/main.c (main): Set jobserver permissions before re-execing
3981         Fixes an issue seen in the Linux kernel build system, reported by
3982         Masahiro Yamada <yamada.masahiro@socionext.com>.  Fix suggested
3983         on the bug-make mailing list by Mike Shal <marfey@gmail.com>.
3984         * tests/scripts/features/parallelism: Add a test to verify this.
3985
3986         * doc/make.texi: [SV 48970] Clarify the value of $?
3987
3988         * doc/make.text: [SV 54360] Weaken "obsolete" language in the manual.
3989         There's no need to frighten users away from capabilities which are
3990         perfectly reasonable and definitely not going away, by calling them
3991         obsolete or discouraged in the manual.
3992
3993         [SV 40657] Don't create pattern rules for suffix rules with deps.
3994         * NEWS: Update with a backward-compatibility warning.
3995         * src/rule.c (convert_to_pattern): If a suffix rule has dependencies,
3996         do not create a pattern rule for it.  According to the manual suffix
3997         rules with prerequisites are treated as normal targets.
3998         * tests/scrips/features/suffixrules: Create some regression tests for
3999         .SUFFIXES and suffix rules.
4000
4001 2018-08-04  Paul Smith  <psmith@gnu.org>
4002
4003         * NEWS: Update for the latest changes.
4004
4005 2018-08-04  Paul Smith  <psmith@gnu.org>
4006
4007         [SV 54233] Preserve higher command_state values on also_make targets.
4008         If multiple pattern rules have the same pattern as also-make targets
4009         and we attempt to run them at the same time, we might downgrade the
4010         command state from 'running' to 'deps_running'; this will prevent
4011         that also_make from being considered complete causing make to wait
4012         forever for it to finish.
4013
4014         Ensure that set_command_state never downgrades the state of a target.
4015
4016         * src/file.c (set_command_state): Don't downgrade command_state.
4017         * src/filedef.h (struct file): Document the order prerequisite.
4018         * test/scripts/features/patternrules: Test the behavior.
4019
4020 2018-08-04  Paul Smith  <psmith@gnu.org>
4021
4022         * src/job.c (reap_children): Fix inverted win/lose message.
4023
4024         * tests/scripts/functions/wildcard: [SV 52018] Test dangling symlink.
4025
4026 2018-08-04  Bernhard M. Wiedemann  <bwiedemann@suse.de>
4027
4028         * src/read.c (parse_file_seq): [SV 52076] Sort wildcard results.
4029
4030 2018-08-04  Paul Smith  <psmith@gnu.org>
4031
4032         * tests/scripts/features/archives: [SV 54395] Test long archive names.
4033
4034 2018-08-04  Ben Hutchings  <ben@decadent.org.uk>
4035
4036         * src/arscan.c (ar_scan): [SV 54395] Allow long names in archives.
4037         Commit bc9d72beb0cb "Resolve issues discovered by static code
4038         analysis." added range checks on archive member name length.  However,
4039         on non-AIX systems it also checked BSD-style long names against the
4040         short name limits and and checked the *offset* for GNU-style long
4041         names against the short name limits.  This caused valid long names to
4042         be rejected.
4043
4044         * Record the size of the GNU name map and validate offsets against it
4045         * Ensure that the last entry in the name map is null-terminated
4046         * Apply a maximum length of INT_MAX for element sizes
4047
4048         Reported-by: Philipp Wolski <philipp.wolski@kisters.de>
4049
4050 2018-08-04  Paul Smith  <psmith@gnu.org>
4051
4052         * lib/glob.c (glob_in_dir): [SV 53465] Allow symlinks to directories.
4053         Fix from Rich Felker <bugdal@aerifal.cx> on the musl mailing list.
4054         * tests/scripts/functions/wildcard: Create a regression test for this.
4055
4056         * configure.ac: Add --disable-posix-spawn option
4057         * maintMakefile: Add a test for the option
4058         * src/job.c: Change HAVE_* preprocessor checks to USE_POSIX_SPAWN
4059
4060         * src/job.c (child_execute_job): Clean up posix_spawn invocation
4061
4062 2018-08-04  Aron Barath  <baratharon@caesar.elte.hu>
4063
4064         * job.c (child_execute_job): Prefer posix_spawn() over fork()/exec()
4065
4066 2018-08-04  Paul Smith  <psmith@gnu.org>
4067
4068         Clean up errors for invalid commands and add regression tests.
4069         * src/function.c (func_shell_base): Use error() instead of recreating
4070         the error output.
4071         * src/job.c (exec_command): Show more standard error messages.
4072         * src/load.c (unload_file): Fix whitespace in the error message.
4073         * tests/scripts/features/errors: Add tests for starting non-
4074         existent commands and new error message formats.
4075         * tests/scripts/features/output-sync: New error message formats.
4076         * tests/scripts/functions/shell: Ditto.
4077
4078 2018-08-04  Paul Smith  <psmith@gnu.org>
4079
4080         Queue failed fork() (etc.) to be handled like any other failed job.
4081         If we failed to fork() we were essentially exiting make immediately
4082         without respect to ignore flags, etc.  On one hand that makes sense
4083         because if you can't fork you're in real trouble, but it doesn't
4084         work so well on systems where we don't fork at all.  Instead, treat
4085         a fork error like any other error by delaying the handling until
4086         the next call to reap_children().  Any child with a PID of -1 is
4087         considered to have died before starting so check these first without
4088         waiting for them.
4089
4090         * src/commands.c (fatal_error_signal): Don't kill children that
4091         never started.
4092         * src/function.c (func_shell_base): Handle cleanup properly if the
4093         child doesn't start.
4094         * src/job.c (reap_children): Check for children that died before
4095         starting and handle them without waiting for the PID.
4096         (start_job_command): Free memory when the child doesn't start.
4097         (start_waiting_job): Don't manage children who never started.
4098         (child_execute_job): If the fork fails return PID -1.
4099         * src/vmsjobs.c: Check for children that never started.
4100         * tests/run_make_tests.pl: Parse config.status to get all options.
4101
4102 2018-08-02  Aron Barath  <baratharon@caesar.elte.hu>
4103
4104         * configure.ac: Check for posix_spawnattr_setsigmask
4105
4106         * configure.ac: Check for spawn.h and posix_spawn()
4107
4108         * src/makeint.h: Use pid_t to store PIDs, of int.
4109         * src/commands.c (getpid): Ditto.
4110         * src/job.h (*): Ditto.
4111         * src/job.c (*): Ditto.
4112         * src/main.c (main): Ditto.
4113         * src/remote-cstms.c (start_remote_job): Ditto.
4114         * src/remote-stub.c (start_remote_job): Ditto.
4115
4116 2018-08-02  spagoveanu@gmail.com  <spagoveanu@gmail.com>  (tiny change)
4117
4118         * src/dir.c: Preserve glob d_type field
4119         When using GNU make on a system with glibc glob a pattern ending in
4120         a slash is also matching regular files, but only in subdirectories:
4121
4122         $ mkdir -p dir/subdir
4123         $ cd dir
4124         $ touch file1 subdir/file2
4125         $ echo 'test:; @echo $(wildcard */ */*/)' | make -f -
4126         subdir/ subdir/file2
4127         $ echo 'test: */ */*/; @echo "$?" != */ */*/' | make -f -
4128         subdir/ subdir/file2 != subdir/ */*/
4129
4130         It happens because in the gl->gl_readdir callback supplied to glob(),
4131         dirent->d_type is set to DT_UNKNOWN, and the glob() implementation
4132         in glibc assumes that such a directory entry *cannot* possibly be a
4133         regular file.
4134
4135         Pass the actual d_type down to glob(); this is the right thing to do
4136         even if glibc is fixed, because it saves an extra stat() syscall for
4137         each dirent.
4138
4139 2018-08-02  Paul Smith  <psmith@gnu.org>
4140
4141         * src/read.c(unescape_char): Use C comments not C++ comments.
4142         * src/posixos.c(set_blocking): Ditto.
4143         * src/w32/subproc/sub_proc.c(process_init): Ditto
4144
4145         Enhance the Basic.mk environment to work with Gnulib
4146         * maintMakefile: Omit generated headers from Basic.mk prerequisites.
4147         * Basic.mk.template: Rework commands to use with $(call ...) macros.
4148         * mk/Amiga.mk: Ditto.
4149         * mk/VMS.mk: Ditto.
4150         * mk/Windows32.mk: Ditto, plus P2W to convert POSIX to Windows paths.
4151         * mk/msdosdjgpp.mk: Ditto.
4152
4153 2018-07-02  Paul Smith  <psmith@gnu.org>
4154
4155         Resolve most of the Windows Visual Studio warnings.
4156         * Convert integer types to size_t where necessary.
4157         * Align other integral types to avoid casts and type warnings.
4158
4159 2018-07-02  Paul Smith  <psmith@nuodb.com>
4160
4161         Update regression tests for Windows.
4162         * tests/scripts/features/jobserver: Windows doesn't use pipes
4163         * tests/scripts/functions/shell: Don't test kill -2 on Windows
4164         * tests/scripts/misc/bs-nl: Windows doesn't handle single quotes
4165         * tests/scripts/misc/general3: Ditto.
4166
4167         * maintMakefile: Preserve comments during compilation
4168
4169         * function.c(abspath): Use memcpy() to avoid GCC 8.1 warnings
4170
4171 2018-07-02  Paul Smith  <psmith@nuodb.com>
4172
4173         Convert GNU make to use the gnulib portability library
4174         Move content from glob/* and config/* into standard GNU directory
4175         locations lib/* and m4/*.
4176
4177         Install the gnulib bootstrap script and its configuration file, and
4178         create a bootstrap.bat file for Windows.  Update the README.git file
4179         with new requirements and instructions for building from Git.
4180
4181         At this point we only install the alloca, getloadavg, and FDL modules
4182         from gnulib.  We keep our old glob/fnmatch implementation since the
4183         gnulib versions require significant amounts of infrastructure which
4184         doesn't exist on Windows yet.  Further work is required here.
4185
4186         Due to a problem with gnulib's version of getloadavg, we need to bump
4187         the minimum required version of automake to 1.16.1 unfortunately.
4188
4189         * README.git: Update instructions
4190         * NEWS: Move developer news to a separate section
4191         * configure.ac: Update for use with gnulib modules
4192
4193         * bootstrap: Bootstrap from Git workspace (import from gnulib)
4194         * bootstrap.conf: Bootstrap configuration for GNU make
4195         * bootstrap.bat: Bootstrap from Git workspace for Windows
4196         * gl/modules/make-glob: Support our local fnmatch/glob implementation
4197
4198         * config/acinclude.m4: Move to m4/
4199         * config/dospaths.m4: Move to m4/
4200         * glob/fnmatch.c: Move to lib/
4201         * glob/fnmatch.h.in: Move to lib/
4202         * glob/glob.c: Move to lib/
4203         * glob/glob.h.in: Move to lib/
4204
4205         * Makefile.am: Update for new directories
4206         * build.template: Update for new directories
4207         * build_w32.bat: Update for new directories
4208         * builddos.bat: Update for new directories
4209         * maintMakefile: Update for new directories
4210         * makefile.com: Update for new directories
4211         * mk/Amiga.mk: Update for new directories
4212         * mk/Posix.mk.in: Update for new directories
4213         * mk/VMS.mk: Update for new directories
4214         * mk/Windows32.mk: Update for new directories
4215         * mk/msdosdjgpp.mk: Update for new directories
4216
4217         * po/LINGUAS: One language per line (needed by gnulib)
4218
4219         * INSTALL: Remove (obtained from gnulib)
4220         * src/alloca.c: Remove (obtained from gnulib)
4221         * src/getloadavg.c: Remove (obtained from gnulib)
4222         * po/Makevars: Remove (created by bootstrap)
4223         * config/*: Remove leftover files
4224         * glob/*: Remove leftover files
4225
4226 2018-07-01  Paul Smith  <psmith@nuodb.com>
4227
4228         * Makefile.ami, glob/Makefile.ami: Remove obsolete files
4229
4230 2018-07-01  Ola Olsson  <ola1olsson@gmail.com>
4231
4232         * doc/make.texi: Updated language
4233
4234 2018-07-01  Paul Smith  <psmith@gnu.org>
4235
4236         * all: Update Copyright statements for 2018
4237
4238         * scripts/copyright-update: Maintainer's script for copyright mgmt
4239
4240 2018-02-10  Paul Smith  <psmith@gnu.org>
4241
4242         * build_w32.bat: Support Visual Studio 17.
4243
4244 2017-11-19  Paul Smith  <psmith@gnu.org>
4245
4246         * configure.ac: Support GLIBC glob interface version 2
4247
4248 2017-11-19  Paul Smith  <psmith@gnu.org>
4249
4250         Rework directory structure to use GNU-recommended "src" directory.
4251         Move the source code (other than glob) into the "src" subdirectory.
4252         Update all scripting and recommendations to support this change.
4253
4254         * *.c, *.h, w32/*: Move to src/
4255         * configure.ac, Makefile.am, maintMakefile: Locate new source files.
4256         * Basic.mk.template, mk/*: Update for new source file locations.
4257         * NEWS, README.DOS.template: Update for new locations.
4258         * build.template, build_w32.bat, builddos.bat: Ditto.
4259         * po/POTFILES.in: Ditto
4260         * tests/run_make_tests.pl, tests/scripts/features/load*: Ditto.
4261         * make.1: Move to doc.
4262         * mk/VMS.mk: Add support for building on VMS (hopefully).
4263         * makefile.vms, prepare_w32.bat: Remove.
4264         * SCOPTIONS: Update to define HAVE_CONFIG_H
4265
4266 2017-11-18  Paul Smith  <psmith@gnu.org>
4267
4268         * job.c: Add "command" as a known shell built-in.
4269         This is not a POSIX shell built-in but it's common in UNIX shells.
4270         Reported by Nick Bowler <nbowler@draconx.ca>.
4271
4272         * tests/scripts/features/output-sync: Revert bad change in 0c5a9f9b92a
4273
4274 2017-11-18  Paul Smith  <psmith@gnu.org>
4275
4276         Remove unsupported build facilities.
4277         Over time the non-standard build and install systems (nmake files,
4278         smake files, Visual Studio project files, etc.) have atrophied and
4279         maintaining them is not worth the effort, for such a simple utility
4280         as make.  Remove all the non-standard build tool support and unify
4281         OS-specific build rules under a basic set of (GNU make) makefiles.
4282
4283         Preserve the existing bootstrapping scripts (for POSIX, Windows,
4284         and MS-DOS).  Also the existing VMS build scripts are left unchanged:
4285         I don't have enough experience with VMS to venture into this area.
4286         Perhaps one of the VMS maintainers might like to determine whether
4287         conversion would be appropriate.
4288
4289         Rather than create libraries for w32 and glob (non-POSIX), simply
4290         link the object files directly to remove the complexity.
4291
4292         * NEWS: Update with user-facing notes.
4293         * Makefile.am: Clean up to use the latest automake best practices.
4294         Build Windows code directly from the root makefile to avoid recursion.
4295         * README.Amiga, README.DOS.template, README.W32.template: Updated.
4296         * INSTALL: Point readers at the README.git file.
4297         * maintMakefile: Remove obsolete files.  Create Basic.mk file.
4298         * Basic.mk.template, mk/*.mk: Create basic GNU make-based makefiles.
4299         * build_w32.bat: Copy Basic.mk to Makefile
4300         * configure.ac: We no longer need AM_PROG_AR.
4301         * dosbuild.bat: Rename to builddos.bat.  Incorporate configure.bat.
4302         * Makefile.DOS.template: Remove.
4303         * NMakefile.template, w32/subproc/NMakefile: Remove.
4304         * SMakefile.template, glob/SMakefile, glob/SCOPTIONS, make.lnk: Remove.
4305         * configure.bat, glob/configure.bat: Remove.
4306         * w32/Makefile.am: Remove.
4307         * make_msvc_net2003.sln, make_msvc_net2003.vcproj: Remove.
4308
4309 2017-11-11  Paul Smith  <psmith@gnu.org>
4310
4311         * Makefile.am: Add jhelp.pl to remote test setup.
4312
4313 2017-11-11  Paolo Bonzini  <pbonzini@redhat.com>
4314
4315         Do not use STOP_SET for singleton compares.
4316         Compare against '$' directly rather than using MAP_VARIABLE.
4317         This saves ~10% for find_map_function, which is the top hotspot in
4318         QEMU's no-op build.  The build is sped up overall by about 1.5%
4319         more (from 11.1s to 10.95s).
4320
4321         * read.c (find_map_function): Do not compare against singleton sets.
4322
4323 2017-11-11  Paolo Bonzini  <pbonzini@redhat.com>
4324
4325         Speedup parsing of functions.
4326         Use the stopchar map to quickly jump over everything that is
4327         not an open/close brace, an open/close parenthesis or a comma.
4328
4329         This saves 1% on QEMU's noop build (from 11.23s to 11.1s).
4330
4331         * function.c (find_next_argument, handle_function): Check
4332         with STOP_SET before comparing against individual characters.
4333         * main.c (initialize_stopchar_map): Initialize MAP_VARSEP
4334         mappings in stopchar_map.
4335         * makeint.h (MAP_VARSEP): New.
4336
4337 2017-11-11  Paolo Bonzini  <pbonzini@redhat.com>
4338
4339         Remove MAP_PERCENT as strchr is faster.
4340         * read.c (find_percent_cached): Use strchr instead of STOP_SET
4341         to find % or nul.
4342         * makeint.h (MAP_PERCENT): Remove.
4343         * main.c (initialize_stopchar_map): Remove.
4344
4345 2017-11-11  Paolo Bonzini  <pbonzini@redhat.com>
4346
4347         Use Jenkins hash.
4348         This is about twice as fast as the current hash, and removes the
4349         need for double hashing (improving locality of reference).  The
4350         hash function is based on Bob Jenkins' design, slightly adapted
4351         wherever Make needs to hash NUL-terminated strings.  The old hash
4352         function is kept for case-insensitive hashing.
4353
4354         This saves 8.5% on QEMU's no-op build (from 12.87s to 11.78s).
4355
4356         * configure.ac: Check endianness.
4357         * hash.c (rol32, jhash_mix, jhash_final, JHASH_INITVAL,
4358         sum_get_unaligned_32, jhash): New.
4359         * hash.h (STRING_HASH_1, STRING_N_HASH_1): Use jhash.
4360         (STRING_HASH_2, STRING_N_HASH_2): Return a dummy value.
4361         (STRING_N_COMPARE, return_STRING_N_COMPARE): Prefer memcmp to strncmp.
4362
4363 2017-11-11  Paolo Bonzini  <pbonzini@redhat.com>
4364
4365         Use strchr for simple case of find_char_unquote.
4366         In most cases, find_char_unquote has a single stopchar.  In that
4367         case we can look for it using strchr's optimized implementation.
4368
4369         This saves 3.5% on QEMU's noop build (from 11.78s to 11.37s).
4370
4371         * read.c (find_char_unquote): Rename to find_map_unquote.  Replace
4372         with an implementation optimized for the case where the stopchar
4373         is a singleton.  Adjust all callers.
4374
4375 2017-11-11  Paolo Bonzini  <pbonzini@redhat.com>
4376
4377         Use strchr/memmove in collapse_continuations.
4378         collapse_continuations is already using strchr to speed up the
4379         common case of no backslash-newline sequence, but on modern
4380         processors it is faster to scan the string twice with
4381         strchr+memmove (or strlen+memmove) than to move bytes manually.
4382
4383         Saves about 1.5% on QEMU's no-op build (from 11.37s to 11.23s).
4384
4385         * misc.c (collapse_continuations): Rewrite the scanning of LINE.
4386
4387 2017-10-31  Paul Smith  <psmith@gnu.org>
4388
4389         * main.c (main): [SV 48274] Allow -j in makefile MAKEFLAGS variable.
4390         * tests/jhelp.pl: New file to allow testing parallelism without sleep.
4391         * tests/scripts/features/parallelism: Test this.
4392         * tests/scripts/features/jobserver: Update tests.
4393         * tests/scripts/features/output-sync: Remove useless rm command.
4394
4395 2017-10-30  Paul Smith  <psmith@gnu.org>
4396
4397         * job.c (child_error): Modify error message string.
4398         Ensure Emacs compile-mode's next-error doesn't match target failure
4399         messages.  Syntax errors in makefiles are still matched.
4400
4401         * function.c (func_if): Check the first character of condition.
4402         Reported by Rob W <robw9739@gmail.com>
4403
4404 2017-10-30  Paul Eggert  <eggert@cs.ucla.edu>
4405
4406         glob: Do not assume glibc glob internals.
4407         It has been proposed that glibc glob start using gl_lstat,
4408         which the API allows it to do.  GNU 'make' should not get in
4409         the way of this.  See:
4410         https://sourceware.org/ml/libc-alpha/2017-09/msg00409.html
4411
4412         * dir.c (local_lstat): New function, like local_stat.
4413         (dir_setup_glob): Use it to initialize gl_lstat too, as the API
4414         requires.
4415
4416 2017-10-30  Paul Smith  <psmith@gnu.org>
4417
4418         Compute load from number of running processes.
4419         * job.c (load_too_high): If /proc/loadavg is available, compare the
4420         maximum load against the number of processes currently running.  If
4421         we can't parse /proc/loadavg, use the previous algorithm.
4422
4423         Concept and initial patch from Sven C. Dack <sven.c.dack@sky.com>
4424
4425 2017-09-30  Eli Zaretskii  <eliz@gnu.org>
4426
4427         Fix checking existence of directories on MS-Windows
4428         * remake.c (name_mtime) [WINDOWS32]: Emulate Posix behavior of
4429         'stat' with the likes of "foo/" and "foo/.".
4430
4431 2017-07-09  Paul Smith  <psmith@gnu.org>
4432
4433         Update copyright statements for 2017.
4434
4435         Remove uses of unnecessary "register" keyword.
4436
4437         * variable.c (create_pattern_var): [SV 51266] Create with xcalloc().
4438         Reported by Chris Metcalf <cmetcalf@mellanox.com>
4439
4440         [SV 51400] Only unblock fatal signals after child invocation
4441         * job.c (unblock_sigs): Only unblock fatal signals not all signals.
4442         (unblock_all_sigs): Unblock all signals not just fatal signals.
4443         (child_execute_job): Call unblock_all_sigs() in child process.
4444         * job.h: Remove unused function definitions.
4445         * remote-cstms.c (start_remote_job): Call unblock_all_sigs() in
4446         child process.
4447         Reported by Koen Van Hoof <koen.van_hoof@nokia.com>
4448
4449 2017-07-01  Paul Smith  <psmith@gnu.org>
4450
4451         * function.c (shell_completed): [SV 51014] Add signal to .SHELLSTATUS
4452         * tests/scripts/functions/shell: Verify that .SHELLSTATUS contains
4453         a non-0 value when the shell exits due to a signal.
4454
4455 2017-06-07  Eli Zaretskii  <eliz@gnu.org>
4456
4457         Avoid crashes when SHELL=abcde is specified on the command line
4458         * variable.c (do_variable_definition): If $SHELL was not found,
4459         process "SHELL=foo" as any other variable definition.  This avoids
4460         segfaults when SHELL=foo is specified on the Make command line.
4461         Reported by Orgad Shaneh <orgads@gmail.com>.
4462
4463 2017-06-04  Paul Smith  <psmith@gnu.org>
4464
4465         [SV 51159] Use a non-blocking read with pselect to avoid hangs.
4466         * posixos.c (set_blocking): Set blocking on a file descriptor.
4467         (jobserver_setup): Set non-blocking on the jobserver read side.
4468         (jobserver_parse_auth): Ditto.
4469         (jobserver_acquire_all): Set blocking to avoid a busy-wait loop.
4470         (jobserver_acquire): If the non-blocking read() returns without
4471         taking a token then try again.
4472
4473         [SV 50823] Support filenames containing '$' in MAKEFILE_LIST
4474         * variable.h (enum variable_flavor: Add a new flavor for appended
4475         values that shouldn't be expanded.
4476         * variable.c (do_variable_definition): If given this new flavor,
4477         do not expand the value before appending it.
4478         * read.c (eval_makefile): Use this new flavor for MAKEFILE_LIST
4479         * tests/scripts/variables/MFILE_LIST: Test filenames containing '$'.
4480
4481         * tests/test_driver.pl: Useful error if given an invalid test name.
4482
4483         * NEWS: Do not insert a space during '+=' if the value is empty.
4484         * doc/make.texi (Appending): Document this behavior.
4485         * variable.c (do_variable_definition): Only add a space if the variable
4486         value is not empty.
4487         * tests/scripts/variables/flavors: Test this behavior.
4488
4489 2017-06-04  Enrique Olaizola  <enrique_olaizola16@hotmail.com>  (tiny change)
4490
4491         * read.c (read_all_makefiles): [SV 50909] Add MAKEFILES to strcache
4492
4493 2017-06-04  Paul Smith  <psmith@gnu.org>
4494
4495         * po/LINGUAS: Add support for traditional Chinese (zh_TW)
4496
4497         Rename output_tmpfile() to a misc function get_tmpfile()
4498         * output.c: Remove output_tmpfile() and umask handling.
4499         * output.h: Ditto.
4500         * misc.c: Add get_tmpfile() and umask handling.
4501         * makeint.h: Ditto.
4502         * function.c: Rename output_tmpfile() to get_tmpfile().
4503         * main.c: Ditto.
4504         * vmsjobs.c: Ditto.
4505
4506         [SV 13651] Handle out-of-memory conditions slightly more gracefully.
4507         * makeint.h: Change OUT_OF_MEM() macro to out_of_memory() function.
4508         * output.h, job.h: Move FD_* macros from job.h to output.h.
4509         * output.c (output_write): Write a buffer to an FD directly.
4510         (out_of_memory): Use output_write() to avoid allocating more
4511         memory while writing the error, and call exit() instead of die().
4512         This does mean we can't translate the error string, though.
4513         * misc.c (xmalloc, xcalloc, xrealloc, xstrdup, xstrndup): Call new
4514         out_of_memory() rather than OUT_OF_MEM().
4515         * read.c (parse_file_seq): Ditto.
4516
4517         Clean up close-on-exec, particularly with jobserver pipes.
4518         * configure.ac: Check sys/file.h and assume fileno() always exists.
4519         * output.h: Move output-specific content from job.h to output.h.
4520         * os.h (fd_inherit, fd_noinherit): New functions manage FD inheritance.
4521         * posixos.c (fd_inherit, fd_noinherit): Implement for POSIX systems.
4522         (jobserver_setup): Force jobserver FDs to not be inherited by default.
4523         (jobserver_pre_child): Enable inheritance in recursive invocations.
4524         (jobserver_post_child): Disable inheritance after recursive invocations.
4525         * w32/w32os.c (fd_inherit, fd_noinherit): Implement for W32 systems.
4526         * job.h (CLOSE_ON_EXEC): Remove macro in deference to new fd_noinherit.
4527         * function.c (func_shell_base): Convert CLOSE_ON_EXEC to fd_noinherit.
4528         * job.c (child_execute_job): Ditto.
4529         * output.c (setup_tmpfile): Ditto.
4530         * read.c (eval_makefile): Ditto, plus remove HAVE_FILENO check.
4531         * w32/include/sub_proc.h: Remove process_noinherit for fd_noinherit.
4532         * w32/subproc/sub_proc.c: Ditto.
4533
4534         [SV 50300] Use CFLAGS value of "-O1" in POSIX mode.
4535         * read.c (record_files): Use "-O1" not "-O" for CFLAGS and FFLAGS.
4536         * tests/scripts/targets/POSIX: Test for the new value.
4537
4538         * configure.ac: [SV 50648] Detect Guile 2.2 packages.
4539
4540         * doc/make.texi: [SV 50304] Add missing close parenthesis.
4541
4542         Add test suite support to Windows
4543         * main.c (main): Sanitize program name detection on Windows.
4544         * makeint.h: 'program' is a const string on all platforms now.
4545         * tests/run_make_tests.bat: Windows bat file to invoke tests
4546         * tests/test_driver.pl: Obtain system-specific error messages.
4547         (get_osname): Compute the $port_type here.  Add more $osname checks
4548         for different Windows Perl ports.
4549         (_run_command): Rewrite the timeout capability to work properly
4550         with Windows.  Don't use Perl fork/exec; instead use system(1,...)
4551         which allows a more reliable/proper kill operation.
4552         Also, allow options to be given as a list instead of a string, to
4553         allow more complex quoting of command-line arguments.
4554         * tests/run_make_tests.pl (run_make_with_options): Allow options
4555         to be provided as a list in addition to a simple string.
4556         (set_more_defaults): Write sample makefiles and run make on them
4557         instead of trying to run echo and invoking make with -f-, to avoid
4558         relying on shell and echo to get basic configuration values.  Also
4559         create a $sh_name variable instead of hard-coding /bin/sh.
4560         * tests/scripts/features/archives: Skip on Windows.
4561         * tests/scripts/features/escape: Use list method for passing options.
4562         * tests/scripts/features/include: Use system-specific error messages.
4563         * tests/scripts/features/output-sync: "Command not found" errors
4564         generate very different / odd output on Windows.  This needs to be
4565         addressed but for now disable these tests on Windows.
4566         * tests/scripts/functions/abspath: Disable on Windows.
4567         * tests/scripts/functions/file: Use system-specific error messages.
4568         * tests/scripts/functions/shell: "Command not found" errors generate
4569         very different / odd output on Windows.  This needs to be addressed
4570         but for now disable these tests on Windows.
4571         * tests/scripts/misc/close_stdout: Disable on Windows.
4572         * tests/scripts/options/dash-k: Use system-specific error messages.
4573         * tests/scripts/options/dash-l: Disable on Windows.
4574         * tests/scripts/options/eval: Use list method for passing options.
4575         * tests/scripts/options/general: Skip some non-portable tests.
4576         * tests/scripts/targets/ONESHELL: Skip some non-portable tests.
4577         * tests/scripts/targets/POSIX: Skip some non-portable tests.
4578         * tests/scripts/variables/MAKEFILES: Skip some non-portable tests.
4579         * tests/scripts/variables/SHELL: Use a makefile not -f- for testing.
4580
4581 2017-06-04  Enrique Olaizola  <enrique_olaizola16@hotmail.com>
4582
4583         * tests/run_make_tests.pl: [SV 50902] Find Perl modules
4584
4585 2017-01-11  Eli Zaretskii  <eliz@gnu.org>
4586
4587         [SV 50021] Avoid infloop on MS-Windows with short scripts
4588         * job.c (reap_children) [WINDOWS32]: Avoid recursive call to
4589         reap_children when the argument passed to
4590         map_windows32_error_to_string is negative or too large.
4591
4592 2016-12-28  Paul Smith  <psmith@gnu.org>
4593
4594         * main.c (switches): Add -E as an alias for --eval.
4595         * make.1: Document the -E and --eval options.
4596         * doc/make.texi: Document the -E option.
4597         * tests/scripts/options/eval: Test the -E option and MAKEFILES.
4598         * NEWS: Add information about the new option.
4599
4600         * main.c (switches): Add --no-silent to undo -s options.
4601         * make.1: Document the new flag.
4602         * doc/make.texi: Document the new flag.  Remove suggestions that the
4603         .SILENT special target is deprecated or should not be used.
4604         * tests/scripts/options/dash-s: Test the -s and --no-silent options.
4605         * NEWS: Add information about the new option.
4606
4607 2016-12-26  Martin Dorey  <martin.dorey@hds.com>
4608
4609         * job.c (child_execute_job): [SV 49938] Avoid spurious GCC warning.
4610
4611         * main.c (main): [SV 49935] Fix uninitialized variable.
4612
4613 2016-12-26  Paul Smith  <psmith@gnu.org>
4614
4615         [SV 40236] Handle included file open failures properly.
4616         * read.c (eval_makefile): Set deps->error if we discovered any
4617         error reading makefiles, and set NONEXISTENT_MTIME so we know
4618         it needs to be rebuilt.
4619         * main.c (main): Clean up management of makefile_mtimes.
4620         * tests/scripts/features/include: Add open failure testcases.
4621
4622         Portability changes for the test suite.
4623         * tests/test_driver.pl: Save error strings for later comparison.
4624         * tests/run_make_tests.pl: Create portable commands for later use.
4625         * tests/*: Use these new variables.
4626
4627         [SV 20513] Un-escaped # are not comments in function invocations
4628         * NEWS: Document the change, as a backward-incompatible change.
4629         * main.c (main): Add 'nocomment' to the .FEATURES variable.
4630         * read.c (remove_comments): Skip variable references during remove.
4631         (find_char_unquote): Fix comments for new STOPMAP support.
4632         * tests/scripts/features/escape: Test new escape syntax.
4633         * tests/scripts/functions/guile: Ditto.
4634         * tests/scripts/functions/shell: Ditto.
4635
4636         * main.c (main): [SV 40234] Show correct error message.
4637
4638 2016-12-26  Christoph Schulz  <develop@kristov.de>
4639
4640         * main.c (switches): [SV 48809] Accept obsolete jobserver flag.
4641
4642 2016-12-26  Paul Smith  <psmith@gnu.org>
4643
4644         * read.c (get_next_mword): [SV 49865] Make fallthrough explicit.
4645
4646         [SV 49114] Remove support for the NO_FLOAT compile flag.
4647         * makeint.h (max_load_average): Always a double.
4648         * main.c (max_load_average, default_load_average): Always doubles.
4649         (switches): -l option is a "floating" format.
4650         (decode_switches, define_makeflags): Support "floating" format.
4651         * remake.c (f_mtime): Show time skew as double.
4652         * rule.c (print_rule_data_base): Show percentages as double.
4653         * Makefile.ami, README.DOS.template, SMakefile.template: Remove
4654         references to NO_FLOAT.
4655         * SCOPTIONS, glob/SCOPTIONS: Remove NO_FLOAT settings.
4656
4657         [SV 45477] [SV 49115] Parse DOS/Windows drivespecs correctly.
4658         * read.c (parse_file_seq) [WINDOWS32]: Only consider a colon part of
4659         a path if it's in a valid Windows drivespec.
4660
4661 2016-12-25  Paul Smith  <psmith@gnu.org>
4662
4663         [SV 49116] Check potential null pointer dereference.
4664         * w32/subproc/sub_proc.c (make_command_line): Simplify cygwin shell
4665         check for correctness.
4666
4667 2016-12-25  Jaak Ristioja  <jaak@ristioja.ee>
4668
4669         * expand.c (variable_append): [SV 49113] Possible null ptr deref
4670
4671         * w32/*/dirent.*: [SV 49111] Remove unused telldir()
4672
4673 2016-12-25  Paul Smith  <psmith@gnu.org>
4674
4675         Add more GCC warnings to the maintainer build.
4676         * arscan.c: [SV 49112] Correct TEST printf() formatting.
4677         Recommended by Jaak Ristioja <jaak@ristioja.ee>
4678         * hash.c: Correct fprintf() formatting.
4679         * maintMakefile: Add extra GCC warning flags.
4680
4681         * po/Makevars, makeint.h, debug.h: Add xgettext C format flags.
4682
4683         * po/LINGUAS: Added Serbian translation.
4684
4685         * README.template: Clarify some items in the README
4686
4687         * doc/make.texi: [SV 48951] Fix documentation typo.
4688
4689         * maintMakefile: Update default GPG ID for new key.
4690
4691 2016-12-14  Paul Smith  <psmith@gnu.org>
4692
4693         Resolve issues discovered by static code analysis.
4694         * maintMakefile: Add a rule to submit code for analysis.
4695         * configure.ac: Check for availability of the umask() function.
4696         * output.c (output_tmpfd, output_tmpfile): Use umask on temp files.
4697         * makeint.h (PATH_VAR): Reserve an extra character for nul bytes.
4698         * function.c (func_error): Initialize buffer to empty string.
4699         * job.c (child_execute_job): Verify validity of fdin.
4700         * main.c (main): Simplify code for makefile updating algorithm.
4701         * arscan.c (ar_scan): Verify member name length before reading.
4702         * read.c (readline): Cast pointer arithmetic to avoid warnings.
4703         * remake.c (update_file): Remove unreachable code.
4704         (name_mtime): Verify symlink name length.
4705
4706 2016-11-12  Eli Zaretskii  <eliz@gnu.org>
4707
4708         * NEWS: Mention the extended support for -jN on MS-Windows.
4709
4710 2016-11-12  Marc Ullman  <marc@mathworks.com>
4711
4712         Support more than 63 jobs on MS-Windows
4713         * job.c (start_waiting_job, load_too_high):
4714         * w32/w32os.c (jobserver_setup, jobserver_acquire): Abstracted out
4715         MAXIMUM_WAIT_OBJECTS.  Call process_table_full instead.
4716         * w32/include/sub_proc.h: Update and add prototypes.
4717         * w32/subproc/sub_proc.c (GMAKE_MAXIMUM_WAIT_OBJECTS): New macro.
4718         (process_wait_for_multiple_objects): Drop-in replacement for Windows
4719         API WaitForMultipleOjects.
4720         (process_wait_for_any_private): Replaced MAXIMUM_WAIT_OBJECTS with
4721         GMAKE_MAXIMUM_WAIT_OBJECTS.
4722         (process_table_full): Replacement for process_used_slots.
4723         (process_used_slots): Removed, as no longer needed.
4724         (process_table_usable_size): Returns maximum usable size of process
4725         table.
4726         (process_table_actual_size): Returns actual size of process table.
4727         (process_register): Added assertion.
4728         (process_easy): Abstracted out MAXIMUM_WAIT_OBJECTS.
4729
4730 2016-10-09  Eli Zaretskii  <eliz@gnu.org>
4731
4732         Only include strings.h in MinGW builds
4733         * main.c:
4734         * job.c: Include strings.h only if HAVE_STRINGS_H is defined.
4735
4736         * config.h.W32.template (HAVE_STRINGS_H): Define only for MinGW,
4737         as MSVC doesn't have this header.
4738
4739 2016-10-06  Eli Zaretskii  <eliz@gnu.org>
4740
4741         Update the Guile version tested with the MS-Windows build.
4742
4743         Avoid compiler warnings with MinGW runtime 3.22.2
4744         * main.c:
4745         * job.c: Include strings.h, to get the prototypes of strcasecmp
4746         and strncasecmp with latest MinGW runtime versions.
4747         * config.h.W32.template (HAVE_STRINGS_H): Define.
4748
4749 2016-06-24  Paul Smith  <psmith@gnu.org>
4750
4751         * README.W32.template: Update the build documentation.
4752         * build_w32.bat: Fix issues with Visual Studio builds.  Fix an error
4753         that always created Debug builds.  Support 32bit and 64bit builds.
4754
4755         * Update to pre-release version 4.2.90.
4756
4757 2016-06-10  Paul Smith  <psmith@gnu.org>
4758
4759         GNU Make release 4.2.1.
4760
4761 2016-06-06  Paul Smith  <psmith@gnu.org>
4762
4763         * maintMakefile: TP recommends rsync for retrieving PO files.
4764
4765 2016-05-31  Jeremy Devenport  <jeremy.devenport@gmail.com>  (tiny change)
4766
4767         * main.c (main): [SV 48009] Reset stack limit for make re-exec.
4768
4769 2016-05-31  Paul Smith  <psmith@gnu.org>
4770
4771         [SV 47995] Ensure forced double-colon rules work with -j.
4772         The fix for SV 44742 had a side-effect that some double-colon targets
4773         were skipped.  This happens because the "considered" facility assumed
4774         that all targets would be visited on each walk through the dependency
4775         graph: we used a bit for considered and toggled it on each pass; if
4776         we didn't walk the entire graph on every pass the bit would get out
4777         of sync.  The new behavior after SV 44742 might return early without
4778         walking the entire graph.  To fix this I changed the considered value
4779         to an integer which is monotonically increasing: it is then never
4780         possible to incorrectly determine that a previous pass through the
4781         graph already considered the current target.
4782
4783         * filedef.h (struct file): make CONSIDERED an unsigned int.
4784         * main.c (main): No longer need to reset CONSIDERED.
4785         * remake.c (update_goal_chain): increment CONSIDERED rather than
4786         inverting it between 0<->1.
4787         (update_file_1): Reset CONSIDERED to 0 so it's re-considered.
4788         (check_dep): Ditto.
4789         * tests/scripts/features/double_colon: Add a regression test.
4790
4791 2016-05-31  Paul Smith  <psmith@gnu.org>
4792
4793         * DELETE_ON_ERROR: [SV 48061] Use "exit 1" for portability.
4794         Reported by Joel Fredrikson <Joel.Fredrikson@it.uu.se>
4795
4796         * w32/pathstuff.c: [SV 47996] Use ISBLANK() not isblank().
4797
4798 2016-05-28  Eli Zaretskii  <eliz@gnu.org>
4799
4800         Fix printing time stamps on MS-Windows
4801         * dir.c (print_dir_data_base) [WINDOWS32]: Use %I64u format for
4802         printing unsigned 64-bit data types, as %ull is not universally
4803         supported.
4804
4805 2016-05-27  Luke Allardyce  <lukeallardyce@gmail.com>  (tiny change)
4806
4807         [SV 48037] Fix MinGW build with Posix configury tools
4808         * w32/Makefile.am (libw32_a_CPPFLAGS): Add -I$(srcdir)/glob.
4809
4810 2016-05-22  Paul Smith  <psmith@gnu.org>
4811
4812         GNU Make release 4.2.
4813
4814 2016-05-21  Joe Crayne  <oh.hello.joe@gmail.com>  (tiny change)
4815
4816         [SV 44742] Fix double-colon rules plus parallel builds.
4817         * remake.c (update_file): Don't update double-colon target status
4818         if we're still building targets.
4819         (ftime_t): Don't propagate timestamps for double-colon targets that
4820         we've not examined yet.
4821         * tests/scripts/features/double_colon: Add parallel build tests.
4822
4823 2016-05-21  Paul Smith  <psmith@gnu.org>
4824
4825         * read.c (eval): [SV 47960] Skip record waiting files when ignoring.
4826         * tests/scripts/features/conditionals: Test this scenario.
4827
4828         Separate the GNU make load ABI from internal types.
4829         Create an internal type "floc" and convert all users to that type.
4830         * gnumake.h (gmk_floc): Remove the offset field from this type.
4831         * loadapi.c (gmk_eval): Convert gmk_floc to internal floc.
4832
4833 2016-05-21  Paul Eggert  <eggert@cs.ucla.edu>
4834
4835         Fixes for enhanced GCC warnings.
4836         Move function prototypes into header files and out of .c files.
4837         Use void argument lists for functions that accept no args.
4838         Remove unused macros.  Make private functions static.  Align
4839         types with printf format characters.
4840
4841 2016-05-21  Paul Smith  <psmith@gnu.org>
4842
4843         Fix compile issues with Windows and VMS.
4844         * main.c (initialize_stopchar_map): isblank() is not part of C89.
4845         Install bits for space and tab directly.
4846         * makeint.h: Don't define vfork; autoconf handles this for us.
4847         * vmsjobs.c: Rename NEXT_TOKEN to V_NEXT_TOKEN to avoid conflicts.
4848         * dir.c (print_dir_data_base): Visual Studio C doesn't have int64_t.
4849         * w32/subproc/sub_proc.c (process_begin): Missing arg to memset().
4850         * build_w32.bat: Don't use obsolete Visual Studio flags.
4851
4852         Allow compiling with an ISO C 1989/1990 compiler.
4853         * posixos.c (jobserver_post_child): Use C89 for loop syntax.
4854         * remake.c (update_goal_chain): Ditto.
4855         * variable.c (parse_variable_definition): Ditto.
4856
4857 2016-05-17  Eli Zaretskii  <eliz@gnu.org>
4858
4859         [SV 47942] Avoid random crashes in subordinate programs on MS-Windows
4860         * w32/subproc/sub_proc.c (process_begin): Zero out startInfo
4861         before using it.  Fixes crashes in Intel Fortran compiler invoked
4862         by Make.
4863
4864 2016-04-24  Eli Zaretskii  <eliz@gnu.org>
4865
4866         Fix the MS-Windows MinGW build
4867         * build_w32.bat (GccCompile): Use -std=gnu99, as some code uses
4868         C99 features ('for' loop initial declarations).
4869
4870         * dir.c (print_dir_data_base) [WINDOWS32]: Cast 'mtime' to
4871         'int64_t', and use %I64d to print it, to avoid compile-time
4872         warning about printing a 'time_t' value, which could be either
4873         a 32-bit or a 64 bit integral type.
4874
4875 2016-04-23  Paul Smith  <psmith@gnu.org>
4876
4877         * tests/scripts/features/output-sync: increase test timeout.
4878         I'm getting random failures with a timeout of 10s; increase to 30s.
4879
4880 2016-04-11  Paul Smith  <psmith@gnu.org>
4881
4882         * NEWS: Update for pre-release
4883
4884         * dep.h, makeint.h (show_goal_error): Move to makeint.h.
4885
4886 2016-04-11  Paul Smith  <psmith@gnu.org>
4887
4888         [SV 46433] Show recipe line offsets in line number messages.
4889         While displaying line numbers, show the relevant line number inside
4890         the recipe not just the first line of the entire recipe.
4891         Sample changes suggested by Brian Vandenberg <phantall@gmail.com>
4892
4893         * gnumake.h (gmk_floc): Add an 'offset' to track the recipe offset.
4894         * read.c (eval, eval_makefile, eval_buffer): Initialize 'offset'.
4895         (record_files, install_pattern_rule): Ditto.
4896         * job.c (new_job, job_next_command): Update 'offset' based on the
4897         line of the recipe we're expanding or invoking.
4898         (child_error): Add 'offset' when showing the line number.
4899         * function.c (func_shell_base): Ditto.
4900         * output.c (error, fatal): Ditto.
4901         * NEWS: Mention the new ability.
4902         * tests/scripts/features/errors: Check the line number on errors.
4903         * tests/scripts/functions/warning: Check the line number on warnings.
4904         * tests/scripts/features/output-sync,
4905         tests/scripts/features/parallelism, tests/scripts/functions/shell,
4906         tests/scripts/functions/error: Update line numbers.
4907
4908 2016-04-09  Paul Smith  <psmith@gnu.org>
4909
4910         * maintMakefile: Add a rule for storing preprocessor output.
4911
4912         [SV 102] Don't show unnecessary include file errors.
4913         Delay the generation of error messages for included files until we
4914         are sure that we can't rebuild that included file.
4915         * dep.h (struct dep): Don't reuse "changed"; make a separate field
4916         to keep "flags".  Get rid of dontcare and use the flag.
4917         (struct goaldep): Create a new structure for goal prereqs
4918         that tracks an errno value and the floc where the include happened.
4919         Rework the structures to ensure they are supersets as expected.
4920         In maintainer mode with GCC, use inline to get type checking.
4921         * read.c (eval_makefile): Return a struct goaldep for the new
4922         makefile.  Ensure errno is set properly to denote a failure.
4923         (read_all_makefiles): Switch to goaldep and check errno.
4924         (eval): Don't show included file errors; instead remember them.
4925         * remake.c (update_goal_chain): Set global variables to the current
4926         goaldep we're building, and the entire chain.
4927         (show_goal_error): Check if the current failure is a consequence
4928         of building an included makefile and if so print an error.
4929         (complain): Call show_goal_error() on rule failure.
4930         * job.c (child_error): Call show_goal_error() on child error.
4931         * main.c (main): Switch from struct dep to goaldep.
4932         * misc.c (free_dep_chain): Not used; make into a macro.
4933         * tests/scripts/features/include: Update and include new tests.
4934         * tests/scripts/options/dash-B, tests/scripts/options/dash-W,
4935         tests/scripts/options/print-directory,
4936         tests/scripts/variables/MAKE_RESTARTS: Update known-good-output.
4937
4938         * job.c (child_error): Add filename length to output length.
4939         Reported by Dale Stimson <dale@riyescott.com>
4940
4941 2016-04-04  Paul Smith  <psmith@gnu.org>
4942
4943         Preserve the real value of -jN in MAKEFLAGS using jobserver.
4944         Previously if the jobserver was active, MAKEFLAGS would contain only
4945         the -j option but not the number (not -j5 or whatever) so users
4946         could not discover that value.  Allow that value to be provided in
4947         MAKEFLAGS without error but still give warnings if -jN is provided
4948         on the command line if the jobserver is already activated.
4949
4950         * NEWS: Discuss the new behavior.
4951         * os.h, posixos.c, w32/w32os.c: Return success/failure from
4952         jobserver_setup() and jobserver_parse_auth().
4953         * main.c (main): Separate the command line storage of job slots (now
4954         in arg_job_slots) from the control storage (in job_slots).  Make a
4955         distinction between -jN flags read from MAKEFLAGS and those seen
4956         on the command line: for the latter if the jobserver is enabled then
4957         warn and disable it, as before.
4958         * tests/scripts/features/jobserver: Add new testing.
4959
4960 2016-04-04  Paul Smith  <psmith@gnu.org>
4961
4962         * tests/run_make_tests.pl: Add file/lineno info to .run file.
4963
4964         * maintMakefile: Fix logging of check-alt-config target.
4965
4966         * job.c (child_execute_job): Fix $(shell...) under NO_OUTPUT_SYNC.
4967         * main.c (decode_output_sync_flags): Use NONE for NO_OUTPUT_SYNC.
4968
4969         * main.c (main): Restrict disabling debugging for MAKEFILES.
4970
4971         * Makefile.am, w32/Makefile.am: Fix *os.c for Windows builds.
4972         Original change provided by Luke Allardyce <lukeallardyce@gmail.com>
4973
4974         * make.texi: Confirm that CURDIR contains an absolute path.
4975
4976         * docs/make.texi: [SV 47392] Add "Integrating make" chapter.
4977
4978         Change --jobserver-fds to more generic --jobserver-auth.
4979         * NEWS: Mention the change.
4980         * main.c: Rename jobserver_fds variable to jobserver_auth and
4981         --jobserver-fds option to --jobserver-auth.
4982         * os.h, posixos.c, w32/w32os.c: Rename jobserver_parse_arg() and
4983         jobserver_get_arg() to jobserver_parse_auth()/jobserver_get_auth().
4984
4985 2016-03-23  Paul Smith  <psmith@gnu.org>
4986
4987         * tests/run_make_tests.pl: Preserve $make_command
4988         * tests/scripts/options/dash-n: Use $make_command.  This fixes
4989         a spurious failure when running tests with valgrind enabled.
4990
4991         * variable.c: Clean up some memory leaks.
4992
4993         [SV 46995] Strip leading/trailing space from variable names
4994         * makeint.h: Change MAP_SPACE to MAP_NEWLINE, and add MAP_PATHSEP
4995         and MAP_SPACE which is now MAP_BLANK|MAP_NEWLINE.  Create
4996         NEW_TOKEN(), END_OF_TOKEN(), ISBLANK(), ISSPACE() macros.
4997         * main.c (initialize_stopchar_map): Set MAP_NEWLINE only for
4998         newline characters.
4999         * Convert all uses of isblank() and isspace() to macros.
5000         * Examine all uses of isblank() (doesn't accept newlines) and
5001         change them wherever possible to ISSPACE() (does accept newlines).
5002         * function.c (func_foreach): Strip leading/trailing space.
5003         * variable.c (parse_variable_definition): Clean up.
5004         * tests/scripts/functions/foreach: Test settings and errors.
5005         * tests/scripts/functions/call: Rewrite to new-style.
5006         * tests/scripts/misc/bs-nl: Add many more tests for newlines.
5007
5008 2016-03-21  Paul Smith  <psmith@gnu.org>
5009
5010         * function.c (func_file): Support reading from files.
5011         * NEWS: Add information about reading files.
5012         * make.texi (File Function): Describe reading files.
5013         * tests/scripts/functions/file: Test new features for $(file ...)
5014
5015 2016-03-20  Paul Smith  <psmith@gnu.org>
5016
5017         * doc/make.texi (Setting Variables): Fix typo (add comma).
5018
5019         * job.c (child_error): Combine file info with error message.
5020         * tests/scripts/...: Update error message matches.
5021
5022 2016-03-19  Paul Smith  <psmith@gnu.org>
5023
5024         * variable.c: Align type of variable_changenum.
5025
5026 2016-03-13  Paul Smith  <psmith@gnu.org>
5027
5028         [SV 45728] Detect changes in .VARIABLES more accurately.
5029         For performance, we only recompute .VARIABLES when (a) it's expanded
5030         and (b) when its value will change from a previous expansion.  To
5031         determine (b) we were checking the number of entries in the hash
5032         table which used to work until we started undefining entries: now if
5033         you undefine and redefine the same number of entries in between
5034         expanding .VARIABLES, it doesn't detect any change.  Instead, keep
5035         an increasing change number.
5036         * variables.c: Add variable_changenum.
5037         (define_variable_in_set, merge_variable_sets): Increment
5038         variable_changenum if adding a new variable to the global set.
5039         (undefine_variable_in_set): Increment variable_changenum if
5040         undefining a variable from the global set.
5041         (lookup_special_var): Test variable_changenum not the hash table.
5042         * tests/scripts/variables/special: Test undefining variables.
5043
5044         * main.c(main): Disable output sync without parallel builds.
5045
5046         [SV 46581] Pre-define .LOADED to avoid warnings.
5047         * main.c (main): Pre-define .LOADED as a default-level variable.
5048         * load.c (load_file): Set the value rather than append it.  Avoid
5049         adding an extra initial whitespace.
5050         * tests/scripts/features/load: Run with --warn-undefined-variables.
5051
5052 2016-03-13  Paul Smith  <psmith@gnu.org>
5053
5054         [SV 44555] Use vfork() instead of fork() where available.
5055         Testing has shown that vfork() is actually significantly
5056         more efficient on systems where it's supported, even for
5057         copy-on-write implementations.  If make is big enough,
5058         duplicating the page tables is significant overhead.
5059
5060         * configure.ac: Check for fork/vfork.
5061         * makeint.h: Include vfork.h and set up #define for it.
5062         * os.h, posixos.c (get_bad_stdin): For children who can't use
5063         the normal stdin file descriptor, get a broken one.
5064         * job.c (start_job_command): Avoid so many ifdefs and simplify
5065         the invocation of child_execute_job()
5066         (child_execute_job): move the fork operation here so it can
5067         return early for the parent process.  Switch to use vfork().
5068         * function.c (func_shell_base): Use new child_execute_job() and
5069         simplify ifdefs.
5070         * job.h, main.c, remote-cstms.c, vmsjobs.c, w32os.c: Update
5071         declarations and calls.
5072
5073 2016-03-09  Paul Smith  <psmith@gnu.org>
5074
5075         * job.c (exec_command): [SV 47365] Show error on exec failure.
5076
5077 2016-03-08  Paul Smith  <psmith@gnu.org>
5078
5079         [SV 46261] Use pselect() for jobserver where supported.
5080         * Makefile.am, configure.ac: Check for pselect() and sys/select.h.
5081         * main.c (main): Block SIGCHLD if we have pselect() support.
5082         * posixos.c (jobserver_acquire): If we support pselect() then use
5083         it to query the jobserver pipe, while also listening for SIGCHLD.
5084         Also pselect() supports a timeout so avoid alarm() calls.
5085
5086         Clean up some compiler warnings.
5087         * commands.c, commands.h: Use unsigned char for flags.
5088         * dir.c: Use time_t and size_t, and char for a boolean value.
5089         * job.c: Use unsigned and char.
5090         * read.c: Return a signed type since -1 is a valid return code.
5091
5092         Extract jobserver implementation into OS-specific files.
5093         * os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
5094         * job.c, job.h, main.c, makeint.h: Move content to new files.
5095         * w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
5096         * Makefile.am: Build and package OS-specific files.
5097         * build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
5098         Update for new files, and clean up the build.
5099         * POTFILES.in, maintMakefile, NMakefile.template: Ditto.
5100         * w32/subproc/build.bat: Delete as unused.
5101
5102         [SV 46261] Add more EINTRLOOP wrappers.
5103         This cannot be a perfect solution because there are always other
5104         possible places EINTR can happen, including external libraries
5105         such as gettext, Guile etc.
5106
5107 2016-02-29  Paul Smith  <psmith@gnu.org>
5108
5109         * strcache.c (add_hugestring): [SV 46832] Support huge strings.
5110         The strcache was limited to strings of length 65535 or less,
5111         because the length is kept in an unsigned short.  To support
5112         huge strings add a new simple linked list, which we don't try
5113         to hash.
5114
5115         * strcache.c (add_string): [SV 47071] Handle huge initial string.
5116         If the very first string added to the string cache is more than
5117         half the maximum size, we failed when moving the only strcache
5118         buffer to the full list.
5119
5120         [SV 47151] Exit with 1 when checking recursive make -q
5121         * job.h (struct child): New bit to mark recursive command lines.
5122         * job.c (start_job_command): Set the recursive command line bit.
5123         (reap_children): If the child is a recursive command and it exits
5124         with 1 during question mode, don't print an error and exit with 1.
5125         * tests/scripts/options/dash-q: Add a regression test.
5126
5127         * main.c (define_makeflags): Add parens to avoid GCC warning.
5128
5129 2016-02-29  Paul Smith  <psmith@gnu.org>
5130
5131         * tests/scripts/features/archives: Handle deterministic archives.
5132         Newer versions of binutils allow ar to be compiled to generate
5133         "deterministic archives" by default: in this mode no timestamp
5134         information is generated in the static archive, which utterly
5135         breaks GNU make's archive updating capability.  Debian and Ubuntu
5136         have turned this feature on by default in their distributions
5137         which causes the regression tests to fail.
5138
5139         Update the regression tests to check for the availability of the
5140         "U" option to ar which disables deterministic archives and allows
5141         GNU make's archive support to work properly again.
5142
5143 2016-02-28  Paul Smith  <psmith@gnu.org>
5144
5145         Update Copyright statements for the new year.
5146
5147         * doc/make.texi: [SV 47163] Fix typo in 'ifdef' documentation.
5148
5149         * doc/make.texi: [SV 35455] Add more uses for Empty Recipes.
5150
5151 2015-11-07  Gisle Vanem  <gvanem@yahoo.no>
5152
5153         Fix diagnostics on MS-Windows when environment is too large
5154                 * w32/subproc/sub_proc.c (process_begin): Fix test of the error
5155                 cause when the environment block is too large.
5156
5157 2015-10-27  Eli Zaretskii  <eliz@gnu.org>
5158
5159         Update README.W32.template
5160         * README.W32.template: Update for latest developments.  Make it
5161         clear we don't recommend using HAVE_CASE_INSENSITIVE_FS in
5162         general.
5163
5164         [SV 46304] Don't invoke C++ compiler on C sources on MS-Windows
5165         * default.c (default_variables) [HAVE_CASE_INSENSITIVE_FS]: Make
5166         COMPILE.C and LINK.C be synonyms for COMPILE.c and LINK.c,
5167         respectively.
5168
5169 2015-09-23  Eli Zaretskii  <eliz@gnu.org>
5170
5171         [SV 45838] When invoking w32 programs, don't use free'd memory.
5172         * w32/subproc/sub_proc.c (process_begin): Freeing argv[0] makes
5173         the other argv[i] pointers invalid, so need to allocate a new
5174         array and copy argv[i] for i != 0 first, replacing argv[0] with
5175         the batch file name, before we can free argv[0].
5176
5177 2015-07-13  Paul Smith  <psmith@gnu.org>
5178
5179         * implicit.c (pattern_search): [SV 43677] Mark files secondary.
5180         In order to fix SV 12267 we were marking the prerequisites of
5181         implicit (pattern) targets that existed elsewhere in the makefile
5182         as precious to keep them from being deleted as intermediate files.
5183         However this also keeps them from being deleted on error.  Instead
5184         mark them as secondary.
5185         * tests/scripts/targets/DELETE_ON_ERROR: Test DELETE_ON_ERROR.
5186
5187 2015-07-12  Paul Smith  <psmith@gnu.org>
5188
5189         [SV 28092] Preserve the exit status of the $(shell...) function.
5190         Add a new variable .SHELLSTATUS which holds the exit status of the
5191         last-invoked shell function or != assignment.
5192
5193         * NEWS, doc/make.texi: Document the change.
5194         * function.c (shell_completed, msdos_openpipe, func_shell_base): Add
5195         shell_completed() to handle the completion of the shell, by setting
5196         .SHELLSTATUS.  Call it where needed.
5197         * job.c (child_handler): Call shell_completed().
5198         * tests/scripts/functions/shell: Add tests for .SHELLSTATUS.
5199
5200 2015-07-12  Paul Smith  <psmith@gnu.org>
5201
5202         * tests/scripts/misc/fopen-fail: [SV 42390] Increase test timeout.
5203         * Makefile.am (check-regression): Force ulimit -n for fopen-fail test.
5204
5205         * job.c: [SV 43936] Check sigaction for error return.
5206
5207         [SV 45049] Check for '$' being the last character in a string.
5208         * expand.c (variable_expand_string): Add a single '$' if '$' ends the
5209         string.
5210         * read.c (find_char_unquote, get_next_mword): Stop if '$' ends the
5211         string.
5212         * variable.c (parse_variable_definition): Ditto.
5213
5214         * read.c (unescape_char): [SV 45050] Handle final backslashes.
5215         If the last thing in the string to be unescaped is a backslash,
5216         stop without reading beyond the end of the string.
5217
5218         * strcache.c: [SV 45275] Handle very long strings.
5219         Our previous behavior for handling too-long strings involved
5220         increasing the size of the default string cache buffer, but the
5221         implementation was incomplete.  Instead, create a one-off large
5222         string cache entry and add it directly to the full cache list
5223         without changing the default buffer size.
5224
5225 2015-07-12  Duncan Moore  <duncan.moore@gmx.com>  (tiny change)
5226
5227         * job.c [RISCOS]: Remove logic that is no longer required.
5228
5229 2015-07-12  Paul Smith  <psmith@gnu.org>
5230
5231         * remake.c (update_file): [SV 44742] Keep double-colon rule status.
5232         Fix suggested by Everett Boyer <EvBoyer@aol.com>
5233
5234 2015-07-10  James Johnston  <johnstonj.public@codenest.com>  (tiny change)
5235
5236         [SVN 45515] Check exit status of sub-make in subproc.bat
5237         * subproc.bat: Exit when sub-make invocation fails.
5238
5239 2015-07-10  Eli Zaretskii  <eliz@gnu.org>
5240
5241         [SV 45515] Ignore Windows-specific build artifacts
5242         * .gitignore: Ignore *.exe, *.dll.a, *.lib, *pdb, and a few more MSVC
5243         specific artifacts.
5244         Suggested by James Johnston <johnstonj.public@codenest.com>
5245
5246 2015-02-28  Eli Zaretskii  <eliz@gnu.org>
5247
5248         [SV 44348] Fix handling of shell widlcards on MS-Windows.
5249                 * job.c (construct_command_argv_internal): If shell wildcard
5250                 characters are found inside a string quoted with "..", give up the
5251                 fast route and go through the shell.  Fixes Savannah bug #44348.
5252
5253 2015-01-27  John Malmberg  <wb8tyw@qsl.net>
5254
5255         Fix bs-nl handling, exit and Environment for VMS.
5256         This fix required a complete rewrite of the command parser vmsjobs.c
5257         child_execute_job.  The old parser had too many incorrect assumptions
5258         about DCL commands and could not be repaired to extended.
5259
5260         The parser now more closely parses VMS commands and handles quoted
5261         commands and redirection.  Command File mode has been improved, but can
5262         not fully support bs-nl syntax.
5263
5264         VMS Unix shell simulation has been improved.
5265
5266         * commands.c: vms_comma_separator is now a run-time setting.
5267         * function.c: vms_comma_separator is now a run-time setting.
5268         * function.c(func_basename_dir) now reports "[]" or "./" based on
5269           VMS crtl runtime setting.
5270         * job.c(start_job_command): VMS Handle empty commands propery.
5271         * main.c: Add VMS environment variables for run-time settings.
5272           * vms_legacy_behavior - Force older behavior.
5273           * vms_comma_separator - Commas or spaces for separators.
5274           * vms_unix_simulation - Enhanced Posix shell simulation features.
5275           * Detect if VMS CRTL is set to report Unix paths instead of VMS.
5276           * ':' and '>' are also MAP_DIRSEP on VMS.
5277         * makeint.h: Add VMS run-time option variables.
5278         * readme.vms: Update to current behavior.
5279         * variable.c(define_variable_in_set): Fix VMS Environment variable
5280           lookup.
5281         * variable.c(define_automatic_variables): Remove some VMS specific
5282           automatic variables and use the Unix ones instead.
5283         * vms_export_symbol.c: Set max symbol size correctly.
5284         * vmsjobs.c: child_execute_job() complete rewrite of VMS comand
5285           parsing.
5286         * vmsjobs.c(build_vms_cmd): VMS commmand building with shell simulation.
5287
5288 2014-12-27  Christian Boos  <cboos@edgewall.org>  (tiny change)
5289
5290         Fix $(shell) on hosts with 64-bit pid_t.
5291         * function.c: Use pid_t for shell_function_pid.
5292         * job.c: Likewise.
5293
5294 2014-10-20  Paul Smith  <psmith@gnu.org>
5295
5296         * main.c (main): [SV 43434] Handle NULL returns from ttyname().
5297
5298 2014-10-20  Benedikt Morbach  <benedikt.morbach@googlemail.com>  (tiny change)
5299
5300         * tests/scripts/features/archives: [SV 43405] override AR variable.
5301
5302 2014-10-20  John Malmberg  <wb8tyw@qsl.net>
5303
5304         Fix VMS implicit rules and UNIX paths.
5305         This fixes VMS implicit rules and UNIX style pathname handling.
5306         It also fixes some of the VMS style pathname handling, more work
5307         there will be needed later.
5308         TODO: There are other case insensitive platforms besides VMS.
5309         We need to find out why there is extra VMS code for this.  This
5310         indicates either the extra VMS code is not needed, or the case
5311         insensitive support may not be complete on the other case
5312         insensitive platforms.
5313
5314         * default.c: Add missing definitions to default_suffix_rules[] and
5315         default_variables[].
5316         TODO: As it is important that VMS DCL mode definitions must always
5317         be a superset of UNIX definitions, a better way of maintaining the
5318         VMS DCL mode definitions should be devised.
5319         * dir.c (downcase_inplace): Add a reentrant downcase() routine.
5320         Add future support for VMS 8.2+ _USE_STD_STAT macro which will
5321         disable a lot of VMS specific code from compiling.
5322         (dir_file_exists_p): vmsify filename only if directory name has VMS
5323         directory delimiters.
5324         (file_exists_p): Handle both VMS and UNIX directories.
5325         (file_impossible): Handle both VMS and Unix directories.  Track
5326         whether a VMS format path is needed for the return value.
5327         * file.c (lookup_file): Check if vmsify is needed; handle UNIX paths.
5328         * implicit.c (pattern_search): Enable UNIX paths.
5329         * read.c (parse_file_seq): Enable UNIX paths.
5330         * remake.c (f_mtime): Fix gpath_search call for VMS paths.
5331         * rule.c (count_implicit_rule): Enable UNIX paths, Fix VMS paths.
5332         * vpath.c (selective_vpath_search): Enable UNIX paths.
5333
5334 2014-10-20  John Malmberg  <wb8tyw@qsl.net>
5335
5336         Update README.VMS and move news to the NEWS file
5337         * NEWS: Merge in VMS history.
5338         * README.VMS: Remove VMS history, document current behavior and
5339         known issues.
5340
5341 2014-10-20  John Malmberg  <wb8tyw@qsl.net>
5342
5343         [SV 41758]: Fix archive support for VMS.
5344         Upated to match change to run_make_tests and some future fixes to
5345         make on VMS.
5346
5347         * arscan.c: Use ANSI compatible pragmas instead of VAX C extensions.
5348         * tests/scripts/features/archives: Fix tests to use VMS rules and
5349         answers when running on VMS and using DCL as a shell.
5350         * tests/scripts/features/vpath3: Fix epected answer on test when
5351         run on VMS.
5352         * tests/scripts/vms/library: (New) Test the VMS library rules that
5353         are not tested by existing tests.
5354
5355 2014-10-20  John Malmberg  <wb8tyw@qsl.net>
5356
5357         [SV 42447]: VMS simulate exporting symbols
5358         This also includes fixing the most of the exit handling code for VMS.
5359
5360         Self tests:
5361          Previously about 94 Tests in 36 categories fail.
5362          Now about 45 tests in 22 categories fail.
5363
5364         Because some tests do not properly clean up, the number of tests that
5365         fail can vary by one or two test cases between consecutive runs.
5366
5367         * Makefile.am: Add new VMS files.
5368         * job.c: add prototype for vms_strsignal().
5369         * job.c: (child_error): Remove VMS specific code as no longer needed.
5370         * job.c: (reap_children): The VMS specific code was setting the
5371         status to 0 instead of setting it to the proper exit status.
5372         * job.h: Add vms_launch_status to struct child.
5373         * main.c: (main): Use environment variables for options to use MCR
5374         * instead of a foreign command, and to always use command files for
5375         subprocesses.
5376         For VMS use (set_program_name) routine which is common to ports of
5377         other GNU packages to VMS to set the program name used internally.
5378         Use (vms_putenv_symbol) to set up symbols to be visible in child
5379         programs, including recursive make launched by execve()
5380         Start of Bash shell detection code for VMS.
5381         * makefile.com: Need nested_include=none for building on VMS search
5382         lists.  Add vms_progname, vms_exit, and vms_export_symbol.
5383         * makefile.vms: Need nested_include=none for building on VMS search
5384         lists.  Add vms_progname, vms_exit, vms_export_symbol.
5385         * makeint.h: Make sure non-standard "VMS" macro is defined.  Add
5386         prototypes for new VMS routines.  Remove VMS-specific failure codes.
5387         * vmsjobs.c: Add VMS POSIX exit code constants.
5388         (_is_unixy_shell): Detect Bash shell.
5389         (vms_strsignal): simulate strsignal() on VMS.
5390         (vmsHandleChildTerm): fix to properly report failed LIB$SPAWN() exit
5391         status codes.  Remove code that duplicated code in job.c.
5392         (child_execute_job): Export environment symbols before spawning a
5393         child and restore afterward unless option to use command files for
5394         subprocesses is set.  Improve handling of UNIX null commands ":".
5395         * vms_exit.c: Provides vms_exit() to detect if an exit code is UNIX
5396         or VMS, and converts the UNIX code into a VMS exit code.
5397         * vms_export_symbol.c: Routines to create DCL symbols that work like
5398         shell aliases or exported shell symbols and clean them up on exit.
5399         * vms_export_symbol_test.com: Unit test for vms_export_symbol.c
5400         * vms_progname.c: New file: VMS specific replace for progname.c that
5401         is used in some GNU projects.
5402
5403 2014-10-20  John Malmberg  <wb8tyw@qsl.net>
5404
5405         Set up for running tests on VMS.
5406         * run_make_tests.pl: set $port_type to be 'VMS-DCL' when the test are
5407         run from the VMS DCL Interpreter.  When the tests are run from GNV
5408         on VMS, the $port_type will be 'UNIX'.
5409         * run_make_tests.com: VMS search list support.  This is needed for
5410         using a search list such as prj_root = lcl_root:,vms_root:,src_root:
5411         for building and testing.
5412
5413 2014-10-09  Paul Smith  <psmith@gnu.org>
5414
5415         * configure.ac, NEWS, README.git: Set up for the next release.
5416
5417 2014-10-05  Paul Smith  <psmith@gnu.org>
5418
5419         GNU Make release 4.1.
5420
5421 2014-10-02  Eli Zaretskii  <eliz@gnu.org>
5422
5423         Fix Cygwin compilation error.
5424         * job.c (construct_command_argv_internal) [HAVE_DOS_PATHS]: Fix
5425         initializer for sh_chars_sh.
5426         Reported by Denis Excoffier<cygwin@Denis-Excoffier.org>.
5427
5428 2014-10-01  Gisle Vanem  <gvanem@yahoo.no>
5429
5430         Fix last commit.
5431
5432         * makeint.h (ftruncate): Define also for __WATCOMC__.
5433
5434 2014-10-01  Eli Zaretskii  <eliz@gnu.org>
5435
5436         Avoid compilation warnings.
5437         * main.c (find_and_set_default_shell, main) [WINDOWS32]: Declare
5438         variables 'const char *' to avoid compiler warnings.
5439         * job.c (construct_command_argv_internal) [!NDEBUG]: Declare 'end'
5440         and set it only if NDEBUG is not defined, to avoid compiler
5441         warnings.
5442
5443         Treat redirection of standard handles on Windows as it is done on Unix.
5444         * job.c (start_job_command) [WINDOWS32]: Compute outfd and errfd
5445         as on Posix platforms, and pass the results to process_easy.
5446         * function.c (windows32_openpipe) [WINDOWS32]: Accept an
5447         additional argument ERRFD and use it for redirecting the standard
5448         error handle passed to the subprocess.
5449         (func_shell_base) [WINDOWS32]: Pass the computed errfd to
5450         windows32_openpipe.
5451
5452 2014-09-30  Paul Smith  <psmith@gnu.org>
5453
5454         Update Copyright statements for 2014.
5455
5456         * tests/scripts/features/load: Avoid unused variable warnings.
5457
5458         * loadapi.c (gmk_eval): Use C90 syntax.
5459
5460 2014-09-30  Hartmut Becker  <becker.ismaning@freenet.de>
5461
5462         * job.c: fix make action continuation lines.
5463         * vmsjobs.c: fix writing DCL command files when trimming (white
5464           spaces and $ signs) especially after a split (command continuation).
5465
5466 2014-09-15  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>  (tiny change)
5467
5468         * configure.ac: Fix spacing in helptext of customs
5469
5470 2014-09-15  Eli Zaretskii  <eliz@gnu.org>
5471
5472         Support MAKE_TERMOUT and MAKE_TERMERR on MS-Windows.
5473         * w32/compat/posixfcn.c (isatty, ttyname): New functions.
5474         * config.h.W32.template (HAVE_TTYNAME): Define.  Add a prototype
5475         for ttyname.
5476
5477 2014-09-15  Paul Smith  <psmith@gnu.org>
5478
5479         * loadapi.c (gmk_eval): [SV 43221] Preserve var buff content for eval.
5480
5481         * main.c, NEWS, doc/make.text: Rename MAKE_TTY* to MAKE_TERM*
5482
5483 2014-09-14  Paul Smith  <psmith@gnu.org>
5484
5485         * main.c (main): Set MAKE_TTYOUT and MAKE_TTYERR.
5486         * configure.ac: Test for isatty() and ttyname()
5487         * makeint.h: provide a substitute for ttyname() if it's not available.
5488         * config.ami.template, config.h-vms.template, config.h.W32.template:
5489         define/undefine HAVE_ISATTY/HAVE_TTYNAME macros.
5490         * NEWS, doc/make.texi: Document these new variables.
5491
5492 2014-09-07  Paul Smith  <psmith@gnu.org>
5493
5494         * tests/config-flags.pm.in, tests/scripts/features/archives: [SV 43046]
5495         Use the "ar" program detected by configure when running the test suite.
5496
5497         * doc/make.texi: Clarify implicit rule lookup of phony targets
5498         Reported by Frank Heckenbach <f.heckenbach@fh-soft.de>
5499
5500 2014-09-07  Hartmut Becker  <becker.ismaning@freenet.de>
5501
5502         Fix and enhance VMS library support.
5503         * ar.c: fix VMS library search for members, which do not have
5504         suffixes, aka filename extensions.
5505         * arscan.c: fix time conversion and library callback routines.
5506         * default.c: more suffixes and automatically create the VMS library
5507         if it doesn't exists.
5508
5509         Enhance VMS exporting make environment variables.
5510         * config.h-vms.template: add feature macro USE_DCL_COM_FILE to always
5511         write a DCL command file, enabled by default.
5512         * vmsjobs.c: with USE_DCL_COM_FILE enabled write make variables as DCL
5513         symbol assignments into the command file.  This enables printing
5514         directory and make level info for recursive use of make. This also
5515         enables forced DCL symbol substitution in the actions.
5516
5517         Fix VMS automatic variable expansion
5518         * function.c: add VMS code to func_notdir_suffix and func_basename_dir
5519         to work on comma separated lists; this fixes the expansion of
5520         $(^D), $(+D) and the F variants for VMS.
5521
5522         * main.c [VMS]: Say that parallel jobs (-j) are not supported on VMS
5523
5524         Enhance/fix VMS ONESHELL implementation and command execution
5525         * job.c, vmsjobs.c: fix some double quote and new line handling;
5526         implement ONESHELL with writing multiple lines into one DCL command
5527         procedure; in ONESHELL allow VMS/make internal redirection only on the
5528         first line; fix the created DCL command procedure, which didn't abort
5529         on errors; return correct exit status from the DCL command procedure;
5530         preserve current procedure verification; make the generated command
5531         procedure more robust.
5532
5533         Enhance/fix VMS setting of program name, MAKE/MAKE_COMMAND variables
5534         * default.c, main.c, makeint.h, vmsfunctions.c: prefix argv[0] with
5535         "mcr " for MAKE/MAKE_COMMAND and set the program name to the image
5536         filename (without the .exe;version)
5537         * vmsfunctions.c: remove obsolete code
5538         * vmsify: use xmalloc
5539
5540         Enhance/fix VMS exit code handling.
5541         * commands.c, function.c, hash.c, job.c, main.c, output.c:
5542         use MAKE exit codes.
5543         * makeint.h: encode make exit codes so that they are VMS compatible.
5544         * job.c: check child exit code for VMS style exit codes.
5545         * vmsjobs.c: save and return VMS style exit code.
5546
5547         Enhance/fix VMS multi-line support.
5548         * job.c: split the command line at a newline.
5549         * default.c, vmsjobs.c: change ECHO variable to a pseudo builtin,
5550         which ensures that the VMS/DCL ECHO ("write sys$output") is used
5551         and is correctly quoted.
5552         * vmsjobs.c: remove unused builtin 'rm'.
5553
5554         * config_flags_pm.com, [RENAMED test_make.com] run_make_tests.com:
5555         Moved into tests directory.
5556
5557         Enhance/fix VMS build environment
5558         * config.h-vms.template: make sure the CRTL version is known
5559         * makefile.com: always compile/link the guile module, remove VAXCRTL
5560         parameter, new LIST parameter
5561         * makefile.vms: always compile/link the guile module, use more
5562         complete dependencies
5563         * prepare_vms.com: helper to create a VMS config file when building
5564         from a snapshot of the repository
5565
5566 2014-09-07  Paul Smith  <psmith@gnu.org>
5567
5568         * configure.ac, maintMakefile, w32/Makefile.am: Fix autotools issues.
5569         Reported by Paul Eggert <eggert@cs.ucla.edu>
5570
5571 2014-08-30  Eli Zaretskii  <eliz@gnu.org>
5572
5573         Change the order of "makefile" and "Makefile" to match the manual.
5574
5575         Fix regression with "makefile" not being found on MS-Windows.
5576         * read.c (read_all_makefiles) [WINDOWS32]: Recognize "makefile",
5577         all-lowercase, as a makefile.  Reported by Michael Waeber
5578         <waeber@gmail.com>.
5579
5580 2014-07-16  Eli Zaretskii  <eliz@gnu.org>
5581
5582         Fix compilation on MS-Windows.
5583         * makeint.h [WINDOWS32]: Don't declare 'program' as 'const char *',
5584         since it is modified in 'main'.
5585
5586 2014-07-12  Eli Zaretskii  <eliz@gnu.org>
5587
5588         [SV 42695] Fix compilation error on MS-Windows.
5589         * main.c [WINDOWS32]: Don't declare 'program' as 'const char *',
5590         since it is modified in 'main'.
5591
5592 2014-07-12  Jonny Grant  <jg@jguk.org>  (tiny change)
5593
5594         Fix defalt_makefiles[] for MS-Windows.
5595         * read.c (read_all_makefiles) [WINDOWS32]: Remove the redundant
5596         "makefile" and add "makefile.mak".
5597
5598 2014-07-07  Fredrik Fornwall  <fredrik@fornwall.net>  (tiny change)
5599
5600         * arscan.c [ANDROID]: Android has no ar.h but supports archives.
5601
5602 2014-07-07  Paul Smith  <psmith@gnu.org>
5603
5604         * read.c (eval): [SV 41677] Correct test for TAB vs. 8 spaces.
5605
5606 2014-07-07  Piotr Jaroszynski  <pjaroszynski@nvidia.com>  (tiny change)
5607
5608         * output.c (pump_from_tmp): [SV 42378] Flush the output file regularly.
5609
5610 2014-07-07  John Malmberg  <wb8tyw@qsl.net>
5611
5612         Update the regression test harness to support VMS.
5613         * config_flags_pm.com, test_make.com: set up and run the regression
5614         test environment on VMS.
5615         * tests/run_make_tests.pl [VMS]: Use an alternate rmdir()
5616         implementation on VMS.
5617         (run_make_with_options) [VMS]: Provide VMS-specific quoting and shell
5618         invocations.
5619         (set_more_defaults) [VMS]: Set default values when running on VMS.
5620         * tests/test_driver.pl (vms_get_process_logicals) [VMS]: Retrieve the
5621         proper values from %ENV on VMS.
5622         (resetENV) [VMS]: Use it.
5623         (toplevel) [VMS]: Fix a bug with opendir() on some logical_devices.
5624         (compare_output) [VMS]: Convert VMS test output to a "standard" format.
5625         (_run_command) [VMS]: Handle signals and exit codes the VMS way.
5626         (remove_directory_tree_inner) [VMS]: Unlink all versions of the file.
5627
5628 2014-07-07  Paul Smith  <psmith@gnu.org>
5629
5630         * various: Assume ISO C89-compliant free() implementation.
5631
5632         * maintMakefile, various: Improve constification of the codebase.
5633
5634         [SV 41983] Support omitting the text argument to $(file ...)
5635         Reported by Tim Murphy <tnmurphy@gmail.com>
5636         * function.c (func_file): Only write TEXT if it is not NULL.
5637         * NEWS, doc/make.texi: Document the new feature
5638         * tests/scripts/functions/file: Verify that the no-text version of
5639           $(file ...) works and doesn't add a newline.
5640
5641 2014-05-13  Jacques Germishuys  <jacques.germishuys@gmail.com>
5642
5643         NMakefile.template ($(OUTDIR)/posixfcn.obj): Fix a typo.
5644
5645 2014-05-01  Paul Smith  <psmith@gnu.org>
5646
5647         [SV 42249] Propagate correct rule status results.
5648         * remake.c (update_file, update_file_1, check_dep): Return an enum
5649           update_status value instead of an int, and keep the highest value we
5650           find as we walk the graph so that the ultimate status is correct.
5651         * tests/scripts/options/dash-q: Add a test for updating prerequisites.
5652
5653 2014-02-08  Paul Smith  <psmith@gnu.org>
5654
5655         * Rename MAP_PATHSEP to MAP_DIRSEP.
5656
5657         * configure.ac: Fixup for newer autoconf/automake
5658
5659 2014-02-08  Ray Donnelly  <mingw.android@gmail.com>  (tiny change)
5660
5661         * output.c: Ensure space for final nul byte in fmtbuf.
5662
5663 2014-02-07  Gisle Vanem  <gvanem@yahoo.no>  (tiny change)
5664
5665         Improve error reporting in the Windows port when env size is too large.
5666         w32/subproc/misc.c (arr2envblk): Compute and return the size of
5667         the environment passed to child process.
5668
5669         w32/subproc/sub_proc.c (process_begin): If the call to
5670         CreateProcess failed with EINVAL, and the required environment
5671         size was larger than 32KB, assume it's a Windows XP limitation,
5672         and display an error message to that effect.
5673
5674         w32/subproc/proc.h (arr2envblk): Update prototype.
5675
5676 2014-02-01  Paul Smith  <psmith@gnu.org>
5677
5678         * job.c (set_child_handler_action_flags): [SV 41341]
5679         Ensure signal handler is in place before alarm(1).
5680
5681 2014-01-20  Alan Hourihane  <alanh@fairlite.co.uk>  (tiny change)
5682
5683         * configure.ac: [SV 40790] Fix load autoconf variables.
5684
5685 2014-01-17  Pavel Fedin  <p.fedin@samsung.com>  (tiny change)
5686
5687         Allow the EMX build to use output_sync.
5688         job.c (start_job_command): Move the child output diversion out
5689         of non-EMX branch.
5690         [__EMX__]: Don't use fixed FD_STDOUT and FD_STDERR in the call to
5691         child_execute_job.
5692
5693 2014-01-12  Paul Smith  <psmith@gnu.org>
5694
5695         * commands.c: [SV 40789] Remove unneeded header dlfcn.h
5696
5697         * main.c (die): Close output_context AND make_sync.
5698         die() can be invoked inside a separate output_context, if the
5699         $(error ...) function is expanded as part of a recipe.
5700
5701 2014-01-11  Pavel Fedin  <p.fedin@samsung.com>  (tiny change)
5702
5703         Fix .LIBPATTERNS for MS-Windows builds.
5704         default.c (.LIBPATTERNS) [__CYGWIN__ || WINDOWS32]: Provide
5705         library patterns for MS-Windows.
5706
5707 2013-11-27  Paul Smith  <psmith@gnu.org>
5708
5709         * w32/*: Remove TABs from the source code.
5710         I know whitespace commits are annoying, but having these TABs is
5711         causing me to miss things when I search through the code.  This
5712         doesn't try to change the w32 code to meet GNU coding standards.
5713
5714         * main.c (decode_env_switches): Ensure we have enough space.
5715         Reported (with patch) by Gerte Hoogewerf <g.hoogewerf@gmail.com>
5716
5717 2013-11-27  Stephan T. Lavavej  <stl@nuwen.net>  (tiny change)
5718
5719         Solve some Windows build issues.
5720         * main.c (main): Use ONS(), not OSN().
5721         (prepare_mutex_handle_string) [WINDOWS32]: Use %Ix formatting to
5722         support both 32bit and 64bit systems.
5723         * job.c (free_child, new_job): Use ONS(), not OSN().
5724         * w32/subproc/w32err.c (map_windws32_error_to_string): Use O() when
5725         calling fatal().
5726
5727 2013-11-24  Paul Smith  <psmith@gnu.org>
5728
5729         * features/loadapi (test_expand): Allocate memory for the nul byte.
5730
5731         * load.c (load_file): Reset the name length minus the symbol.
5732
5733         * read.c (unescape_char): Use memmove() for overlapping memory.
5734
5735         Fix memory leak during environment option decoding.
5736         * main.c (decode_switches): Always make a copy of option arguments.
5737         (decode_env_switches): Use a stack buffer to convert environment
5738         switches for parsing.
5739
5740         [SV 40226] Add a new type of switch: single-string options
5741         * main.c (struct command_switch): Change the "string" types to "strlist"
5742         and make "string" be a single-valued string instead.
5743         (output_sync_option, jobserver_fds, sync_mutex): Change to string type.
5744         (decode_output_sync_flags): Handle single strings instead of lists.
5745         (prepare_mutex_handle_string): Ditto.
5746         (main): Ditto.
5747         (clean_jobserver): Ditto.
5748         (init_switches): Handle the new type.
5749         (decode_switches): Ditto.
5750         (define_makeflags): Ditto.
5751
5752 2013-11-23  Daniel Richard G  <skunk@iskunk.org>  (tiny change)
5753
5754         * load.c: [SV 40515] Define RTLD_GLOBAL if not set.
5755
5756 2013-11-23  Paul Smith  <psmith@gnu.org>
5757
5758         [SV 40361] Don't use vsnprintf(), which is an ISO C99 function.
5759         * output.c (error, fatal, message): Take an extra argument specifying
5760         how many bytes are used by the formatted arguments.
5761         (get_buffer): New function that allocates the requested buffer size.
5762         Remove msc_vsnprintf(), vfmtconcat(), and fmtconcat() as unneeded.
5763         * makeint.h: Declare various helper macros for generating output.
5764         * *.c: Change all error(), fatal(), message() calls to use the macros,
5765         or pass the extra length argument directly.
5766
5767 2013-10-27  Paul Smith  <psmith@gnu.org>
5768
5769         * makeint.h (STOP_SET): [SV 40371] Cast to unsigned char.
5770         * tests/scripts/misc/utf8: Test variable names with characters >127.
5771         Fix suggested by Robert Bogomip <bob.bogo@milohedge.com>
5772
5773 2013-10-24  Gerte Hoogewerf  <g.hoogewerf@gmail.com>
5774
5775         Fix MS Visual Studio NET2003 build.
5776         * make_msvc_net2003.vcproj: Do not exclude guile.c from compilation.
5777
5778 2013-10-23  Christian Boos  <cboos@edgewall.org>
5779
5780         Fix SV bug #40227 with respect to stack size set for the MSVC build.
5781         * NMakefile.template (/STACK): Increase to 0x400000, mainly for
5782         the 64-bit builds.  Fixes SV bug #40227.
5783         (guile): Uncomment.
5784
5785 2013-10-23  Eli Zaretskii  <eliz@gnu.org>
5786
5787         Fix the MS-Windows build: now guile.c must always be compiled in.
5788         * build_w32.bat: Always compile guile.c and link against guile.o.
5789           Reported by Alexey Pavlov <alexpux@gmail.com>.
5790
5791         * makeint.h (guile_gmake_setup): Define prototype unconditionally,
5792         to avoid compiler warnings.
5793
5794 2013-10-22  Eli Zaretskii  <eliz@gnu.org>
5795
5796         Fix Savannah bug #31150 with failures due to setting window title.
5797         * sub_proc.c (process_begin): Don't set startInfo.lpTitle, it
5798         reportedly causes SV bug #31150, and according to MSDN it's a
5799         no-no.
5800
5801         Fix Savannah bug 40241 with Unixy file names as commands to MSYS shell.
5802         * sub_proc.c: Include filedef.h and variable.h.
5803         (process_begin): If exec_path was not found, but its first
5804         character is '/', assume there's some shell magic, and invoke the
5805         command through '$(SHELL) -c "COMMAND"'.  Fixes SV bug#40241.
5806         (make_command_line): Kludgey feature: if full_exec_path is "-c",
5807         assume that argv[0] is not to be skipped, as it holds the command
5808         string to be passed to the shell.
5809
5810 2013-10-20  Paul Smith  <psmith@gnu.org>
5811
5812         * glob.c (glob) [SV 18123]: Cherry-pick glibc fix
5813         Apply commit a471e96a5352a5f0bde6d32dd36d33524811a2b1 from
5814         git://sourceware.org/git/glibc.git to fix
5815         https://sourceware.org/bugzilla/show_bug.cgi?id=10278
5816
5817         * read.c (record_files): [SV 33034] Change fatal() to error()
5818         Allows deprecated syntax.  However we don't guarantee this syntax
5819         will continue to be legal in the future.
5820         Change suggested by David Boyce <david.s.boyce@gmail.com>
5821
5822         * README.git: Add some missing release steps.
5823
5824 2013-10-19  Paul Smith  <psmith@gnu.org>
5825
5826         [SV 40240] Use configure info to build load test shared libs
5827         * tests/config-flags.pm.in: A new file containing variable assignments
5828         for the test suite; these variables are set by configure to contain
5829         the values detected there for compilers, flags, etc.
5830         * tests/run_make_tests.pl: Require the config-flags.pm file
5831         * tests/scripts/features/load, tests/scripts/features/loadapi: Use the
5832         configure-provided values when building the shared test library.
5833         * configure.ac: Replace tests/config-flags.pm.in
5834         * Makefile.am: Make sure tests/config-flags.pm is up to date
5835
5836         * maintMakefile (checkcfg.%): Add testing of build.sh
5837
5838         [SV 40254] Modify build.sh to work properly with Guile support.
5839         * guile.c (guile_gmake_setup) [HAVE_GUILE]: Define a stub function
5840         when Guile support is not enabled.
5841         * main.c (main) [HAVE_GUILE]: Always invoke guile_gmake_setup().
5842         * Makefile.am: Make guile.c standard, not optional.
5843         * build.template: Add the Guile compiler and linker flags.
5844
5845         * maintMakefile: Accept variable overrides from the environment.
5846
5847         * NEWS: Fix version so we can build a distfile.
5848
5849         * read.c (eval): Avoid GCC warning to add braces.
5850
5851         * GNUMAKEFLAGS: Remove -O so it passes in NO_OUTPUT_SYNC mode.
5852
5853 2013-10-18  Christian Boos  <cboos@edgewall.org>
5854
5855         Fix initialization of stringlist variables for jobserver_fds and sync_mutex.
5856          (tiny change)
5857
5858          main.c (prepare_mutex_handle_string, main): Initialize
5859          stringlist variables with at least 2 members, as one member is not
5860          currently supported.
5861
5862 2013-10-18  Eli Zaretskii  <eliz@gnu.org>
5863
5864         Fix MinGW64 problem with non-compliant vsnprintf.
5865          makeint.h (__USE_MINGW_ANSI_STDIO) [__MINGW64_VERSION_MAJOR]:
5866          Define for MinGW64, to force it to use an ANSI-compliant
5867          implementation of vsnprintf.  Reported by Christian Boos
5868          <cboos@edgewall.org>.
5869
5870         Fix the MSVC build on MS-Windows.
5871          output.c (vsnprintf) [_MSC_VER]: Define, instead of defining
5872          snprintf, which isn't used.  Reported by Christian Boos
5873          <cboos@edgewall.org>.
5874          NMakefile.template (OBJS): Add load.obj and posixfcn.obj.
5875          ($(OUTDIR)/pathstuff.obj): New dependency.
5876          Suggested by Christian Boos <cboos@edgewall.org>.
5877
5878 2013-10-13  Paul Smith  <psmith@gnu.org>
5879
5880         [SV 40139] Modify "missing separator" for better translation
5881
5882         Add support for updating the GNU make web pages.
5883         Add makefile rules for updating the http://www.gnu.org/software/make
5884         web pages, including the online GNU make manual.
5885
5886         Convert to auto-generated ChangeLog files.
5887         Rename existing ChangeLog files so they won't be distributed.
5888         Add targets to maintMakefile to generate ChangeLog from the Git
5889         repository.  This will require a version of gnulib be available.
5890         Because ChangeLog is auto-generated, we have to switch our
5891         automake mode to "foreign" or it will complain and fail.
5892
5893         Set up for the next release.