/* Print debugging info (--debug). */
+static struct stringlist *db_flags;
+
int db_level = 0;
-int noarg_db_level = 1;
-int default_db_level = 0;
#ifdef WINDOWS32
/* Suspend make in main for a short time to allow debugger to attach */
{ 'C', string, (char *) &directories, 0, 0, 0, 0, 0,
"directory", _("DIRECTORY"),
_("Change to DIRECTORY before doing anything") },
- { 'd', positive_int, (char *) &db_level, 1, 1, 0,
- (char *) &noarg_db_level, (char *) &default_db_level,
- "debug", "L",
+ { 'd', string, (char *) &db_flags, 1, 1, 0,
+ "basic", 0,
+ "debug", _("FLAGS"),
_("Print different types of debugging information") },
#ifdef WINDOWS32
{ 'D', flag, (char *) &suspend_flag, 1, 1, 0, 0, 0,
debug_signal_handler (sig)
int sig;
{
- db_level = DB_NONE;
+ db_level = db_level ? DB_NONE : DB_BASIC;
+}
+
+static void
+decode_debug_flags ()
+{
+ char **pp;
+
+ if (!db_flags)
+ return;
+
+ for (pp=db_flags->list; *pp; ++pp)
+ {
+ const char *p = *pp;
+
+ while (1)
+ {
+ switch (tolower (p[0]))
+ {
+ case 'a':
+ db_level |= DB_ALL;
+ break;
+ case 'b':
+ db_level |= DB_BASIC;
+ break;
+ case 'i':
+ db_level |= DB_IMPLICIT;
+ break;
+ case 'j':
+ db_level |= DB_JOBS;
+ break;
+ case 'm':
+ db_level |= DB_MAKEFILES;
+ break;
+ case 'v':
+ db_level |= DB_BASIC | DB_VERBOSE;
+ break;
+ default:
+ fatal (NILF, _("unknown debug level specification `%s'"), p);
+ }
+
+ while (*(++p) != '\0')
+ if (*p == ',' || *p == ' ')
+ break;
+
+ if (*p == '\0')
+ break;
+
+ ++p;
+ }
+ }
}
#ifdef WINDOWS32
* HANDLE runtime exceptions by avoiding a requestor on the GUI. Capture
* exception and print it to stderr instead.
*
- * If ! DB_EXTRA, just print a simple message and exit.
- * If DB_EXTRA, print a more verbose message.
+ * If ! DB_VERBOSE, just print a simple message and exit.
+ * If DB_VERBOSE, print a more verbose message.
* If compiled for DEBUG, let exception pass through to GUI so that
* debuggers can attach.
*/
LPTSTR lpszStrings[1];
#endif
- if (! ISDB (DB_EXTRA))
+ if (! ISDB (DB_VERBOSE))
{
sprintf(errmsg, _("%s: Interrupt/Exception caught "), prg);
sprintf(&errmsg[strlen(errmsg)],
/* search token path was found */
sprintf(sh_path, "%s", search_token);
default_shell = xstrdup(w32ify(sh_path,0));
- DB (DB_EXTRA,
+ DB (DB_VERBOSE,
(_("find_and_set_shell setting default_shell = %s\n"), default_shell));
sh_found = 1;
} else {
}
if (sh_found)
- DB (DB_EXTRA,
+ DB (DB_VERBOSE,
(_("find_and_set_shell path search set default_shell = %s\n"),
default_shell));
}
}
#endif
- /* If we have the "extra" level, force the basic level too. */
-
- if (ISDB (DB_EXTRA))
- db_level |= DB_BASIC;
+ decode_debug_flags ();
/* Print version information. */
stupidly; but if you work for Athena, that's how
you write your makefiles.) */
- DB (DB_EXTRA,
+ DB (DB_VERBOSE,
(_("Makefile `%s' might loop; not remaking it.\n"),
f->name));
case positive_int:
if (optarg == 0 && argc > optind
- && ISDIGIT (argv[optind][0]))
+ && ISDIGIT (argv[optind][0]))
optarg = argv[optind++];
if (!doit)
change is possible below here until then. */
if (f->considered == considered)
{
- DBF (DB_EXTRA, _("Pruning file `%s'.\n"));
+ DBF (DB_VERBOSE, _("Pruning file `%s'.\n"));
continue;
}
f->considered = considered;
register struct dep *d, *lastd;
int running = 0;
- DBF (DB_EXTRA, _("Considering target file `%s'.\n"));
+ DBF (DB_VERBOSE, _("Considering target file `%s'.\n"));
if (file->updated)
{
if (file->update_status > 0)
{
- DBF (DB_EXTRA,
+ DBF (DB_VERBOSE,
_("Recently tried and failed to update file `%s'.\n"));
no_rule_error(file);
return file->update_status;
}
- DBF (DB_EXTRA, _("File `%s' was considered already.\n"));
+ DBF (DB_VERBOSE, _("File `%s' was considered already.\n"));
return 0;
}
case cs_deps_running:
break;
case cs_running:
- DBF (DB_EXTRA, _("Still updating file `%s'.\n"));
+ DBF (DB_VERBOSE, _("Still updating file `%s'.\n"));
return 0;
case cs_finished:
- DBF (DB_EXTRA, _("Finished updating file `%s'.\n"));
+ DBF (DB_VERBOSE, _("Finished updating file `%s'.\n"));
return file->update_status;
default:
abort ();
file->updating = 0;
- DBF (DB_EXTRA, _("Finished prerequisites of target file `%s'.\n"));
+ DBF (DB_VERBOSE, _("Finished prerequisites of target file `%s'.\n"));
if (running)
{
set_command_state (file, cs_deps_running);
--depth;
- DBF (DB_EXTRA, _("The prerequisites of `%s' are being made.\n"));
+ DBF (DB_VERBOSE, _("The prerequisites of `%s' are being made.\n"));
return 0;
}
depth--;
- DBF (DB_EXTRA, _("Giving up on target file `%s'.\n"));
+ DBF (DB_VERBOSE, _("Giving up on target file `%s'.\n"));
if (depth == 0 && keep_going_flag
&& !just_print_flag && !question_flag)
or its dependent, FILE, is older or does not exist. */
d->changed |= noexist || d_mtime > this_mtime;
- if (!noexist && ISDB (DB_BASIC|DB_EXTRA))
+ if (!noexist && ISDB (DB_BASIC|DB_VERBOSE))
{
const char *fmt = 0;
if (ISDB (DB_BASIC))
fmt = _("Prerequisite `%s' is newer than target `%s'.\n");
}
- else if (ISDB (DB_EXTRA))
+ else if (ISDB (DB_VERBOSE))
fmt = _("Prerequisite `%s' is older than target `%s'.\n");
if (fmt)
else if (!noexist && file->is_target && !deps_changed && file->cmds == 0)
{
must_make = 0;
- DBF (DB_EXTRA,
+ DBF (DB_VERBOSE,
_("No commands for `%s' and no prerequisites actually changed.\n"));
}
if (!must_make)
{
- if (ISDB (DB_EXTRA))
+ if (ISDB (DB_VERBOSE))
{
print_spaces (depth);
printf (_("No need to remake target `%s'"), file->name);
if (file->command_state != cs_finished)
{
- DBF (DB_EXTRA, _("Commands of `%s' are being run.\n"));
+ DBF (DB_VERBOSE, _("Commands of `%s' are being run.\n"));
return 0;
}