summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* * tests/test_driver.pl: Remember if something failed and report itPaul Smith2022-12-201-0/+12
|
* [WINDOWS32] Remove CRNL from FormatMessage() result stringPaul Smith2022-12-193-39/+39
| | | | | | | | | | | | | Sometimes the error message is expected to contain a newline, other times it is not. Also the result of FormatMessage() sometimes ends in CRNL already: when printed via fprintf() the final newline is converted to CRNL, giving an output of CRCRNL which causes tests to fail to match. Remove any CR/NL chars from the result string. * src/job.c (reap_children): Add \n to the error message fprintf. (exec_command): Ditto. * src/w32/subproc/w32err.c (map_windows32_error_to_string): Remove any trailing CR or NL from the string before returning.
* [SV 63537] Document and test flippable switchesDmitry Goncharov2022-12-183-8/+534
| | | | | | | | | | | | | | | | | | * doc/make.texi (Options/Recursion): Clarify that MAKEFLAGS values from the environment have precedence over those set in the makefile. * tests/scripts/variables/MAKEFLAGS: Check boolean switches -k/-S, -w/--no-print-directory and -s/--no-silent as follows: 1. A switch can be enabled or disabled on the command line. 2. A switch can be enabled or disabled in env. 3. A switch can be enabled or disabled in makefile. 4. Command line beats env and makefile. 5. Env beats makefile. 6. MAKEFLAGS contains each specified switch at parse and build time. 7. If switches are specified in multiple origins, MAKEFLAGS contains the winning switch at parse and build time. 8. MAKEFLAGS does not contain the losing switch. Also test that --debug settings from different origins are combined together into one option.
* [SV 63537] Pass enabled-by-default switches to submakeDmitry Goncharov2022-12-181-44/+50
| | | | | | | | | | | Certain switches, such as -S or --no-silent, turn on behavior that is enabled by default. When a switch is specified via the command line, makefile, or env, ensure the switch is added to MAKEFLAGS. * src/main.c (struct command_switch): Add bit "specified". (switches): Initialize command_switch->specified. (decode_switches): Set command_switch->specified. (define_makeflags): Check command_switch->specified.
* [SV 63537] Remember the origin of command line optionsDmitry Goncharov2022-12-181-66/+101
| | | | | | | | | | | | | | | | | Certain options can be flipped on and off: -k/-S, -s/--no-silent, and -w/--no-print-directory. Ensure they behave as follows: 1. A switch can be enabled or disabled on the command line. 2. A switch can be enabled or disabled in env. 3. A switch can be enabled or disabled in makefile. 4. Command line beats env and makefile. 5. Env beats makefile. * src/main.c: Add variables to hold the origin of relevant options. (struct command_switch): Add origin field. (switches): Set a pointer to hold the origin of relevant options. (decode_switches): For any switch that can be specified in makefile or env, honor the switch only if cs->origin is not set or the specified origin beats cs->origin. Set cs->origin when relevant.
* [SV 63537] Fix setting -w in makefilesDmitry Goncharov2022-12-183-15/+22
| | | | | | | | * src/makeint.h: Replace print_directory flag with should_print_dir(). * src/main.c (main): Remove print_directory flag and related code. (should_print_dir): Create. * src/output.c (output_dump): Use should_print_dir(). (output_start): Ditto.
* [SV 63484] Force included makefiles to be explicitDmitry Goncharov2022-12-182-0/+16
| | | | | | | | | Ensure included makefiles are not treated as intermediate, even if they are created by an implicit rule. Reported by Patrick Oppenlander <patrick.oppenlander@gmail.com>. * src/read.c (eval_makefile): Mark makefiles as explicit. * tests/scripts/features/include: Add a test.
* [SV 63516] [DOS] Support include files with drivespecsPaul Smith2022-12-185-16/+39
| | | | | | | | | * src/makeint.h (HAVE_DRIVESPEC): Create a macro to check. * src/main.c (.FEATURES): Add "dospaths" as a feature. * src/read.c (eval_makefile) [DOS]: If the included makefile name starts with a drivespec, don't search the include directories. * doc/make.texi (Include): Document this behavior. * tests/scripts/features/include: Add a test.
* * src/job.c (new_job): [SV 63510] Trace phony prerequisite rebuildsPaul Smith2022-12-181-6/+45
|
* * configure.ac: Update for a new releasePaul Smith2022-12-183-4/+8
| | | | | * README.git: Add some packages needed for building from Git. * AUTHORS: Updates.
* [SV 63417] Ensure global .NOTINTERMEDIATE disables all intermediatesDmitry Goncharov2022-11-286-12/+12
| | | | | | | | | | | | | | | | | Fix .NOTINTERMEDIATE without prerequisites to disable intermediate status for all targets. * src/makeint.h: Declare extern no_intermediates. * src/main.c: Add global definition of no_intermediates. * src/file.c: Remove static no_intermediates to use global variable. (remove_intermediates): Check no_intermediates. * src/implicit.c (pattern_search): For a file found by implicit search set file->notintermediate if no_intermediates is set. * src/remake.c (update_file_1): Don't set file->secondary for a pre-existing file if no_intermediates is set. The check for no_intermediates here is redundant, but won't hurt: keep it in case things change so that it matters. * tests/scripts/targets/NOTINTERMEDIATE: Fix a test.
* * doc/make.texi: Use $(firstword) rather than $(word 1,)Paul Smith2022-11-281-1/+1
|
* [SV 63347] Always add command line variable assignments to MAKEFLAGSDmitry Goncharov2022-11-284-105/+336
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces two visible changes: 1. Keep command line variable assignments in MAKEFLAGS at all times, even while parsing makefiles. 2. Define makeflags immediately when a makefile modifies MAKEFLAGS. The new MAKEFLAGS and MAKEOVERRIDES initialization procedure: 1. decode_switches (argc, argv, o_command) is called to parse command line variable assignments. 2. Command line variable assignments go through quote_for_env. Initialize -*-command-variables-*- to the quoted values. 3. MAKEOVERRIDES is initialized to refer to -*-command-variables-*- with origin o_env to keep the definitions in the database intact. 4. define_makeflags() is called which adds MAKEOVERRIDES to MAKEFLAGS. 5. Makefiles are parsed. If a makefile modifies MAKEFLAGS, the new value of MAKEFLAGS is defined right away. 6. Env switches are decoded again as o_env. The definitions set by decode_switches at step 1 stay intact, as o_command beats o_env. We must preserve the original intact definitions in order to detect failure cases; for example: $ cat makefile all:; $(hello) $ make hello='$(world' makefile:1: *** unterminated variable reference. Stop. * src/makeint.h: Declare enum variable_origin, struct variable and define_makeflags(). Add parameter origin to decode_env_switches(). * src/main.c (define_makeflags): Remove "all". If a variable is assigned on the command line then append MAKEOVERRIDES to MAKEFLAGS. (decode_env_switches): Replace parameter env with origin. (decode_switches): Replace parameter env with origin. Treat origin == o_command as env == 0. (handle_non_switch_argument): Replace parameter env with origin. Treat origin == o_command as env == 0. (main): Call decode_switches() with origin==o_command before parsing makefiles. Call decode_switches() with origin==o_env after parsing makefiles. * src/variable.c (set_special_var): Define makeflags at parse time, each time a makefile modifies MAKEFLAGS. (do_variable_definition): Strip command line variable assignments from MAKEFLAGS before appending extra flags. set_special_var() adds them back. * tests/scripts/variables/MAKEFLAGS: Add tests.
* * src/main.c (main): [SV 63373] Don't use macros with memcmp()Paul Smith2022-11-161-1/+1
| | | | Reported by djm <mccannd@uk.ibm.com>
* Add specific hints for errors due to invalid conditionalsPaul Smith2022-11-153-27/+65
| | | | | | | | * src/read.c (eval): If "missing separator" appears to be due to missing space after ifeq/ifneq, give a hint about the error. * tests/scripts/misc/failure: Check for these types of failures. * tests/scripts/variables/special: Move error checking unrelated to special variables, to misc/failure.
* [SV 63333] Be more lenient when failing to create temporary filesDmitry Goncharov2022-11-136-21/+89
| | | | | | | | | | | | | | | | | | | | | | If make cannot create a temporary lock file for output sync, continue without output sync enabled rather than dying. However, if make cannot store a makefile from stdin to a temporary file that is still a fatal error. * misc.c (get_tmppath): Keep running on failure to generate a temporary file name. (get_tmpfd): Keep running on failure to get a temporary file. (get_tmpfile): Keep running on failure to open a temporary file. Ensure memory is freed if we return an error. * posixos.c (os_anontmp): Keep running on failure to open an anonymous temporary file. * output.c (setup_tmpfile): Print an error on failure to create an output sync lock file. * main.c (main): Die on failure to store makefile from stdin to a temporary file. * tests/scripts/features/output-sync: Add tests. * tests/scripts/features/temp_stdin: Ditto.
* Keep going if we can't connect to the jobserverPaul Smith2022-11-133-27/+39
| | | | | | | | * src/posixos.c (jobserver_parse_auth): Don't invoke fatal() if we can't connect to an existing jobserver: just keep going without it. * src/w32/w32os.c (jobserver_parse_auth): Ditto. * tests/scripts/features/jobserver: Add a test for invalid FIFO auth files.
* * src/dir.c (dir_contents_file_exists_p): Show dir name in error.Paul Smith2022-11-131-29/+26
| | | | | | | | If we fail to read a directory show the directory name in the error message. Pass struct directory instead of directory_contents to allow that. (dir_file_exists_p): Change dir_contents_file_exists_p caller. (open_dirstrem): Ditto.
* * src/main.c (main): [SV 63307] Handle SIGPIPE as a fatal signalPaul Smith2022-11-131-5/+3
| | | | Always ignoring SIGPIPE is visible to child processes.
* [SV 63315] tests: Simplify TERM signalingPaul Smith2022-11-133-2/+9
| | | | | | | | | | | | Tests that try to kill the make process were not behaving as expected on OpenBSD: the signal was sent from make to its children but the sleep didn't die. Something odd about the way the shell treats TERM. To reduce platform dependencies add "term" to the helper tool and run that instead of kill / sleep. * tests/thelp.pl: Add a new operation "term" that takes a PID. * tests/scripts/features/output-sync: Use it. * tests/scripts/features/temp_stdin: Ditto.
* [SV 63315] Allocate function names when defining functionsPaul Smith2022-11-131-1/+1
| | | | | | * src/function.c (define_new_function): Don't keep a pointer to the user-provided name of a user-defined function: if the .so is unloaded it will point to garbage. Add the name to the strcache instead.
* tests: Don't convert \ to / when checking regex'sPaul Smith2022-11-132-154/+133
| | | | | | | | | | | | | When tests compare the output they will try converting backslashes to slashes to see if that works. When we compare using regex's, we can't do that because backslashes can escape special characters. * tests/test_driver.pl (compare_output): Clean up this function. (compare_answer_vms) [VMS]: Comparing answers on VMS is complex; move all of it into its own function returning 0/1. (compare_answer): A new function to compare answers: return 0/1. Remember the CRLF->LF conversion forever; only check \ -> / when we compare strings, not regex's.
* * src/hash.c (jhash_string): Help the compiler optimize the hashJustine Tunney2022-11-131-7/+13
| | | | | | Invoke memcpy() with a constant length, where possible. Copyright-paperwork-exempt: yes
* * src/config.h.W32 [TCC]: Only redefine strtoll if not definedPaul Smith2022-11-121-3/+7
|
* * src/config.h.W32: Fix last change.Eli Zaretskii2022-11-091-4/+4
|
* Fix build with Tiny CEli Zaretskii2022-11-051-0/+4
| | | | | | * src/config.h.W32 (strtoll, strtoull) [__TINYC__]: Redirect to _strtoi64 and _strtoui64, respectively. Reported by Christian Jullien <eligis@orange.fr>.
* Release GNU Make 4.44.4Paul Smith2022-10-313-4/+4
| | | | | | * NEWS: Update the version and date. * configure.ac: Update the version. * doc/make.texi: Update the EDITION.
* * README.git: Update and clarify release operationsPaul Smith2022-10-311-65/+92
|
* Fix issues found by ASAN and CoverityPaul Smith2022-10-3110-28/+47
| | | | | | | | | | | | | | | * tests/test_driver.pl: Preserve the LSAN_OPTIONS variable. * tests/scripts/targets/ONESHELL: Don't set a local variable. * tests/scripts/functions/let: Test empty let variable. * src/posixos.c (osync_parse_mutex): Free existing osync_tmpfile. * src/misc.c (get_tmpfd): Set umask() before invoking mkstemp(). * src/ar.c (ar_parse_name): Check invalid name (shouldn't happen). * src/function.c (define_new_function): Free previous function entry when replacing it with a new one. * src/job.c (child_execute_job): Initialize pid for safety. (construct_command_argv_internal): In oneshell mode ensure that the returned argv has the right format (0th element is a pointer to the entire buffer).
* Avoid C99 constructsPaul Smith2022-10-293-20/+25
| | | | | | | | | | Although gnulib requires C99, most of the code does compile with a C90 compiler (perhaps with a lot of warnings). Reinstate our C90 configuration test, and clean up a few C99 things that crept in. * src/job.c (construct_command_argv_internal): Don't use loop-local variables or C++ comments. * src/read.c (eval_makefile): Don't use loop-local variables.
* * build.sh: Allow a "keep-going" mode during buildsPaul Smith2022-10-292-10/+35
|
* tests: Avoid the use of File::Temp->newdir()Paul Smith2022-10-293-33/+30
| | | | | | | | | | This was added in Perl 5.8 but some systems still only provide older versions such as Perl 5.6. We don't really need it anyway. Paul Eggert <eggert@cs.ucla.edu> reported this issue. * tests/README: Update this to be a bit more modern. * tests/test_driver.pl: Delete the $TEMPDIR variable. * tests/scripts/features/temp_stdin: Use $temppath not $TEMPDIR.
* * src/posixos.c (os_anontmp): [SV 63287] Only fail O_TMPFILE oncePaul Smith2022-10-291-5/+11
| | | | Reported by Dmitry Goncharov <dgoncharov@users.sf.net>.
* [SV 62174] Force locale to be "C" before retrieving error messagesPaul Smith2022-10-281-72/+75
| | | | | | | | | | | We attempt to do this with POSIX::setlocale() but apparently on some systems (AIX) this isn't sufficient. So, in addition force the LC environment variables to use "C". Reported by Dmitry Goncharov <dgoncharov@users.sf.net>. * tests/run_make_tests.pl: Move the global setup into set_default(). Force the %ENV locale variables to use the ones we'll use when running make, then reset them back again after we find error messages.
* * src/job.c: [SV 63185] Don't use ifdef with HAVE_DECL_* macrosPaul Smith2022-10-271-2/+1
|
* * tests/scripts/features/exec: Don't test with C shellsPaul Smith2022-10-251-3/+11
| | | | | | Using C shells (csh, tcsh) with make is known to be problematic due to incorrect ways it handles open file descriptors, at least. If the user's shell is *csh then don't try it during exec tests.
* Increase the test framework timeout from 5s to 60sPaul Smith2022-10-253-6/+6
| | | | | | | | | | | | It seems that some of the test environments hit the 5s timeout on some tests. Since it doesn't really matter, as long as we don't hang forever, increase the timeout to 60s. * tests/test_driver.pl: Increase $test_timout to 60. We don't need to handle VMS timeouts specially anymore. * tests/scripts/features/parallelism: We don't need to override the default timeout anymore. * tests/scripts/features/patternrules: Remove confusing comment.
* * Makefile.am (check-regression): Add a random suffix to results filePaul Smith2022-10-252-4/+12
| | | | | Put the results into a subdirectory for easy unpacking. * .gitignore: Ignore it.
* Release GNU Make 4.3.924.3.92Paul Smith2022-10-242-7/+7
| | | | | * configure.ac: Modify the release version. * NEWS: Update the version and date.
* [SV 63260] Don't recurse forever if setup_tmpfile() failsPaul Smith2022-10-241-10/+24
| | | | | | | | | | | | | If we fail during setup_tmpfile() we'll try to write an error, which will invoke setup_tmpfile() again, etc. Avoid infinite recursion. Original patch by Dmitry Goncharov <dgoncharov@users.sf.net> * src/output.c (setup_tmpfile): Remember we're in this function and return immediately if we enter it during recursion. (message): Remember the starting location and use that instead of fmtbuf.buffer. (error): Ditto. (fatal): Ditto.
* * src/output.c (_outputs): Don't use invalid output sync FDsPaul Smith2022-10-241-11/+15
| | | | Just write to stdout/stderr in this situation.
* * src/misc.c (get_tmpdir): Report errors if tmpdirs are invalidPaul Smith2022-10-242-7/+33
| | | | * src/main.c (main): Set up initial temporary directories.
* * src/posixos.c (os_anontmp): If O_TMPFILE fails try dup() method.Dmitry Goncharov2022-10-231-8/+13
|
* * src/rule.c (get_rule_defn): Don't use STRING_SIZE_TUPLE in mempcpyPaul Smith2022-10-232-2/+4
| | | | If mempcpy() is a macro then STRING_SIZE_TUPLE won't compile.
* Provide a maintainer-only debug methodPaul Smith2022-10-232-0/+20
| | | | | | | | | | | Generating debug logs to stdout or stderr makes it impossible to run tests etc. so create a dumb DBG facility to log to a temp file. This exists only in maintainer mode and the DBG macro gives a compile error if it's used in non-maintainer mode. * src/makeint.h (DBG): Call dbg() in maintainer mode, else error. (dbg): Define it in maintainer mode. * src/misc.c (dbg): Open a log file for append, write, then close.
* * configure.ac: Check that we can link with GuilePaul Smith2022-10-221-3/+23
| | | | | On multi-arch systems we may be able to find the header file but not successfully link the library.
* Set PATH_MAX on systems without a default valuePaul Smith2022-10-226-14/+16
| | | | | | | | | | | | | | | | Some systems (HURD) use fully-dynamic pathnames, with no limit. We can't support this without significant effort so for now set PATH_MAX to a large value. * src/makeint.h: Set PATH_MAX to 4096 if not set and MAXPATHLEN is also not set. Remove MAXPATHLEN setting: we won't use it. * src/misc.c (get_path_max): If we can't get the path max via pathconf() use the default PATH_MAX. * src/dir.c (find_directory) [W32]: Use MAX_PATH not MAXPATHLEN. (local_stat) [W32]: Ditto. * src/job.c (create_batch_file) [W32]: Ditto. * src/remake.c (name_mtime) [W32]: Ditto. * src/w32/w32os.c (os_anontmp) [W32]: Ditto.
* [SV 63098] Enhance detection of missing peer also-make targetsPaul Smith2022-10-222-32/+59
| | | | | | | | | | | | The previous attempt to detect missing peer targets for implicit rules had some holes. Move the detection to notice_finished_file(). * src/remake.c (check_also_make): If we don't have the current mtime for the file, obtain it. (update_goal_chain): Don't call check_also_make() here. (check_dep): Ditto. (notice_finished_file): If we finished running an implicit rule that has also_make targets, invoke check_also_make().
* Collect failure details when the regression tests failPaul Smith2022-10-224-4/+38
| | | | | | * README.in: Add a section on running regression tests. * Makefile.am (check-regression): Capture the test run output, and on failure collect configure and test results into a tar file.
* Enhance tests to work on different systemsPaul Smith2022-10-229-28/+35
| | | | | | | | | | | | | | | | | | | | | The GNU platform testers reported a number of test errors on different systems; try to address them. * tests/thelp.pl: A number of tests timed out with a 4-second timeout. Increase the default timeout to 10 seconds. * tests/run_make_tests.pl: Executing directories on cygwin behaves differently in Perl than make so skip these tests there. * tests/scripts/options/symlinks: Check for the symlink feature in make, rather than whether the system supports them. * tests/scripts/features/implicit_search: On some systems "false" exits with a different exit code. Use the helper instead. * tests/scripts/features/loadapi: Ditto. * tests/scripts/features/output-sync: Sleep before make -f bar in the first test as well as the second one. * tests/scripts/features/exec: Skip on cygwin, which seems to be "UNIX" but where scripts don't run normally. * tests/scripts/misc/fopen-fail: Skip on cygwin, where make eventually exits with exit code 0 and no error messages.