diff options
author | Paul Smith <psmith@gnu.org> | 2013-09-14 01:04:04 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2013-09-14 01:04:04 -0400 |
commit | c5bfa400448a14f4c8d4fc51dd56ea17176e1f84 (patch) | |
tree | 9a46584dec752bdf9a1a50fc7941d9344fece30d /main.c | |
parent | deff9dacc97cc20015d3018992f2c77cb7fab102 (diff) | |
download | gunmake-c5bfa400448a14f4c8d4fc51dd56ea17176e1f84.tar.gz |
Support the -Orecurse option properly.
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.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 55 |
1 files changed, 19 insertions, 36 deletions
@@ -954,7 +954,7 @@ find_and_set_default_shell (const char *token) { *ep = '\0'; - sprintf (sh_path, "%s/%s", p, search_token); + sprintf (sh_path, "%s/%s", p, search_token); if (_access (sh_path, 0) == 0) { default_shell = xstrdup (w32ify (sh_path, 0)); @@ -974,15 +974,15 @@ find_and_set_default_shell (const char *token) } /* be sure to check last element of Path */ - if (p && *p) - { - sprintf (sh_path, "%s/%s", p, search_token); - if (_access (sh_path, 0) == 0) - { - default_shell = xstrdup (w32ify (sh_path, 0)); - sh_found = 1; - } - } + if (p && *p) + { + sprintf (sh_path, "%s/%s", p, search_token); + if (_access (sh_path, 0) == 0) + { + default_shell = xstrdup (w32ify (sh_path, 0)); + sh_found = 1; + } + } if (sh_found) DB (DB_VERBOSE, @@ -1154,24 +1154,7 @@ main (int argc, char **argv, char **envp) # endif #endif - /* Make sure stdout is line-buffered. */ - -#ifdef HAVE_SETVBUF -# ifdef SETVBUF_REVERSED - setvbuf (stdout, _IOLBF, xmalloc (BUFSIZ), BUFSIZ); -# else /* setvbuf not reversed. */ - /* Some buggy systems lose if we pass 0 instead of allocating ourselves. */ - setvbuf (stdout, 0, _IOLBF, BUFSIZ); -# endif /* setvbuf reversed. */ -#elif HAVE_SETLINEBUF - setlinebuf (stdout); -#endif /* setlinebuf missing. */ - - /* Configure stdout/stderr to be in append mode. - This keeps parallel jobs from losing output due to overlapping writes. */ - - set_append_mode (fileno (stdout)); - set_append_mode (fileno (stderr)); + output_init (NULL); /* Figure out where this program lives. */ @@ -1418,16 +1401,16 @@ main (int argc, char **argv, char **envp) /* Set always_make_flag if -B was given and we've not restarted already. */ always_make_flag = always_make_set && (restarts == 0); - /* Print version information. */ - if (print_version_flag || ISDB (DB_BASIC)) + /* Print version information, and exit. */ + if (print_version_flag) { print_version (); - - /* 'make --version' is supposed to just print the version and exit. */ - if (print_version_flag) - die (0); + die (0); } + if (ISDB (DB_BASIC)) + print_version (); + #ifndef VMS /* Set the "MAKE_COMMAND" variable to the name we were invoked with. (If it is a relative pathname with a slash, prepend our directory name @@ -1670,7 +1653,7 @@ main (int argc, char **argv, char **envp) #endif /* !HAVE_DOS_PATHS */ strcat (template, DEFAULT_TMPFILE); - outfile = open_tmpfile (&stdin_nm, template); + outfile = output_tmpfile (&stdin_nm, template); if (outfile == 0) pfatal_with_name (_("fopen (temporary file)")); while (!feof (stdin) && ! ferror (stdin)) @@ -1945,7 +1928,7 @@ main (int argc, char **argv, char **envp) #ifdef WINDOWS32 /* sub_proc.c cannot wait for more than MAXIMUM_WAIT_OBJECTS objects - * and one of them is the job-server semaphore object. Limit the + * and one of them is the job-server semaphore object. Limit the * number of available job slots to (MAXIMUM_WAIT_OBJECTS - 1). */ if (job_slots >= MAXIMUM_WAIT_OBJECTS) |