summaryrefslogtreecommitdiff
path: root/main.c
AgeCommit message (Collapse)AuthorFilesLines
2014-10-20[SV 42447]: VMS simulate exporting symbolsJohn Malmberg1-8/+48
This also includes fixing the most of the exit handling code for VMS. Self tests: Previously about 94 Tests in 36 categories fail. Now about 45 tests in 22 categories fail. Because some tests do not properly clean up, the number of tests that fail can vary by one or two test cases between consecutive runs. * Makefile.am: Add new VMS files. * job.c: add prototype for vms_strsignal(). * job.c: (child_error): Remove VMS specific code as no longer needed. * job.c: (reap_children): The VMS specific code was setting the status to 0 instead of setting it to the proper exit status. * job.h: Add vms_launch_status to struct child. * main.c: (main): Use environment variables for options to use MCR * instead of a foreign command, and to always use command files for subprocesses. For VMS use (set_program_name) routine which is common to ports of other GNU packages to VMS to set the program name used internally. Use (vms_putenv_symbol) to set up symbols to be visible in child programs, including recursive make launched by execve() Start of Bash shell detection code for VMS. * makefile.com: Need nested_include=none for building on VMS search lists. Add vms_progname, vms_exit, and vms_export_symbol. * makefile.vms: Need nested_include=none for building on VMS search lists. Add vms_progname, vms_exit, vms_export_symbol. * makeint.h: Make sure non-standard "VMS" macro is defined. Add prototypes for new VMS routines. Remove VMS-specific failure codes. * vmsjobs.c: Add VMS POSIX exit code constants. (_is_unixy_shell): Detect Bash shell. (vms_strsignal): simulate strsignal() on VMS. (vmsHandleChildTerm): fix to properly report failed LIB$SPAWN() exit status codes. Remove code that duplicated code in job.c. (child_execute_job): Export environment symbols before spawning a child and restore afterward unless option to use command files for subprocesses is set. Improve handling of UNIX null commands ":". * vms_exit.c: Provides vms_exit() to detect if an exit code is UNIX or VMS, and converts the UNIX code into a VMS exit code. * vms_export_symbol.c: Routines to create DCL symbols that work like shell aliases or exported shell symbols and clean them up on exit. * vms_export_symbol_test.com: Unit test for vms_export_symbol.c * vms_progname.c: New file: VMS specific replace for progname.c that is used in some GNU projects.
2014-10-01Avoid compilation warnings.Eli Zaretskii1-3/+3
* main.c (find_and_set_default_shell, main) [WINDOWS32]: Declare variables 'const char *' to avoid compiler warnings. * job.c (construct_command_argv_internal) [!NDEBUG]: Declare 'end' and set it only if NDEBUG is not defined, to avoid compiler warnings.
2014-09-30Update Copyright statements for 2014.Paul Smith1-1/+1
2014-09-15* main.c, NEWS, doc/make.text: Rename MAKE_TTY* to MAKE_TERM*Paul Smith1-4/+6
2014-09-14* main.c (main): Set MAKE_TTYOUT and MAKE_TTYERR.Paul Smith1-1/+11
* configure.ac: Test for isatty() and ttyname() * makeint.h: provide a substitute for ttyname() if it's not available. * config.ami.template, config.h-vms.template, config.h.W32.template: define/undefine HAVE_ISATTY/HAVE_TTYNAME macros. * NEWS, doc/make.texi: Document these new variables.
2014-09-07* main.c [VMS]: Say that parallel jobs (-j) are not supported on VMSHartmut Becker1-1/+1
2014-09-07Enhance/fix VMS setting of program name, MAKE/MAKE_COMMAND variablesHartmut Becker1-5/+9
* default.c, main.c, makeint.h, vmsfunctions.c: prefix argv[0] with "mcr " for MAKE/MAKE_COMMAND and set the program name to the image filename (without the .exe;version) * vmsfunctions.c: remove obsolete code * vmsify: use xmalloc
2014-09-07Enhance/fix VMS exit code handling.Hartmut Becker1-4/+4
* commands.c, function.c, hash.c, job.c, main.c, output.c: use MAKE exit codes. * makeint.h: encode make exit codes so that they are VMS compatible. * job.c: check child exit code for VMS style exit codes. * vmsjobs.c: save and return VMS style exit code.
2014-07-12[SV 42695] Fix compilation error on MS-Windows.Eli Zaretskii1-0/+6
* main.c [WINDOWS32]: Don't declare 'program' as 'const char *', since it is modified in 'main'.
2014-07-07* various: Assume ISO C89-compliant free() implementation.Paul Smith1-12/+6
2014-07-07* maintMakefile, various: Improve constification of the codebase.Paul Smith1-55/+59
2014-02-08* Rename MAP_PATHSEP to MAP_DIRSEP.Paul Smith1-3/+3
2014-01-12* main.c (die): Close output_context AND make_sync.Paul Smith1-2/+7
die() can be invoked inside a separate output_context, if the $(error ...) function is expanded as part of a recipe.
2013-11-27* main.c (decode_env_switches): Ensure we have enough space.Paul Smith1-5/+4
Reported (with patch) by Gerte Hoogewerf <g.hoogewerf@gmail.com>
2013-11-27Solve some Windows build issues.Stephan T. Lavavej1-2/+2
* main.c (main): Use ONS(), not OSN(). (prepare_mutex_handle_string) [WINDOWS32]: Use %Ix formatting to support both 32bit and 64bit systems. * job.c (free_child, new_job): Use ONS(), not OSN(). * w32/subproc/w32err.c (map_windws32_error_to_string): Use O() when calling fatal(). Copyright-paperwork-exempt: yes
2013-11-24Fix memory leak during environment option decoding.Paul Smith1-10/+11
* main.c (decode_switches): Always make a copy of option arguments. (decode_env_switches): Use a stack buffer to convert environment switches for parsing.
2013-11-24[SV 40226] Add a new type of switch: single-string optionsPaul Smith1-71/+49
* main.c (struct command_switch): Change the "string" types to "strlist" and make "string" be a single-valued string instead. (output_sync_option, jobserver_fds, sync_mutex): Change to string type. (decode_output_sync_flags): Handle single strings instead of lists. (prepare_mutex_handle_string): Ditto. (main): Ditto. (clean_jobserver): Ditto. (init_switches): Handle the new type. (decode_switches): Ditto. (define_makeflags): Ditto.
2013-11-23[SV 40361] Don't use vsnprintf(), which is an ISO C99 function.Paul Smith1-44/+57
* output.c (error, fatal, message): Take an extra argument specifying how many bytes are used by the formatted arguments. (get_buffer): New function that allocates the requested buffer size. Remove msc_vsnprintf(), vfmtconcat(), and fmtconcat() as unneeded. * makeint.h: Declare various helper macros for generating output. * *.c: Change all error(), fatal(), message() calls to use the macros, or pass the extra length argument directly.
2013-10-19[SV 40254] Modify build.sh to work properly with Guile support.Paul Smith1-2/+0
* guile.c (guile_gmake_setup) [HAVE_GUILE]: Define a stub function when Guile support is not enabled. * main.c (main) [HAVE_GUILE]: Always invoke guile_gmake_setup(). * Makefile.am: Make guile.c standard, not optional. * build.template: Add the Guile compiler and linker flags.
2013-10-18Fix initialization of stringlist variables for jobserver_fds and sync_mutex.Christian Boos1-4/+6
(tiny change) main.c (prepare_mutex_handle_string, main): Initialize stringlist variables with at least 2 members, as one member is not currently supported.
2013-10-05Sanitize the registered function interface.Paul Smith1-1/+6
Expand the characters which are legal in a function name, and check the name for validity. Create a type for the function pointer. Convert the last argument from a boolean to flags, to allow for expansion.
2013-09-30Final fixes for obscure output-sync errors.Paul Smith1-40/+38
2013-09-29Reset GNUMAKEFLAGS after parsing.Paul Smith1-1/+9
If we don't do this we'll continually add flags on recursion. This is mainly for users to set in their environment before invoking make.
2013-09-22Add VMS port updates from Hartmut Becker.Paul Smith1-1/+1
2013-09-21Invert the #define for output-sync: turn it off with NO_OUTPUT_SYNCPaul Smith1-4/+8
2013-09-21Ensure that output generated while reading makefiles is synced.Paul Smith1-0/+47
2013-09-21Ensure that stderr from shell functions in recipes is synced.Paul Smith1-1/+2
2013-09-21Don't write "Entering" every time we re-exec for remake makefiles.Paul Smith1-6/+14
2013-09-18[SV 40043] Set the current directory before printing errors.Paul Smith1-5/+5
2013-09-16Small cleanup defining MAKEFLAGS.Paul Smith1-25/+11
2013-09-15[SV 39934] Verify jobserver FDs before something else uses them.Paul Smith1-84/+94
2013-09-15[SV 39203] Don't set MAKEFLAGS when restarting.Paul Smith1-12/+6
We are restarting with the original command line flags, so if we set MAKEFLAGS as well that will cause double flags.
2013-09-14[SV 35248] Add --debug "n" flag to turn off current debug options.Paul Smith1-1/+10
2013-09-14[SV 33134] Don't try to close stdout when it's already closed.Paul Smith1-4/+0
2013-09-14Support the -Orecurse option properly.Paul Smith1-36/+19
In this mode we still collect all the output from a given target and dump it at once. However we don't treat recursive lines any differently from non-recursive lines. Also we don't print enter/leave messages after every dump. However we do ensure that we always print them once to stdout, so the parent make will collect it properly.
2013-09-12Enhance the output sync mode.Paul Smith1-93/+7
Create a new file, output.c, and collect functions that generate output there. We introduce a new global context specifying where output should go (to stdout or to a sync file), and the lowest level output generator chooses where to write output based on that context. This allows us to set the context globally, and all operations that write output (including functions like $(info ...) etc.) will use it. Removed the "--trace=dir" capability. It was too confusing. If you have directory tracking enabled then output sync will print the enter/leave message for each synchronized block. If you don't want that, disable directory tracking.
2013-07-22[Bug #39310] Parse simple pattern prereqs for globbing.Paul Smith1-1/+1
We tried to get some efficiency by avoiding a parse_file_seq() for simple pattern prerequisites, but this also means no wildcard expansion was happening, so add it back. Add regression tests for wildcards in target and prerequisite lists.
2013-07-21[Bug #39158] Source cleanups suggested by cppcheck utility.Paul Smith1-2/+1
2013-07-14Modify the update_status field in struct file to be an enum.Paul Smith1-30/+20
Makes the code a little clearer/cleaner, and solves a problem on systems where a char is unsigned by default.
2013-06-28Set O_APPEND mode for stdout/stderr and output-sync temporary files.Paul Smith1-0/+6
POSIX does not guarantee that writes will be atomic if a file is opened for normal (non-append) output. That means if multiple processes are writing to the same file, output could be lost. I can't think of a real use-case where we would NOT want append for stdout/stderr, so force it if we can.
2013-06-22Fix a fatal error at startup on Windows due to non-ASCII characters in PATH.Eli Zaretskii1-9/+12
main.c (find_and_set_default_shell): Don't use file_exists_p or dir_file_exists_p, as those call readdir, which can fail if PATH includes directories with non-ASCII characters, and that would cause Make to fail at startup with confusing diagnostics. See https://sourceforge.net/mailarchive/message.php?msg_id=30846737 for the details.
2013-06-22Create a character map to use for locating stop-points in strings.Paul Smith1-2/+46
In various places we were passing flags and characters to compare, then using complex conditionals to see where to stop in string searches. Performance numbers reveal that we were spending as much as 23% of our processing time in these functions, most of it in the comparison lines. Instead create a character map and use a single bitwise comparison to determine if this is any one of the stop characters.
2013-06-21Disable database verification unless debug enabled.Paul Smith1-40/+47
The database verification can take a long time. Only enable it if debug mode is enabled. If MAKE_MAINTAINER_MODE is set, it's also enabled by default.
2013-05-27Cleanups.Paul Smith1-11/+10
2013-05-26[SV #39028] Fix some small typos in messages.Paul Smith1-1/+1
2013-05-22Force version printing whenever we print the database.Paul Smith1-3/+4
2013-05-22Make MFLAGS and MAKEFLAGS more reliable and predictable.Paul Smith1-115/+80
Ensure all simple flags are kept in the initial batch of flags. Do not allow any flags with options in that batch. If there are only non-simple flags ensure MAKEFLAGS begins with " ". Don't let MFLAGS start with "- ".
2013-05-17Fix MS-Windows compilation when OUTPUT_SYNC is not defined.Eli Zaretskii1-0/+4
main.c (prepare_mutex_handle_string): Define conditioned on OUTPUT_SYNC.
2013-05-17Update source file format: remove TABs, use GNU coding styles.Paul Smith1-133/+149
2013-05-17Update copyright for changes in 2013.Paul Smith1-1/+1