diff --git a/ChangeLog b/ChangeLog index 956009b0..b79d6f3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +1999-11-21 Paul D. Smith + + Rework GNU make debugging to provide different levels of output. + + * NEWS: mention it. + * debug.h: New file. Define various debugging levels and macros. + * function.c, implicit.c, job.c, main.c, misc.c, read.c, remake.c + * remote-cstms.c, vmsfunctions.c: Replace all code depending on + debug_flag with invocations of debugging macros. + * make.h: Remove debug_flag and DEBUGPR, add db_level. + 1999-11-17 Paul D. Smith * function.c (func_if): Find the end of the arg list by testing diff --git a/NEWS b/NEWS index b0dfe48e..ec497702 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ GNU make NEWS -*-indented-text-*- History of user-visible changes. - 10 Nov 1999 + 21 Nov 1999 Copyright (C) 1992,93,94,95,96,97,98,1999 Free Software Foundation, Inc. See the end for copying conditions. @@ -31,6 +31,12 @@ Version 3.79 * A new psuedo-target, .NOTPARALLEL, is defined. If set the current makefile is always run serially regardless of the value of -j. Any submakes will still be run in parallel if -j was specified. + +* The -d (--debug) option has changed: it now takes an optional numeric + argument. By default only a minimal set of debugging output is + generated, displaying information about what "normal" files (not + makefiles) were deemed out of date and in need of being rebuilt. + Various values control the amount of detail in the debugging output. Version 3.78 diff --git a/function.c b/function.c index 237214e3..5ce56b5d 100644 --- a/function.c +++ b/function.c @@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */ #include "dep.h" #include "job.h" #include "commands.h" +#include "debug.h" #ifdef _AMIGA #include "amiga.h" @@ -1454,8 +1455,8 @@ func_shell (o, argv, funcname) reap_children (1, 0); if (batch_filename) { - if (debug_flag) - printf(_("Cleaning up temporary batch file %s\n"), batch_filename); + DB (DB_EXTRA, (_("Cleaning up temporary batch file %s\n"), + batch_filename)); remove(batch_filename); free(batch_filename); } diff --git a/implicit.c b/implicit.c index c60cbe31..88bce9e4 100644 --- a/implicit.c +++ b/implicit.c @@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */ #include "rule.h" #include "dep.h" #include "filedef.h" +#include "debug.h" static int pattern_search PARAMS ((struct file *file, int archive, unsigned int depth, unsigned int recursions)); @@ -36,7 +37,7 @@ try_implicit_rule (file, depth) struct file *file; unsigned int depth; { - DEBUGPR (_("Looking for an implicit rule for `%s'.\n")); + DBF (DB_IMPLICIT, _("Looking for an implicit rule for `%s'.\n")); /* The order of these searches was previously reversed. My logic now is that since the non-archive search uses more information in the target @@ -51,7 +52,8 @@ try_implicit_rule (file, depth) archive member name to search for implicit rules. */ if (ar_name (file->name)) { - DEBUGPR (_("Looking for archive-member implicit rule for `%s'.\n")); + DBF (DB_IMPLICIT, + _("Looking for archive-member implicit rule for `%s'.\n")); if (pattern_search (file, 1, depth, 0)) return 1; } @@ -60,11 +62,6 @@ try_implicit_rule (file, depth) return 0; } -#define DEBUGP2(msg, a1, a2) \ - do { \ - if (debug_flag) \ - { print_spaces (depth); printf (msg, a1, a2); fflush (stdout); } \ - } while (0) /* Search the pattern rules for a rule with an existing dependency to make FILE. If a rule is found, the appropriate commands and deps are put in FILE @@ -199,7 +196,7 @@ pattern_search (file, archive, depth, recursions) don't use it here. */ if (rule->in_use) { - DEBUGP2 (_("Avoiding implicit rule recursion.%s%s\n"), "", ""); + DBS (DB_IMPLICIT, (_("Avoiding implicit rule recursion.\n"))); continue; } @@ -335,8 +332,8 @@ pattern_search (file, archive, depth, recursions) stemlen -= (lastslash - filename) + 1; } - DEBUGP2 (_("Trying pattern rule with stem `%.*s'.\n"), - (int) stemlen, stem); + DBS (DB_IMPLICIT, (_("Trying pattern rule with stem `%.*s'.\n"), + (int) stemlen, stem)); /* Try each dependency; see if it "exists". */ @@ -376,16 +373,21 @@ pattern_search (file, archive, depth, recursions) "impossible", then the rule fails and don't bother trying it on the second pass either since we know that will fail too. */ - DEBUGP2 (_("Rejecting impossible %s prerequisite `%s'.\n"), - p == depname ? _("implicit") : _("rule"), p); + DBS (DB_IMPLICIT, + (p == depname + ? _("Rejecting impossible implicit prerequisite `%s'.\n") + : _("Rejecting impossible rule prerequisite `%s'.\n"), + p)); tryrules[i] = 0; break; } intermediate_files[deps_found] = 0; - DEBUGP2 (_("Trying %s prerequisite `%s'.\n"), - p == depname ? _("implicit") : _("rule"), p); + DBS (DB_IMPLICIT, + (p == depname + ? _("Trying implicit prerequisite `%s'.\n") + : _("Trying rule prerequisite `%s'.\n"), p)); /* The DEP->changed flag says that this dependency resides in a nonexistent directory. So we normally can skip looking for @@ -408,8 +410,8 @@ pattern_search (file, archive, depth, recursions) vp = p; if (vpath_search (&vp, (FILE_TIMESTAMP *) 0)) { - DEBUGP2 (_("Found prerequisite `%s' as VPATH `%s'\n"), - p, vp); + DBS (DB_IMPLICIT, + (_("Found prerequisite `%s' as VPATH `%s'\n"), p, vp)); strcpy (vp, p); found_files[deps_found++] = vp; continue; @@ -425,8 +427,9 @@ pattern_search (file, archive, depth, recursions) intermediate_file = (struct file *) alloca (sizeof (struct file)); - DEBUGP2 (_("Looking for a rule with %s file `%s'.\n"), - _("intermediate"), p); + DBS (DB_IMPLICIT, + (_("Looking for a rule with intermediate file `%s'.\n"), + p)); bzero ((char *) intermediate_file, sizeof (struct file)); intermediate_file->name = p; diff --git a/job.c b/job.c index ba79b306..e79b6a70 100644 --- a/job.c +++ b/job.c @@ -17,12 +17,17 @@ along with GNU Make; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include + #include "make.h" #include "job.h" +#include "debug.h" #include "filedef.h" #include "commands.h" #include "variable.h" -#include +#include "debug.h" + +#include /* Default shell to use. */ #ifdef WINDOWS32 @@ -210,8 +215,6 @@ static struct child *waiting_jobs = 0; int unixy_shell = 1; -/* #define debug_flag 1 */ - #ifdef WINDOWS32 /* @@ -296,8 +299,7 @@ child_handler (sig) job_rfd = -1; } - if (debug_flag) - printf (_("Got a SIGCHLD; %u unreaped children.\n"), dead_children); + DB (DB_JOBS, (_("Got a SIGCHLD; %u unreaped children.\n"), dead_children)); } @@ -375,10 +377,9 @@ reap_children (block, err) { any_remote |= c->remote; any_local |= ! c->remote; - if (debug_flag) - printf (_("Live child 0x%08lx (%s) PID %ld %s\n"), - (unsigned long int) c, c->file->name, - (long) c->pid, c->remote ? _(" (remote)") : ""); + DB (DB_JOBS, (_("Live child 0x%08lx (%s) PID %ld %s\n"), + (unsigned long int) c, c->file->name, + (long) c->pid, c->remote ? _(" (remote)") : "")); #ifdef VMS break; #endif @@ -534,15 +535,15 @@ reap_children (block, err) Ignore it; it was inherited from our invoker. */ continue; - if (debug_flag) - printf (_("Reaping %s child 0x%08lx PID %ld %s\n"), - child_failed ? _("losing") : _("winning"), - (unsigned long int) c, (long) c->pid, - c->remote ? _(" (remote)") : ""); + DB (DB_JOBS, (child_failed + ? _("Reaping losing child 0x%08lx PID %ld %s\n") + : _("Reaping winning child 0x%08lx PID %ld %s\n"), + (unsigned long int) c, (long) c->pid, + c->remote ? _(" (remote)") : "")); if (c->sh_batch_file) { - if (debug_flag) - printf (_("Cleaning up temp batch file %s\n"), c->sh_batch_file); + DB (DB_JOBS, (_("Cleaning up temp batch file %s\n"), + c->sh_batch_file)); /* just try and remove, don't care if this fails */ remove (c->sh_batch_file); @@ -634,10 +635,9 @@ reap_children (block, err) update_status to its also_make files. */ notice_finished_file (c->file); - if (debug_flag) - printf (_("Removing child 0x%08lx PID %ld %s from chain.\n"), - (unsigned long int) c, (long) c->pid, - c->remote ? _(" (remote)") : ""); + DB (DB_JOBS, (_("Removing child 0x%08lx PID %ld %s from chain.\n"), + (unsigned long int) c, (long) c->pid, + c->remote ? _(" (remote)") : "")); /* Block fatal signals while frobnicating the list, so that children and job_slots_used are always consistent. Otherwise @@ -694,9 +694,8 @@ free_child (child) if (!EINTR_SET) pfatal_with_name (_("write jobserver")); - if (debug_flag) - printf (_("Released token for child 0x%08lx (%s).\n"), - (unsigned long int) child, child->file->name); + DB (DB_JOBS, (_("Released token for child 0x%08lx (%s).\n"), + (unsigned long int) child, child->file->name)); } if (handling_fatal_signal) /* Don't bother free'ing if about to die. */ @@ -1189,10 +1188,9 @@ start_waiting_job (c) { case cs_running: c->next = children; - if (debug_flag) - printf (_("Putting child 0x%08lx (%s) PID %ld%s on the chain.\n"), - (unsigned long int) c, c->file->name, - (long) c->pid, c->remote ? _(" (remote)") : ""); + DB (DB_JOBS, (_("Putting child 0x%08lx (%s) PID %ld%s on the chain.\n"), + (unsigned long int) c, c->file->name, + (long) c->pid, c->remote ? _(" (remote)") : "")); children = c; /* One more job slot is in use. */ ++job_slots_used; @@ -1389,9 +1387,8 @@ new_job (file) if (read (job_rfd, &token, 1) == 1) { - if (debug_flag) - printf (_("Obtained token for child 0x%08lx (%s).\n"), - (unsigned long int) c, c->file->name); + DB (DB_JOBS, (_("Obtained token for child 0x%08lx (%s).\n"), + (unsigned long int) c, c->file->name)); break; } @@ -1675,8 +1672,7 @@ child_execute_job (argv, child) sprintf (cmd, "$ @%s", comname); - if (debug_flag) - printf (_("Executing %s instead\n"), cmd); + DB (DB_JOBS, (_("Executing %s instead\n"), cmd)); } cmddsc.dsc$w_length = strlen(cmd); @@ -2436,8 +2432,8 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr) strcat(*batch_filename_ptr, ".sh"); } - if (debug_flag) - printf(_("Creating temporary batch file %s\n"), *batch_filename_ptr); + DB (DB_JOBS, (_("Creating temporary batch file %s\n"), + *batch_filename_ptr)); /* create batch file to execute command */ batch = fopen (*batch_filename_ptr, "w"); diff --git a/main.c b/main.c index a1b3d74f..96bab636 100644 --- a/main.c +++ b/main.c @@ -24,7 +24,9 @@ MA 02111-1307, USA. */ #include "job.h" #include "commands.h" #include "rule.h" +#include "debug.h" #include "getopt.h" + #include #ifdef _AMIGA # include @@ -137,9 +139,11 @@ int touch_flag; int just_print_flag; -/* Print debugging trace info (-d). */ +/* Print debugging info (--debug). */ -int debug_flag = 0; +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 */ @@ -256,9 +260,10 @@ static const struct command_switch switches[] = { 'C', string, (char *) &directories, 0, 0, 0, 0, 0, "directory", _("DIRECTORY"), _("Change to DIRECTORY before doing anything") }, - { 'd', flag, (char *) &debug_flag, 1, 1, 0, 0, 0, - "debug", 0, - _("Print lots of debugging information") }, + { 'd', positive_int, (char *) &db_level, 1, 1, 0, + (char *) &noarg_db_level, (char *) &default_db_level, + "debug", "L", + _("Print different types of debugging information") }, #ifdef WINDOWS32 { 'D', flag, (char *) &suspend_flag, 1, 1, 0, 0, 0, "suspend-for-debug", 0, @@ -484,7 +489,7 @@ static RETSIGTYPE debug_signal_handler (sig) int sig; { - debug_flag = ! debug_flag; + db_level = DB_NONE; } #ifdef WINDOWS32 @@ -492,8 +497,8 @@ debug_signal_handler (sig) * HANDLE runtime exceptions by avoiding a requestor on the GUI. Capture * exception and print it to stderr instead. * - * If debug_flag not set, just print a simple message and exit. - * If debug_flag set, print a more verbose message. + * If ! DB_EXTRA, just print a simple message and exit. + * If DB_EXTRA, print a more verbose message. * If compiled for DEBUG, let exception pass through to GUI so that * debuggers can attach. */ @@ -509,7 +514,7 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo ) LPTSTR lpszStrings[1]; #endif - if (!debug_flag) + if (! ISDB (DB_EXTRA)) { sprintf(errmsg, _("%s: Interrupt/Exception caught "), prg); sprintf(&errmsg[strlen(errmsg)], @@ -596,8 +601,8 @@ find_and_set_default_shell(char *token) /* search token path was found */ sprintf(sh_path, "%s", search_token); default_shell = xstrdup(w32ify(sh_path,0)); - if (debug_flag) - printf(_("find_and_set_shell setting default_shell = %s\n"), default_shell); + DB (DB_EXTRA, + (_("find_and_set_shell setting default_shell = %s\n"), default_shell)); sh_found = 1; } else { char *p; @@ -638,8 +643,10 @@ find_and_set_default_shell(char *token) sh_found = 1; } - if (debug_flag && sh_found) - printf(_("find_and_set_shell path search set default_shell = %s\n"), default_shell); + if (sh_found) + DB (DB_EXTRA, + (_("find_and_set_shell path search set default_shell = %s\n"), + default_shell)); } } @@ -942,9 +949,14 @@ int main (int argc, char ** argv) } #endif + /* If we have the "extra" level, force the basic level too. */ + + if (ISDB (DB_EXTRA)) + db_level |= DB_BASIC; + /* Print version information. */ - if (print_version_flag || print_data_base_flag || debug_flag) + if (print_version_flag || print_data_base_flag || db_level) print_version (); /* `make --version' is supposed to just print the version and exit. */ @@ -1473,9 +1485,12 @@ int main (int argc, char ** argv) unsigned int mm_idx = 0; char **nargv = argv; int nargc = argc; + int orig_db_level = db_level; - if (debug_flag) - puts (_("Updating makefiles....")); + if (! ISDB (DB_MAKEFILES)) + db_level = DB_NONE; + + DB (DB_BASIC, (_("Updating makefiles....\n"))); /* Remove any makefiles we don't want to try to update. Also record the current modtimes so we can compare them later. */ @@ -1499,9 +1514,9 @@ int main (int argc, char ** argv) stupidly; but if you work for Athena, that's how you write your makefiles.) */ - if (debug_flag) - printf (_("Makefile `%s' might loop; not remaking it.\n"), - f->name); + DB (DB_EXTRA, + (_("Makefile `%s' might loop; not remaking it.\n"), + f->name)); if (last == 0) read_makefiles = d->next; @@ -1694,13 +1709,13 @@ int main (int argc, char ** argv) } #endif - if (debug_flag) + if (ISDB (DB_BASIC)) { char **p; fputs (_("Re-executing:"), stdout); for (p = nargv; *p != 0; ++p) printf (" %s", *p); - puts (""); + putchar ('\n'); } fflush (stdout); @@ -1718,6 +1733,8 @@ int main (int argc, char ** argv) #endif /* NOTREACHED */ } + + db_level = orig_db_level; } /* Set up `MAKEFLAGS' again for the normal targets. */ @@ -1755,8 +1772,7 @@ int main (int argc, char ** argv) /* Update the goals. */ - if (debug_flag) - puts (_("Updating goal targets....")); + DB (DB_BASIC, (_("Updating goal targets....\n"))); switch (update_goal_chain (goals, 0)) { diff --git a/make.h b/make.h index 7ecfcd27..8f1b0577 100644 --- a/make.h +++ b/make.h @@ -175,11 +175,9 @@ extern unsigned int get_path_max PARAMS ((void)); #endif #ifdef VMS -# include # include # include # include -# include # include #endif @@ -465,7 +463,7 @@ extern const struct floc *reading_file; extern char **environ; extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag; -extern int debug_flag, print_data_base_flag, question_flag, touch_flag; +extern int print_data_base_flag, question_flag, touch_flag; extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag; extern int print_version_flag, print_directory_flag; extern int warn_undefined_variables_flag, posix_pedantic, not_parallel; @@ -500,10 +498,6 @@ extern int handling_fatal_signal; #define MAX(_a,_b) ((_a)>(_b)?(_a):(_b)) #endif -#define DEBUGPR(msg) \ - do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \ - fflush (stdout); } while (0) - #ifdef VMS # ifndef EXIT_FAILURE # define EXIT_FAILURE 3 diff --git a/misc.c b/misc.c index 2447bc5c..6310f283 100644 --- a/misc.c +++ b/misc.c @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. */ #include "make.h" #include "dep.h" - +#include "debug.h" /* Variadic functions. We go through contortions to allow proper function prototypes for both ANSI and pre-ANSI C compilers, and also for those @@ -168,7 +168,7 @@ remove_comments (line) *comment = '\0'; } -/* Print N spaces (used by DEBUGPR for target-depth). */ +/* Print N spaces (used in debug for target-depth). */ void print_spaces (n) @@ -643,7 +643,7 @@ static void log_access (flavor) char *flavor; { - if (! debug_flag) + if (! ISDB (DB_JOBS)) return; /* All the other debugging messages go to stdout, diff --git a/read.c b/read.c index 9d043cea..1072bda0 100644 --- a/read.c +++ b/read.c @@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */ #include "commands.h" #include "variable.h" #include "rule.h" +#include "debug.h" #ifndef WINDOWS32 @@ -149,8 +150,7 @@ read_all_makefiles (makefiles) { unsigned int num_makefiles = 0; - if (debug_flag) - puts (_("Reading makefiles...")); + DB (DB_BASIC, (_("Reading makefiles...\n"))); /* If there's a non-null variable MAKEFILES, its value is a list of files to read first thing. But don't let it prevent reading the @@ -329,7 +329,7 @@ read_makefile (filename, flags) pattern_percent = 0; cmds_started = fileinfo.lineno; - if (debug_flag) + if (ISDB (DB_EXTRA)) { printf (_("Reading makefile `%s'"), fileinfo.filenm); if (flags & RM_NO_DEFAULT_GOAL) diff --git a/remake.c b/remake.c index a3653f38..cd2b09fa 100644 --- a/remake.c +++ b/remake.c @@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */ #include "commands.h" #include "dep.h" #include "variable.h" +#include "debug.h" #include @@ -318,7 +319,7 @@ update_file (file, depth) change is possible below here until then. */ if (f->considered == considered) { - DEBUGPR (_("Pruning file `%s'.\n")); + DBF (DB_EXTRA, _("Pruning file `%s'.\n")); continue; } f->considered = considered; @@ -363,18 +364,19 @@ update_file_1 (file, depth) register struct dep *d, *lastd; int running = 0; - DEBUGPR (_("Considering target file `%s'.\n")); + DBF (DB_EXTRA, _("Considering target file `%s'.\n")); if (file->updated) { if (file->update_status > 0) { - DEBUGPR (_("Recently tried and failed to update file `%s'.\n")); + DBF (DB_EXTRA, + _("Recently tried and failed to update file `%s'.\n")); no_rule_error(file); return file->update_status; } - DEBUGPR (_("File `%s' was considered already.\n")); + DBF (DB_EXTRA, _("File `%s' was considered already.\n")); return 0; } @@ -384,10 +386,10 @@ update_file_1 (file, depth) case cs_deps_running: break; case cs_running: - DEBUGPR (_("Still updating file `%s'.\n")); + DBF (DB_EXTRA, _("Still updating file `%s'.\n")); return 0; case cs_finished: - DEBUGPR (_("Finished updating file `%s'.\n")); + DBF (DB_EXTRA, _("Finished updating file `%s'.\n")); return file->update_status; default: abort (); @@ -408,7 +410,7 @@ update_file_1 (file, depth) check_renamed (file); noexist = this_mtime == (FILE_TIMESTAMP) -1; if (noexist) - DEBUGPR (_("File `%s' does not exist.\n")); + DBF (DB_BASIC, _("File `%s' does not exist.\n")); must_make = noexist; @@ -418,15 +420,15 @@ update_file_1 (file, depth) if (!file->phony && file->cmds == 0 && !file->tried_implicit) { if (try_implicit_rule (file, depth)) - DEBUGPR (_("Found an implicit rule for `%s'.\n")); + DBF (DB_IMPLICIT, _("Found an implicit rule for `%s'.\n")); else - DEBUGPR (_("No implicit rule found for `%s'.\n")); + DBF (DB_IMPLICIT, _("No implicit rule found for `%s'.\n")); file->tried_implicit = 1; } if (file->cmds == 0 && !file->is_target && default_file != 0 && default_file->cmds != 0) { - DEBUGPR (_("Using default commands for `%s'.\n")); + DBF (DB_IMPLICIT, _("Using default commands for `%s'.\n")); file->cmds = default_file->cmds; } @@ -524,13 +526,13 @@ update_file_1 (file, depth) file->updating = 0; - DEBUGPR (_("Finished prerequisites of target file `%s'.\n")); + DBF (DB_EXTRA, _("Finished prerequisites of target file `%s'.\n")); if (running) { set_command_state (file, cs_deps_running); --depth; - DEBUGPR (_("The prerequisites of `%s' are being made.\n")); + DBF (DB_EXTRA, _("The prerequisites of `%s' are being made.\n")); return 0; } @@ -543,7 +545,7 @@ update_file_1 (file, depth) depth--; - DEBUGPR (_("Giving up on target file `%s'.\n")); + DBF (DB_EXTRA, _("Giving up on target file `%s'.\n")); if (depth == 0 && keep_going_flag && !just_print_flag && !question_flag) @@ -589,15 +591,29 @@ update_file_1 (file, depth) or its dependent, FILE, is older or does not exist. */ d->changed |= noexist || d_mtime > this_mtime; - if (debug_flag && !noexist) + if (!noexist && ISDB (DB_BASIC|DB_EXTRA)) { - print_spaces (depth); + const char *fmt = 0; + if (d_mtime == (FILE_TIMESTAMP) -1) - printf (_("Prerequisite `%s' does not exist.\n"), dep_name (d)); - else - printf (_("Prerequisite `%s' is %s than target `%s'.\n"), - dep_name (d), d->changed ? _("newer") : _("older"), file->name); - fflush (stdout); + { + if (ISDB (DB_BASIC)) + fmt = _("Prerequisite `%s' of target `%s' does not exist.\n"); + } + else if (d->changed) + { + if (ISDB (DB_BASIC)) + fmt = _("Prerequisite `%s' is newer than target `%s'.\n"); + } + else if (ISDB (DB_EXTRA)) + fmt = _("Prerequisite `%s' is older than target `%s'.\n"); + + if (fmt) + { + print_spaces (depth); + printf (fmt, dep_name (d), file->name); + fflush (stdout); + } } } @@ -607,24 +623,26 @@ update_file_1 (file, depth) if (file->double_colon && file->deps == 0) { must_make = 1; - DEBUGPR (_("Target `%s' is double-colon and has no prerequisites.\n")); + DBF (DB_BASIC, + _("Target `%s' is double-colon and has no prerequisites.\n")); } else if (!noexist && file->is_target && !deps_changed && file->cmds == 0) { must_make = 0; - DEBUGPR (_("No commands for `%s' and no prerequisites actually changed.\n")); + DBF (DB_EXTRA, + _("No commands for `%s' and no prerequisites actually changed.\n")); } if (!must_make) { - if (debug_flag) + if (ISDB (DB_EXTRA)) { - print_spaces(depth); - printf(_("No need to remake target `%s'"), file->name); - if (!streq(file->name, file->hname)) - printf(_("; using VPATH name `%s'"), file->hname); - printf(".\n"); - fflush(stdout); + print_spaces (depth); + printf (_("No need to remake target `%s'"), file->name); + if (!streq (file->name, file->hname)) + printf (_("; using VPATH name `%s'"), file->hname); + puts ("."); + fflush (stdout); } notice_finished_file (file); @@ -642,18 +660,13 @@ update_file_1 (file, depth) return 0; } - DEBUGPR (_("Must remake target `%s'.\n")); + DBF (DB_BASIC, _("Must remake target `%s'.\n")); /* It needs to be remade. If it's VPATH and not reset via GPATH, toss the VPATH. */ if (!streq(file->name, file->hname)) { - if (debug_flag) - { - print_spaces (depth); - printf(_(" Ignoring VPATH name `%s'.\n"), file->hname); - fflush(stdout); - } + DB (DB_BASIC, (_(" Ignoring VPATH name `%s'.\n"), file->hname)); file->ignore_vpath = 1; } @@ -662,20 +675,20 @@ update_file_1 (file, depth) if (file->command_state != cs_finished) { - DEBUGPR (_("Commands of `%s' are being run.\n")); + DBF (DB_EXTRA, _("Commands of `%s' are being run.\n")); return 0; } switch (file->update_status) { case 2: - DEBUGPR (_("Failed to remake target file `%s'.\n")); + DBF (DB_BASIC, _("Failed to remake target file `%s'.\n")); break; case 0: - DEBUGPR (_("Successfully remade target file `%s'.\n")); + DBF (DB_BASIC, _("Successfully remade target file `%s'.\n")); break; case 1: - DEBUGPR (_("Target file `%s' needs remade under -q.\n")); + DBF (DB_BASIC, _("Target file `%s' needs remade under -q.\n")); break; default: assert (file->update_status >= 0 && file->update_status <= 2); @@ -827,15 +840,15 @@ check_dep (file, depth, this_mtime, must_make_ptr) if (!file->phony && file->cmds == 0 && !file->tried_implicit) { if (try_implicit_rule (file, depth)) - DEBUGPR (_("Found an implicit rule for `%s'.\n")); + DBF (DB_IMPLICIT, _("Found an implicit rule for `%s'.\n")); else - DEBUGPR (_("No implicit rule found for `%s'.\n")); + DBF (DB_IMPLICIT, _("No implicit rule found for `%s'.\n")); file->tried_implicit = 1; } if (file->cmds == 0 && !file->is_target && default_file != 0 && default_file->cmds != 0) { - DEBUGPR (_("Using default commands for `%s'.\n")); + DBF (DB_IMPLICIT, _("Using default commands for `%s'.\n")); file->cmds = default_file->cmds; } diff --git a/remote-cstms.c b/remote-cstms.c index 18d4ed6e..057e50a2 100644 --- a/remote-cstms.c +++ b/remote-cstms.c @@ -26,6 +26,8 @@ Boston, MA 02111-1307, USA. */ #include "filedef.h" #include "commands.h" #include "job.h" +#include "debug.h" + #include #include @@ -81,7 +83,7 @@ start_remote_job_p (first_p) Customs requires a privileged source port be used. */ make_access (); - if (debug_flag) + if (ISDB (DB_EXTRA)) Rpc_Debug(1); /* Ping the daemon once to see if it is there. */ @@ -122,8 +124,8 @@ start_remote_job_p (first_p) status = Customs_Host (EXPORT_SAME, &permit); if (status != RPC_SUCCESS) { - if (debug_flag) - printf ("Customs won't export: %s\n", Rpc_ErrorMessage (status)); + DB (DB_EXTRA, (_("Customs won't export: %s\n"), + Rpc_ErrorMessage (status))); return 0; } diff --git a/vmsfunctions.c b/vmsfunctions.c index 8356165c..4e0cb34c 100644 --- a/vmsfunctions.c +++ b/vmsfunctions.c @@ -2,9 +2,9 @@ #define KDEBUG 0 -#include -#include #include "make.h" +#include "debug.h" + #ifdef __DECC #include #endif @@ -99,13 +99,11 @@ readdir (dfd) dfd->fab$l_nam->nam$l_rsa = resultspec; dfd->fab$l_nam->nam$b_rss = MAXNAMLEN; - if (debug_flag) - printf ("."); + DB (DB_EXTRA, (".")); if (!((i = sys$search (dfd)) & 1)) { - if (debug_flag) - printf ("sys$search failed with %d\n", i); + DB (DB_EXTRA, ("sys$search failed with %d\n", i)); free (dentry); return (NULL); }