int check_symlink_flag = 0;
-/* Nonzero means print directory before starting and when done (-w). */
-
-int print_directory;
static int print_directory_flag = -1;
static const int default_print_directory_flag = -1;
define_variable_cname (GNUMAKEFLAGS_NAME, "", o_env, 0);
}
+ /* Set MAKEFLAGS's origin to command line: in submakes MAKEFLAGS will carry
+ command line switches. This causes env variable MAKEFLAGS to beat
+ makefile modifications to MAKEFLAGS. */
decode_env_switches (STRING_SIZE_TUPLE (MAKEFLAGS_NAME), o_command);
#if 0
/* Set always_make_flag if -B was given and we've not restarted already. */
always_make_flag = always_make_set && (restarts == 0);
- /* If the user didn't specify any print-directory options, compute the
- default setting: disable under -s / print in sub-makes and under -C. */
-
- if (print_directory_flag == -1)
- print_directory = !silent_flag && (directories != 0 || makelevel > 0);
- else
- print_directory = print_directory_flag;
-
/* If -R was given, set -r too (doesn't make sense otherwise!) */
if (no_builtin_variables_flag)
no_builtin_rules_flag = 1;
}
/* Decode switches from ARGC and ARGV.
- They came from the environment if ENV is nonzero. */
+ They came from the environment if ORIGIN is o_env. */
static void
decode_switches (int argc, const char **argv, enum variable_origin origin)
return v;
}
+
+/* Return 1 if the working directory change message should be printed.
+ Otherwise, return 0. */
+int
+should_print_dir (void)
+{
+ if (print_directory_flag >= 0)
+ return print_directory_flag;
+
+ /* If the user didn't specify any print-directory options, compute the
+ default setting: disable under -s / print in sub-makes and under -C. */
+ return !silent_flag && (makelevel > 0 || directories != NULL);
+}
\f
/* Print version information. */
enum variable_origin origin);
struct variable;
struct variable *define_makeflags (int makefile);
+int should_print_dir (void);
void temp_stdin_unlink (void);
void die (int) NORETURN;
void pfatal_with_name (const char *) NORETURN;
extern int just_print_flag, run_silent, ignore_errors_flag, keep_going_flag;
extern int print_data_base_flag, question_flag, touch_flag, always_make_flag;
extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;
-extern int print_version_flag, print_directory, check_symlink_flag;
+extern int print_version_flag, check_symlink_flag;
extern int warn_undefined_variables_flag, posix_pedantic;
extern int not_parallel, second_expansion, clock_skew_detected;
extern int rebuilding_makefiles, one_shell, output_sync, verify_flag;
}
/* Log the working directory for this dump. */
- if (print_directory && output_sync != OUTPUT_SYNC_RECURSE)
+
+ if (output_sync != OUTPUT_SYNC_RECURSE && should_print_dir ())
traced = log_working_directory (1);
if (outfd_not_empty)
/* If we're not syncing this output per-line or per-target, make sure we emit
the "Entering..." message where appropriate. */
if (output_sync == OUTPUT_SYNC_NONE || output_sync == OUTPUT_SYNC_RECURSE)
- if (! stdio_traced && print_directory)
+ if (! stdio_traced && should_print_dir ())
stdio_traced = log_working_directory (1);
}