recipe and variable definitions, so it can be a useful debugging tool
in complex environments.
-@item -O
+@item -O[@var{type}]
@cindex @code{-O}
-@itemx --output-sync
+@itemx --output-sync[=@var{type}]
@cindex @code{--output-sync}
-@cindex output of parallel execution
-@cindex parallel execution, output of
+@cindex output during parallel execution
+@cindex parallel execution, output during
Ensure that the complete output from each recipe is printed in one
uninterrupted sequence. This option is only useful when using the
@code{--jobs} option to run multiple recipes simultaneously
-(@pxref{Parallel, ,Parallel Execution}). Without this option output
-will be displayed as it is generated by the recipes.
-
-With no argument or the argument @samp{1}, messages from each job in
-recursive makes are grouped together. With the argument @samp{2}, the
-complete output from any recursive make is grouped together. The latter
-achieves better grouping of output from related jobs, but causes longer
-delay, since messages do not appear until the recursive make has
-completed. Therefore @samp{-O} is more useful when watching the output
-while make runs, and @samp{-O2} is better suited when running a complex
-parallel build in the background and checking its output afterwards.
+(@pxref{Parallel, ,Parallel Execution}) Without this option output
+will be displayed as it is generated by the recipes.@refill
+
+With no type or the type @samp{target}, output from each individual
+target is grouped together. With the type @samp{make}, the output
+from an entire recursive make is grouped together. The latter
+achieves better grouping of output from related jobs, but causes
+longer delay since messages do not appear until the entire recursive
+make has completed (this does not increase the total build time,
+though). In general @samp{target} mode is useful when watching the
+output while make runs, and @samp{make} mode is useful when running a
+complex parallel build in the background and checking its output
+afterwards.
@item -q
@cindex @code{-q}
int db_level = 0;
+#ifdef OUTPUT_SYNC
+
+/* Synchronize output (--output-sync). */
+
+static struct stringlist *output_sync_option;
+
+#endif
+
/* Tracing (--trace). */
int trace_flag = 0;
static unsigned int inf_jobs = 0;
-#ifdef OUTPUT_SYNC
-
-/* Default value for output-sync without an argument. */
-
-static unsigned int no_output_sync = 0;
-static unsigned int default_output_sync = OUTPUT_SYNC_FINE;
-
-#endif
-
/* File descriptors for the jobs pipe. */
static struct stringlist *jobserver_fds = 0;
Consider FILE to be very old and don't remake it.\n"),
#ifdef OUTPUT_SYNC
N_("\
- -O [2], --output-sync[=2] Synchronize output of parallel jobs [coarse].\n"),
+ -O[TYPE], --output-sync[=TYPE]\n\
+ Synchronize output of parallel jobs by TYPE.\n"),
#endif
N_("\
-p, --print-data-base Print make's internal database.\n"),
{ 'n', flag, &just_print_flag, 1, 1, 1, 0, 0, "just-print" },
{ 'o', filename, &old_files, 0, 0, 0, 0, 0, "old-file" },
#ifdef OUTPUT_SYNC
- // { 'O', flag, &output_sync, 1, 1, 0, 0, 0, "output-sync" }, // two-state
- { 'O', positive_int, &output_sync, 1, 1, 0, &default_output_sync,
- &no_output_sync, "output-sync" },
+ { 'O', string, &output_sync_option, 1, 1, 0, "target", 0, "output-sync" },
#endif
{ 'p', flag, &print_data_base_flag, 1, 1, 0, 0, 0, "print-data-base" },
{ 'q', flag, &question_flag, 1, 1, 1, 0, 0, "question" },
int one_shell;
-/* Either OUTPUT_SYNC_FINE or OUTPUT_SYNC_COARSE
- if the "--output-sync" option was given.
- This attempts to synchronize the output of parallel
- jobs such that the results of each job stay together.
- It works best in combination with .ONESHELL. */
+/* Either OUTPUT_SYNC_TARGET or OUTPUT_SYNC_MAKE if the "--output-sync" option
+ was given. This attempts to synchronize the output of parallel jobs such
+ that the results of each job stay together. */
int output_sync;
}
}
+static void
+decode_output_sync_flags (void)
+{
+ const char **pp;
+
+ if (!output_sync_option)
+ return;
+
+ for (pp=output_sync_option->list; *pp; ++pp)
+ {
+ const char *p = *pp;
+
+ if (streq (p, "target"))
+ output_sync = OUTPUT_SYNC_TARGET;
+ else if (streq (p, "make"))
+ output_sync = OUTPUT_SYNC_MAKE;
+ else
+ fatal (NILF, _("unknown output-sync type '%s'"), p);
+ }
+}
+
#ifdef WINDOWS32
/*
* HANDLE runtime exceptions by avoiding a requestor on the GUI. Capture
}
#endif
- decode_debug_flags ();
-
/* Set always_make_flag if -B was given and we've not restarted already. */
always_make_flag = always_make_set && (restarts == 0);
long_options[i].name = 0;
}
+
+/* Non-option argument. It might be a variable definition. */
static void
handle_non_switch_argument (char *arg, int env)
{
- /* Non-option argument. It might be a variable definition. */
struct variable *v;
+
if (arg[0] == '-' && arg[1] == '\0')
/* Ignore plain '-' for compatibility. */
return;
+
v = try_variable_definition (0, arg, o_command, 0);
if (v != 0)
{
while (optind < argc)
handle_non_switch_argument (argv[optind++], env);
-
if (!env && (bad || print_usage_flag))
{
print_usage (bad);
die (bad ? 2 : 0);
}
+
+ /* If there are any options that need to be decoded do it now. */
+ decode_debug_flags ();
+ decode_output_sync_flags ();
}
/* Decode switches from environment variable ENVAR (which is LEN chars long).
if (new->arg == 0) \
++flagslen; /* Just a single flag letter. */ \
else \
- /* " -x foo", plus space to expand "foo". */ \
- flagslen += 1 + 1 + 1 + 1 + (3 * (LEN)); \
+ /* " -xfoo", plus space to expand "foo". */ \
+ flagslen += 1 + 1 + 1 + (3 * (LEN)); \
if (!short_option (cs->c)) \
/* This switch has no single-letter version, so we use the long. */ \
flagslen += 2 + strlen (cs->long_name); \
is considered the arg for the first. */
if (flags->arg[0] != '\0')
{
- /* Add its argument too. */
- *p++ = !short_option (flags->cs->c) ? '=' : ' ';
+ /* Add its argument too. Long options require '='. */
+ if (!short_option (flags->cs->c))
+ *p++ = '=';
p = quote_for_env (p, flags->arg);
}
++words;