summaryrefslogtreecommitdiff
path: root/src/misc.c
Commit message (Collapse)AuthorAgeFilesLines
* Add support for .WARNINGS special variablePaul Smith2023-04-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a new special variable, .WARNINGS, to allow per-makefile control over warnings. The command line settings will override this. Move the handling of warning flags to a new file: src/warning.c. Allow the decode to work with generic strings, and call it from decode_switches(). * Makefile.am: Add new file src/warning.c. * build_w32.bat: Ditto. * builddos.bat: Ditto. * po/POTFILES.in: Ditto. * src/makeint.h: #define for the .WARNINGS variable name. * src/warning.h: Add declarations for methods moved from main.c. Rename the enum warning_state to warning_action. * src/warning.c: New file. Move all warning encode/decode here from main.c. * src/main.c: Move methods into warning.c and call those methods instead. (main): Set .WARNINGS as a special variable. * src/job.c (construct_command_argv): Rename to warning_action. * src/read.c (tilde_expand): Ditto. * src/variable.c (set_special_var): Update warnings when the .WARNINGS special variable is set. * tests/scripts/options/warn: Check invalid warning options. * tests/scripts/variables/WARNINGS: Add tests for the .WARNINGS special variable.
* Directly handle $\ line endingsPaul Smith2023-02-261-8/+24
| | | | | | | | | | | | | | Previously we used the fact that this line ending expanded to "$ " which would then expand to the empty string. This has problems if you enable warnings for undefined variables, so directly implement this special (but documented) trick in the GNU Make parser. As a side-effect this also removes all previous whitespace when in GNU Make mode (not in POSIX mode) just as it would without "$". * src/misc.c (collapse_continuations): Check for "$\" and remove it. * tests/scripts/variables/flavors: Add regression tests including with previous whitespace, and escaped/unescaped "$"
* Use MK_OS_OS2 macro instead of __EMX__Paul Smith2023-01-161-3/+3
| | | | | * src/makeint.h: Set MK_OS_OS2 to 1 if __EMX__ is set. * src/*: Convert #if refs to __EMX__, to use MK_OS_OS2.
* Use MK_OS_DOS macro instead of __MSDOS__Paul Smith2023-01-161-1/+1
| | | | | | * src/configh.dos: Set MK_OS_DOS to 1 * src/*: Convert #if refs to __MSDOS__, to use MK_OS_DOS. * gl/lib/*: Ditto.
* Rename WINDOWS32 macro to MK_OS_W32Paul Smith2023-01-151-3/+3
| | | | | | | | | | * configure.ac: Set MK_OS_W32 to 1 if we're on Windows32. * src/config.h.W32: Ditto. * mk/Windows32.mk: Ditto. * src/makeint.h: Convert #if refs to WINDOWS32, to use MK_OS_W32. * src/*: Ditto. * src/w32/*: Ditto. * gl/lib/*: Ditto.
* Rename VMS macro to MK_OS_VMSPaul Smith2023-01-151-2/+2
| | | | | | * src/makeint.h: Set MK_OS_VMS to 1 if we're on VMS. * src/*: Convert all #if references to VMS, to use MK_OS_VMS. * gl/lib/*: Ditto.
* * src/misc.c (ttyname) [OS/2]: Add an implementation for OS/2 kLIBCKO Myung-Hun2023-02-191-0/+39
|
* Convert references from "GNU make" to "GNU Make"Paul Smith2023-01-011-1/+1
|
* Update the copyright year on all filesPaul Smith2023-01-011-1/+1
|
* Apply spelling fixes discovered by CodespellPaul Smith2022-12-311-1/+1
| | | | | | | | | | | | | | | | | | * maintMakefile: Apply spelling fixes. * src/file.c: Ditto. * src/misc.c: Ditto. * src/remake.c: Ditto. * src/vmsjobs.c: Ditto. * src/w32/pathstuff.c: Ditto. * tests/test_driver.pl: Ditto. * tests/run_make_tests.com: Ditto * tests/scripts/features/implicit_search: Ditto * tests/scripts/features/output-sync: Ditto * tests/scripts/features/patternrules: Ditto * tests/scripts/features/se_explicit: Ditto * tests/scripts/features/statipattrules: Ditto * tests/scripts/functions/foreach: Ditto * tests/scripts/variables/MAKEFLAGS: Ditto
* [SV 63333] Be more lenient when failing to create temporary filesDmitry Goncharov2022-11-131-18/+46
| | | | | | | | | | | | | | | | | | | | | | 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.
* Fix issues found by ASAN and CoverityPaul Smith2022-10-311-0/+7
| | | | | | | | | | | | | | | * 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).
* * src/misc.c (get_tmpdir): Report errors if tmpdirs are invalidPaul Smith2022-10-241-7/+29
| | | | * src/main.c (main): Set up initial temporary directories.
* Provide a maintainer-only debug methodPaul Smith2022-10-231-0/+16
| | | | | | | | | | | 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.
* Set PATH_MAX on systems without a default valuePaul Smith2022-10-221-3/+3
| | | | | | | | | | | | | | | | 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.
* Update URLs to use https rather than httpPaul Smith2022-10-181-1/+1
| | | | | * (all): Change http:// to https:// * README.W32: Remove invalid link to mingw.org.
* Rework temp file handling to avoid GNU libc warningsPaul Smith2022-10-181-47/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original patch provided by Paul Eggert <eggert@cs.ucla.edu>. GNU libc will generate a link-time warning if we use mktemp() even though we are using it safely (we only use it with mkfifo()). Avoid this and clean up some handling. First, check all calls related to temporary files and exit with a fatal error and a useful message if we can't obtain them. In some situations it might be possible to continue with reduced capability but it's not worth the effort. On POSIX systems we can create anonymous temp files using O_TMPFILE if it's supported, else if we're using the default location and we have dup(2), we can use standard tmpfile() and get an FD from it. If we need a named temp file and FILE* and we have mkstemp() we can use that, else if we have fdopen() we can get a temp FD and open it. If none of those are available all we can do is generate a temp name then open it with fopen() which is not secure. * src/makeint.h (get_tmpdir): Declare it for use elsewhere. * src/misc.c (get_tmpdir): Make it public not static. (get_tmptemplate): Simplify the implementation. (get_tmppath): Only define this if we have to have it to avoid warnings from GNU libc. (get_tmpfd): Generate fatal errors on error. (get_tmpfile): Ditto. Open files in "wb+" mode to match tmpfile(). Require a filename pointer (all callers want it). * src/os.h (os_anontmp): Implement for posixos.c as well. * src/posix.c (jobserver_setup): Don't use mktemp to avoid GNU libc errors. Instead construct the FIFO name based on the PID. (osync_setup): get_tmpfd() can't fail so don't check it. (os_anontmp): If the system supports O_TMPFILE use it. If not, and we want to create the temporary file in the default directory, we can use tmpfile() then use dup() to copy the file descriptor. * src/main.c (main): get_tmpfile() can't fail. * src/vmsjobs.c (child_execute_job): get_tmpfile() can't fail.
* [SV 63215] Remember the random seed for shuffle modePaul Smith2022-10-161-5/+4
| | | | | | | | | | Basic fix provided by James Hilliard <james.hilliard1@gmail.com>. Ensure we remember and propagate the random seed we generate during shuffle mode. Also add a debug statement displaying the seed. * src/shuffle.c (shuffle_set_mode): Init and save the randoms seed. * src/misc.c (make_rand): Code cleanups. * src/main.c (main): Show a debug message containing the seed.
* * src/misc.c (make_lltoa): Use printf format macro from makeint.hPaul Smith2022-10-031-10/+4
| | | | (make_ulltoa): Ditto.
* Implement a simple xorshift 32bit random number generatorPaul Smith2022-10-011-0/+29
| | | | | | | | | | | | | | | | Avoid relying on the system random number generator for our random shuffle, so that the same seed gives the same results on all systems. This generator doesn't need to be amazing, just pretty good, so don't bother with xorshift* or xorshift+, etc. * src/makeint.h: Declare make_seed() and make_rand(). * src/misc.c (make_seed): Set the seed value for the RNG. (make_rand): Return the next random number. If the seed was not set initialize it first. * src/shuffle.c (shuffle_set_mode): If we don't get a seed from the user just leave it unset (0). (shuffle_deps_recursive): Use make_seed() not srand(). (random_shuffle_array): Use make_rand() not rand().
* Provide new functions to convert long long to stringPaul Smith2022-09-251-0/+24
| | | | | | | | | | | | | | | | | | | | The previous attempt to use PRI* macros to avoid compiler-specific printf format specifiers didn't work because we are using raw long long type, not the uintX_t types. On systems where long and long long are the same size, uint64_t might be type "long" and PRId64 is just "ld". Instead write new functions that convert [unsigned] long long to a string and call those instead. * src/makeint.h: Declare make_lltoa() and make_ulltoa(). * src/misc.c (make_lltoa): New function that writes a long long value into a provided buffer. Return the buffer for ease-of-use. (make_ulltoa): Ditto, for unsigned long long. * src/function.c (func_wordlist): Call these new methods. Also rework the error strings so we share the translated string. * src/dir.c (print_dir_data_base): Call the new methods instead of using MSVC macros.
* * src/misc.c (strncasecmp): Use size_t for length to match std.Paul Smith2022-09-251-1/+1
| | | | * src/misc.h (strncasecmp): Fix the declaration.
* Support the MAKE_TMPDIR environment variablePaul Smith2022-09-111-13/+25
| | | | | | | | | | | Allow build systems to choose an alternative location for make to store its temporary files. * NEWS: Announce the new environment variable. * doc/make.texi (Temporary Files): Provide documentation. * src/misc.c (get_tmpdir): Split into a new function. Compute the temporary directory and store it in a static location. * tests/scripts/features/jobserver: Add a test of MAKE_TMPDIR.
* Rework output sync to lock a temp file on POSIXPaul Smith2022-08-301-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some POSIX systems do not allow locks to be taken on non-files, such as pipes. This is a problem since very often make is invoked with its stdout redirected to a pipe. Also, if stdout is redirected to a file that already has a lock on it for some other reason (perhaps a shared file such as /dev/null) it can cause a hang. This means our previous method of locking stdout, although it had some nice advantages, is not portable enough. Instead, use a temporary file and take the lock on that. We pass the name of the file to child make processes. On Windows we continue to use a shared mutex for output sync. Remove POSIX emulation functions like fcntl from Windows; instead follow the lead of the jobserver and create an interface in os.h for output sync, and move the OS-specific content to posixos.c and w32os.c. * NEWS: Add a note. * src/makeint.h (ALL_SET): Check that all bits are set. * src/os.h: Add bits for checking the state of stdin/stdout/stderr. Add prototypes for OS-specific output sync methods. * src/posixos.c (check_io_state): Determine the status of stdin, stdout, stderr an return a suite of bits describing them. (osync_enabled): If the global variable holding the FD of the lock file (osync_handle) is valid return true. (osync_setup): Create a temporary file and remember its name in a global variable (osync_tmpfile), and set osync_handle. (osync_get_mutex): If output sync is enabled, return the filename of the lock file prefixed with "fnm:" to denote a filename. (osync_parse_mutex): If the provided filename has the wrong format disable output sync. Else open the lock file and set osync_handle. (osync_clear): Close osync_handle. If we're the parent make, then also unlink the temporary file. (osync_acquire): Take a lock on the osync_handle descriptor. (osync_release): Release the lock on the osync_handle descriptor. (fd_set_append): Add APPEND mode to a file descriptor. * src/w32/w32os.c: Perform the same actions as posixos.c, copying the details from src/w32/compat/posixfcn.c. Use a mutex rather than locking a temporary file. * src/output.h: Remove all the OS-specific content. * src/output.c: Remove all the OS-specific content. (set_append_mode): Remove and replace with fd_set_append(). (sync_init): Remove and replace with check_io_state(). (acquire_semaphore): Remove and replace with osync_acquire(). (release_semaphore): Remove and replace with osync_release(). (setup_tmpfile): If the IO state is not obtained, get it. If stdout and/or stderr are valid, set up a tempfile to capture them. (output_init): Set io_state if not set already, and check it when deciding whether to close stdout on exit. * src/main.c (main): If we're syncing, set up the mutex using the new osync_setup() / osync_parse_mutex() methods. (prepare_mutex_handl_string): Replace with osync_parse_mutex(). (die): Call osync_clear(). * src/w32/compat/posixfcn.c: Remove implementations of fcntl(), record_sync_mutex(), create_mutex(), and same_stream().
* Add get_tmpfd() and allow anonymous temp filesPaul Smith2022-08-301-24/+60
| | | | | | | | | | | | | | | | | | | | | | | | The output sync feature wants a file descriptor not a FILE*. We were using tmpfile() but this returns FILE* which means we needed to dup() the descriptor then fclose() the original, which is just unnecessary overhead for every command we run. Create a get_tmpfd() method that returns a file descriptor directly by using mkstemp() if available, else do the best we can. Also allow anonymous temp files if the filename pointer is NULL. This causes the file to be unlinked. On Windows this requires a special open so add an os_anontmp() method to handle this. * src/makeint.h: Add prototype for get_tmpfd(). * src/misc.c (get_tmpfd): If we have mkstemp() use that, else just open(2). If we don't want to keep the filename, unlink the file. (get_tmpfile): Use get_tmpfd() if we have fdopen(), else use fopen(). * src/output.c (output_tmpfd): Call get_tmpfd() with NULL. * src/os.h (os_anontmp): On Windows make this a function, else fails. * src/w32/compat/posixcfn.c (tmpfile): Move to w32os.c:os_anontmp(). * src/w32/w32os.c (os_anontmp): Create a temp file that will be deleted when the process exits, and return a file descriptor to it.
* Enhance get_tmpfile() and add get_tmppath()Paul Smith2022-08-021-15/+73
| | | | | | | | | | | | | | | | | | Move all the logic on creating temporary files into misc.c, and add a new function get_tmppath() that returns the pathname to a temporary file without creating or opening it. * src/makeint.h: Add a declaration for get_tmppath(). Remove the template argument from get_tmpfile(): it will compute its own. * src/main.c (main): Remove the logic for computing templates. * src/vmsjobs.c (child_execute_job): Ditto. * src/misc.c (get_tmptemplate): New function to return an allocated template string for use with various mktemp-style functions. (get_tmppath): Return an allocated path to a temporary file, but do not create it. Generally this should be avoided due to TOCTOU issues. (get_tmpfile): Use get_tmptemplate() to generate a template rather than using one passed in. If we don't have mkstemp() then use get_tmppath() to compute the path of a temp file.
* * configure.ac: Check for stpcpy() support.Paul Smith2022-07-091-0/+15
| | | | * src/misc.c (stpcpy): Define it if not provided.
* getloadavg: Remove support for privileged invocationPaul Smith2022-07-091-248/+0
| | | | | | | | | | | | | | | | | | | | | | | This was needed when getloadavg required privileged access; in this case GNU make needed to be installed as a setgid program. But this hasn't been supported by gnulib getloadavg() since 2011 and systems are no longer using it, so remove it. * src/makeint.h (user_access): Remove unnecessary function. (make_access): Ditto. (child_access): Ditto. * src/misc.c: Remove implementations of the *_access() functions. * src/main.c (main): Remove unneeded call to user_access(). * src/job.c (load_too_high): Remove calls to {make,user}_access(). (exec_command): Remove call to child_access(). * src/remote-cstms.c: Remove calls to these methods. I suppose it might be possible this is needed and was piggy-backing on the privileged setting but since that's been broken for a while I doubt this is needed. If so we can bring back the implementation into this source file. * src/config.h.W32.template: Remove GETLOADAVG_PRIVILEGED undef. * src/config.h-vms.template: Ditto. * src/config.ami.template: Ditto.
* bootstrap: Remove strerror()Paul Smith2022-07-091-0/+119
| | | | | | * bootstrap.conf: Remove strerror module * configure.ac: Add a check for strerror * src/misc.c: Add a default strerror() if not found
* bootstrap: Remove strtoll()Paul Smith2022-07-091-0/+8
| | | | | | | | | This pulls in entirely too much stuff we don't need. Instead grab just the gnulib source file, then include it in src/misc.c. * bootstrap.conf: Add just the lib/strtol.c source file. * configure.ac: Check for strtoll. * src/misc.c: Include strtol.c, with QUAD set, if needed.
* * src/misc.c (make_toui): Parse a string into an unsigned intPaul Smith2022-06-041-0/+19
| | | | | | | | | * src/makeint.h: Declare it. * src/arscan.c (ar_scan): Replace atoi() calls with make_toui(). Modify some integral types to be more correct. * src/job.c (load_too_high): Replace atoi() calls with make_toui(). * src/main.c (main): Ditto. (decode_switches): Ditto.
* * src/misc.c (make_pid): A function to return the PIDPaul Smith2022-06-041-0/+10
| | | | | * src/makeint.h: Declare it. * src/commands.c (fatal_error_signal): Call it.
* * <all>: Update copyright notices.Paul Smith2022-02-101-1/+1
|
* [SV 61042] Enhance logging of implicit rule searchDmitry Goncharov2021-10-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logging of implicit rule search gives limited information as to why a given implicit rule was rejected, and if no implicit rule is found we get the confusing "No rule to make target" result when the real issue is that some prerequisite of some implicit rule could not be built. Enhance logging around implicit rule search as follows: 1. The messages which refer to a rule print a description (the targets and prerequisites) of the rule. 2. A new message tells when a rule is rejected, along with the reason. 3. The 'Looking for an implicit rule...' message is printed for every prerequisite, not just the top-level target. 4. "Trying harder" message is printed, when intermediate prerequisites are going to be searched. 5. The 'No rule found...' and 'Found implicit rule...' messages are printed for every prerequisite, not just the top-level target. 6. "Ought to exist...", "Found..." or "Not found..." message is printed for each prerequisite. * src/rule.h (struct rule): Remember the definition of the rule. * src/rule.c (get_rule_defn): Compute the definition of a rule. (install_pattern_rule): Initialize the definition to empty. (create_pattern_rule): Ditto. (freerule): Free the definition. (print_rule): Use the definition when printing rules. * src/remake.c (update_file_1): Push debug output down into try_implicit_rule(). * src/implicit.c (try_implicit_rule): Add debugging (pattern_search): Show the rule definition in various debug output. Add new debug messages for implicit rule search. Additional changes by Paul Smith <psmith@gnu.org>: Since we usually don't need the rule definition, defer computing it until we do. * bootstrap.conf: Include the mempcpy Gnulib module. * src/makeint.h (mempcpy): Declare mempcpy if not available. * src/misc.c (mempcpy): Define mempcpy if not available. * src/config.h-vms.template: Don't set HAVE_MEMPCPY. * src/config.h.W32.template: Ditto. * src/rule.h (get_rule_defn): Return the definition of a rule. * src/rule.c (get_rule_defn): If we don't have a definition compute it; either way return it. * src/implicit.c (pattern_search): Rework the handling of explicit prerequisites to pattern rules to be more clear. There is no change in behavior.
* [SV 59881] Handle vertical TAB consistentlyPaul Smith2021-03-151-1/+2
| | | | | | | | | | | | | | While parsing makefiles get_next_mword() was treating VTAB as a word character rather than a word separator. However, when using find_next_token(), for example in patsubst_expand_pat(), we treated VTAB as a word separator causing multiple words to appear where we didn't expect them. * src/makeint.h (END_OF_TOKEN): Change from a loop to a boolean check. * src/misc.c (end_of_token): Move the loop here. * src/read.c (get_next_mword): Skip whitespace, not just blank, to find the start of the word and use END_OF_TOKEN() to decide when the current word is finished.
* [SV 57930] Cast char to unsigned char to call ctype functionsPaul Smith2020-05-031-4/+4
| | | | | | | | | | | | | This cast was already done almost everywhere: fix some stragglers. * src/load.c (load_file): Cast char to unsigned char. * src/misc.c (strcasecmp, strncasecmp): [!POSIX] Ditto. * src/dir.c (vms_hash): [VMS] Ditto. * src/vms_progname.c (set_program_name): [VMS] Ditto. * src/vms_jobs.c (posix_parse_dq): [VMS] Ditto. (posix_parse_dollar): [VMS] Ditto. (build_vms_cmd): [VMS] Ditto. (child_execute_job): [VMS] Ditto.
* Update copyright statements for 2020Paul Smith2020-01-031-1/+1
|
* * src/misc.c (spin): On WINDOWS32 use Sleep() instead of sleep()Ben Wijen2019-12-181-1/+7
|
* * src/implicit.c (pattern_search): Set lastslash correctlyJouke Witteveen2019-12-171-0/+24
| | | | | | If filename contained multiple slashes lastslash is wrongly set to 0. * configure.ac: Check for the GNU memrchr() extension function. * src/misc.c (memrchr): Supply memrchr() if not available.
* Fix MS-Windows MinGW buildEli Zaretskii2019-08-281-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects): Fix format specifier for GetLastError's value. * src/job.c (reap_children): Define the 'remote_status_lose' label only for Posix platforms, to avoid compiler warning. * build_w32.bat (LNKOUT): New variable, using forward slashes. Use forward slashes in calls to :Compile, so that linking with GNU ld works. * src/makeint.h [!HAVE_UMASK]: Prototype for 'umask'. (UMASK, MODE_T): Don't define. * src/misc.c (get_tmpfile): Don't call UMASK, call umask, to avoid compilation warning on !HAVE_UMASK platforms. * src/output.c (output_tmpfd): Likewise. * src/misc.c (umask) [!HAVE_UMASK]: New no-op function. * src/config.h.W32.template (__USE_MINGW_ANSI_STDIO) [__MINGW32__]: Define to 1, to force Make use ANSI-compatible stdio functions, which also support the non-standard 'Id' and 'Ix' specifiers. (HAVE_UMASK) [__MINGW32__]: Define to 1. * src/arscan.c (ar_member_touch): Type-cast argument of strlen to avoid compiler warnings.
* Update maintainer mode to support debug wait points.Paul Smith2019-08-261-0/+22
| | | | | | | | | | | | | | Make a spin() method available when compiled in maintainer mode. If a file exists in the working directory with a specific name, make will sleep until the file is deleted. Ensure that maintainer mode is enabled on Windows, using the same algorithm we use on POSIX / autoconf systems. * build_w32.bat: If maintMakefile exists, enable maintainer mode. * src/main.c (main): Replace Windows-only suspend flag with spin(). * src/makeint.h: A SPIN() macro calls spin() in maintainer mode. * src/misc.c (spin): If a spin file exists sleep until it's deleted.
* Switch to the gnulib version of strerror()Paul Smith2019-07-131-20/+0
| | | | | | | | | * bootstrap.conf: Add strerror module * configure.ac: Remove strerror check * src/misc.c: Remove local strerror() implementation * src/config.ami.template: Remove HAVE_STRERROR * src/config.h-vms.template: Ditto. * src/config.h.W32.template: Ditto.
* Update copyright statements for 2019Paul Smith2019-05-191-1/+1
|
* Change output_write() to writebuf(), add readbuf() helper.Paul Smith2018-09-161-0/+46
| | | | | | | | | | | | | * src/misc.c (writebuf, readbuf): Create helper functions that will reliably write a buffer to a file descriptor in the face of EINTR causing short writes, and read from a file descriptor into a buffer in the face of EINTR causing short reads. * src/makeint.h: Declare these functions. * src/output.c: Remove output_write() and replace with writebuf(). (_outputs, out_of_memory): Call writebuf(), not output_write(). * src/arscan.c (ar_scan): Call readbuf() instead of read(2). (ar_member_touch): Remove duplicate header write, call writebuf() instead of output_write(), and readbuf() instead of read(2).
* Resolve most of the Windows Visual Studio warnings.Paul Smith2018-07-021-9/+9
| | | | | * Convert integer types to size_t where necessary. * Align other integral types to avoid casts and type warnings.
* * all: Update Copyright statements for 2018Paul Smith2018-07-011-1/+1
|
* Rework directory structure to use GNU-recommended "src" directory.Paul Smith2017-11-191-0/+761
Move the source code (other than glob) into the "src" subdirectory. Update all scripting and recommendations to support this change. * *.c, *.h, w32/*: Move to src/ * configure.ac, Makefile.am, maintMakefile: Locate new source files. * Basic.mk.template, mk/*: Update for new source file locations. * NEWS, README.DOS.template: Update for new locations. * build.template, build_w32.bat, builddos.bat: Ditto. * po/POTFILES.in: Ditto * tests/run_make_tests.pl, tests/scripts/features/load*: Ditto. * make.1: Move to doc. * mk/VMS.mk: Add support for building on VMS (hopefully). * makefile.vms, prepare_w32.bat: Remove. * SCOPTIONS: Update to define HAVE_CONFIG_H