Hi,

this diff turns debug output of make to stderr.  This is the first step
to unbreak a make -d A run under ports.  I tested this diff with a full
kernel and userland build under amd64 architecture.

Bye,
Jan

Index: arch.c
===================================================================
RCS file: /cvs/src/usr.bin/make/arch.c,v
retrieving revision 1.83
diff -u -p -r1.83 arch.c
--- arch.c      12 May 2014 19:11:19 -0000      1.83
+++ arch.c      31 Oct 2014 13:23:41 -0000
@@ -485,7 +485,7 @@ read_archive(const char *archive, const 
                                if (fseek(arch, -elen, SEEK_CUR) != 0)
                                        break;
                                if (DEBUG(ARCH) || DEBUG(MAKE))
-                                       printf("ArchStat: Extended format entry 
for %s\n",
+                                       fprintf(stderr, "ArchStat: Extended 
format entry for %s\n",
                                            memberName);
                        }
 #endif
@@ -630,7 +630,7 @@ ArchSVR4Entry(struct SVR4namelist *l, co
 
                if (l->fnametab != NULL) {
                        if (DEBUG(ARCH))
-                               printf("Attempted to redefine an SVR4 name 
table\n");
+                               fprintf(stderr, "Attempted to redefine an SVR4 
name table\n");
                        return NULL;
                }
 
@@ -639,7 +639,7 @@ ArchSVR4Entry(struct SVR4namelist *l, co
 
                if (fread(l->fnametab, size, 1, arch) != 1) {
                        if (DEBUG(ARCH))
-                               printf("Reading an SVR4 name table failed\n");
+                               fprintf(stderr, "Reading an SVR4 name table 
failed\n");
                        return NULL;
                }
 
@@ -658,7 +658,7 @@ ArchSVR4Entry(struct SVR4namelist *l, co
                                break;
                        }
                if (DEBUG(ARCH))
-                       printf("Found svr4 archive name table with %lu 
entries\n",
+                       fprintf(stderr, "Found svr4 archive name table with %lu 
entries\n",
                            (u_long)entry);
                return (char *)svr4list;
        }
@@ -669,18 +669,18 @@ ArchSVR4Entry(struct SVR4namelist *l, co
        entry = (size_t) strtol(name, &eptr, 0);
        if ((*eptr != ' ' && *eptr != '\0') || eptr == name) {
                if (DEBUG(ARCH))
-                       printf("Could not parse SVR4 name /%s\n", name);
+                       fprintf(stderr, "Could not parse SVR4 name /%s\n", 
name);
                return NULL;
        }
        if (entry >= l->fnamesize) {
                if (DEBUG(ARCH))
-                       printf("SVR4 entry offset /%s is greater than %lu\n",
+                       fprintf(stderr, "SVR4 entry offset /%s is greater than 
%lu\n",
                            name, (u_long)l->fnamesize);
                return NULL;
        }
 
        if (DEBUG(ARCH))
-               printf("Replaced /%s with %s\n", name, l->fnametab + entry);
+               fprintf(stderr, "Replaced /%s with %s\n", name, l->fnametab + 
entry);
 
        return l->fnametab + entry;
 }
@@ -814,7 +814,7 @@ ArchFindMember(
                                break;
                        ename[elength] = '\0';
                        if (DEBUG(ARCH) || DEBUG(MAKE))
-                               printf("ArchFind: Extended format entry for 
%s\n", ename);
+                               fprintf(stderr, "ArchFind: Extended format 
entry for %s\n", ename);
                        /* Found as extended name.      */
                        if (strcmp(ename, member) == 0) {
                                efree(list.fnametab);
Index: compat.c
===================================================================
RCS file: /cvs/src/usr.bin/make/compat.c,v
retrieving revision 1.83
diff -u -p -r1.83 compat.c
--- compat.c    20 Jun 2013 19:48:32 -0000      1.83
+++ compat.c    31 Oct 2014 13:23:41 -0000
@@ -78,7 +78,7 @@ CompatMake(void *gnp, /* The node to mak
        bool cmdsOk;
 
        if (DEBUG(MAKE))
-               printf("CompatMake(%s, %s)\n", pgn ? pgn->name : "NULL",
+               fprintf(stderr, "CompatMake(%s, %s)\n", pgn ? pgn->name : 
"NULL",
                    gn->name);
 
        /* XXX some loops are not loops, people write dependencies
@@ -144,14 +144,14 @@ CompatMake(void *gnp,     /* The node to mak
                 * if we exist and when we were modified last. The criteria
                 * for datedness are defined by the Make_OODate function.  */
                if (DEBUG(MAKE))
-                       printf("Examining %s...", gn->name);
+                       fprintf(stderr, "Examining %s...", gn->name);
                if (!Make_OODate(gn)) {
                        gn->built_status = UPTODATE;
                        if (DEBUG(MAKE))
-                               printf("up-to-date.\n");
+                               fprintf(stderr, "up-to-date.\n");
                        return;
                } else if (DEBUG(MAKE))
-                       printf("out-of-date.\n");
+                       fprintf(stderr, "out-of-date.\n");
 
                /* If the user is just seeing if something is out-of-date,
                 * exit now to tell him/her "yes".  */
@@ -228,7 +228,7 @@ CompatMake(void *gnp,       /* The node to mak
                                        sib->mtime = sib->youngest->mtime;
                        }
                        if (DEBUG(MAKE))
-                               printf("update time: %s\n",
+                               fprintf(stderr, "update time: %s\n",
                                    time_to_string(&gn->mtime));
                        if (!(gn->type & OP_EXEC)) {
                                pgn->childMade = true;
Index: cond.c
===================================================================
RCS file: /cvs/src/usr.bin/make/cond.c,v
retrieving revision 1.50
diff -u -p -r1.50 cond.c
--- cond.c      22 Nov 2013 15:47:35 -0000      1.50
+++ cond.c      31 Oct 2014 13:23:41 -0000
@@ -541,7 +541,7 @@ do_string_compare:
                string = Buf_Retrieve(&buf);
 
                if (DEBUG(COND))
-                       printf("lhs = \"%s\", rhs = \"%s\", op = %.2s\n",
+                       fprintf(stderr, "lhs = \"%s\", rhs = \"%s\", op = 
%.2s\n",
                            lhs, string, op);
                /* Null-terminate rhs and perform the comparison.
                 * t is set to the result.  */
@@ -595,7 +595,7 @@ do_string_compare:
                }
 
                if (DEBUG(COND))
-                       printf("left = %f, right = %f, op = %.2s\n", left,
+                       fprintf(stderr, "left = %f, right = %f, op = %.2s\n", 
left,
                            right, op);
                switch (op[0]) {
                case '!':
Index: dir.c
===================================================================
RCS file: /cvs/src/usr.bin/make/dir.c,v
retrieving revision 1.64
diff -u -p -r1.64 dir.c
--- dir.c       12 May 2014 19:11:19 -0000      1.64
+++ dir.c       31 Oct 2014 13:23:41 -0000
@@ -301,7 +301,7 @@ read_directory(struct PathEntry *p)
        struct dirent *dp;
 
        if (DEBUG(DIR)) {
-               printf("Caching %s...", p->name);
+               fprintf(stderr, "Caching %s...", p->name);
                fflush(stdout);
        }
 
@@ -319,7 +319,7 @@ read_directory(struct PathEntry *p)
        }
        (void)closedir(d);
        if (DEBUG(DIR))
-               printf("done\n");
+               fprintf(stderr, "done\n");
        return true;
 }
 
@@ -442,7 +442,7 @@ Dir_FindFileComplexi(const char *name, c
        hv = ohash_interval(basename, &ename);
 
        if (DEBUG(DIR))
-               printf("Searching for %s...", name);
+               fprintf(stderr, "Searching for %s...", name);
        /* Unless checkCurDirFirst is false, we always look for
         * the file in the current directory before anywhere else
         * and we always return exactly what the caller specified. */
@@ -450,7 +450,7 @@ Dir_FindFileComplexi(const char *name, c
            (!hasSlash || (basename - name == 2 && *name == '.')) &&
            find_file_hashi(dot, basename, ename, hv) != NULL) {
                if (DEBUG(DIR))
-                       printf("in '.'\n");
+                       fprintf(stderr, "in '.'\n");
                return Str_dupi(name, ename);
        }
 
@@ -462,10 +462,10 @@ Dir_FindFileComplexi(const char *name, c
        for (ln = Lst_First(path); ln != NULL; ln = Lst_Adv(ln)) {
                p = (struct PathEntry *)Lst_Datum(ln);
                if (DEBUG(DIR))
-                       printf("%s...", p->name);
+                       fprintf(stderr, "%s...", p->name);
                if (find_file_hashi(p, basename, ename, hv) != NULL) {
                        if (DEBUG(DIR))
-                               printf("here...");
+                               fprintf(stderr, "here...");
                        if (hasSlash) {
                                /* If the name had a slash, its initial
                                 * components and p's final components must
@@ -485,14 +485,14 @@ Dir_FindFileComplexi(const char *name, c
                                if (p2 >= name ||
                                    (p1 >= p->name && *p1 != '/')) {
                                        if (DEBUG(DIR))
-                                               printf("component mismatch -- 
continuing...");
+                                               fprintf(stderr, "component 
mismatch -- continuing...");
                                        continue;
                                }
                        }
                        file = Str_concati(p->name, strchr(p->name, '\0'), 
basename,
                            ename, '/');
                        if (DEBUG(DIR))
-                               printf("returning %s\n", file);
+                               fprintf(stderr, "returning %s\n", file);
                        return file;
                } else if (hasSlash) {
                        /* If the file has a leading path component and that
@@ -504,7 +504,7 @@ Dir_FindFileComplexi(const char *name, c
                                continue;
                        if (*p1 == '\0' && p2 == basename - 1) {
                                if (DEBUG(DIR))
-                                       printf("has to be here but isn't -- 
returning NULL\n");
+                                       fprintf(stderr, "has to be here but 
isn't -- returning NULL\n");
                                return NULL;
                        }
                }
@@ -524,7 +524,7 @@ Dir_FindFileComplexi(const char *name, c
         * resulting name onto the search path. */
        if (!hasSlash) {
                if (DEBUG(DIR))
-                       printf("failed.\n");
+                       fprintf(stderr, "failed.\n");
                return NULL;
        }
 
@@ -532,7 +532,7 @@ Dir_FindFileComplexi(const char *name, c
                bool checkedDot = false;
 
                if (DEBUG(DIR))
-                       printf("failed. Trying subdirectories...");
+                       fprintf(stderr, "failed. Trying subdirectories...");
                for (ln = Lst_First(path); ln != NULL; ln = Lst_Adv(ln)) {
                        p = (struct PathEntry *)Lst_Datum(ln);
                        if (p != dot)
@@ -545,14 +545,14 @@ Dir_FindFileComplexi(const char *name, c
                                checkedDot = true;
                        }
                        if (DEBUG(DIR))
-                               printf("checking %s...", file);
+                               fprintf(stderr, "checking %s...", file);
 
                        if (stat(file, &stb) == 0) {
                                struct timespec mtime;
 
                                ts_set_from_stat(stb, mtime);
                                if (DEBUG(DIR))
-                                       printf("got it.\n");
+                                       fprintf(stderr, "got it.\n");
 
                                /* We've found another directory to search.
                                 * We know there is a slash in 'file'. We
@@ -569,7 +569,7 @@ Dir_FindFileComplexi(const char *name, c
                                /* Save the modification time so if it's
                                * needed, we don't have to fetch it again.  */
                                if (DEBUG(DIR))
-                                       printf("Caching %s for %s\n",
+                                       fprintf(stderr, "Caching %s for %s\n",
                                            time_to_string(&mtime), file);
                                record_stamp(file, mtime);
                                return file;
@@ -578,13 +578,13 @@ Dir_FindFileComplexi(const char *name, c
                }
 
                if (DEBUG(DIR))
-                       printf("failed. ");
+                       fprintf(stderr, "failed. ");
 
                if (checkedDot) {
                        /* Already checked by the given name, since . was in
                         * the path, so no point in proceeding...  */
                        if (DEBUG(DIR))
-                               printf("Checked . already, returning NULL\n");
+                               fprintf(stderr, "Checked . already, returning 
NULL\n");
                        return NULL;
                }
        }
@@ -602,25 +602,25 @@ Dir_FindFileComplexi(const char *name, c
         * b/c we added it here. This is not good...  */
        q = Str_dupi(name, ename);
        if (DEBUG(DIR))
-               printf("Looking for \"%s\"...", q);
+               fprintf(stderr, "Looking for \"%s\"...", q);
 
        entry = find_stampi(name, ename);
        if (entry != NULL) {
                if (DEBUG(DIR))
-                       printf("got it (in mtime cache)\n");
+                       fprintf(stderr, "got it (in mtime cache)\n");
                return q;
        } else if (stat(q, &stb) == 0) {
                struct timespec mtime;
 
                ts_set_from_stat(stb, mtime);
                if (DEBUG(DIR))
-                       printf("Caching %s for %s\n", time_to_string(&mtime), 
+                       fprintf(stderr, "Caching %s for %s\n", 
time_to_string(&mtime), 
                            q);
                record_stamp(q, mtime);
                return q;
        } else {
            if (DEBUG(DIR))
-                   printf("failed. Returning NULL\n");
+                   fprintf(stderr, "failed. Returning NULL\n");
            free(q);
            return NULL;
        }
@@ -686,7 +686,7 @@ Dir_Concat(Lst path1, Lst path2)
 static void
 DirPrintDir(void *p)
 {
-       printf("%s ", ((struct PathEntry *)p)->name);
+       fprintf(stderr, "%s ", ((struct PathEntry *)p)->name);
 }
 
 void
@@ -724,7 +724,7 @@ Dir_MTime(GNode *gn)
                 * see if the file was actually updated, so we need to
                 * actually go to the file system.      */
                if (DEBUG(DIR))
-                       printf("Using cached time %s for %s\n",
+                       fprintf(stderr, "Using cached time %s for %s\n",
                            time_to_string(&entry->mtime), fullName);
                mtime = entry->mtime;
                free(entry);
Index: engine.c
===================================================================
RCS file: /cvs/src/usr.bin/make/engine.c,v
retrieving revision 1.48
diff -u -p -r1.48 engine.c
--- engine.c    30 May 2014 21:19:57 -0000      1.48
+++ engine.c    31 Oct 2014 13:23:42 -0000
@@ -444,10 +444,10 @@ Make_OODate(GNode *gn)
                (void)Dir_MTime(gn);
                if (DEBUG(MAKE)) {
                        if (!is_out_of_date(gn->mtime))
-                               printf("modified %s...",
+                               fprintf(stderr, "modified %s...",
                                    time_to_string(&gn->mtime));
                        else
-                               printf("non-existent...");
+                               fprintf(stderr, "non-existent...");
                }
        }
 
@@ -466,7 +466,7 @@ Make_OODate(GNode *gn)
                 * no matter *what*.
                 */
                if (DEBUG(MAKE))
-                       printf(".USE node...");
+                       fprintf(stderr, ".USE node...");
                oodate = false;
        } else if (gn->type & OP_JOIN) {
                /*
@@ -474,7 +474,7 @@ Make_OODate(GNode *gn)
                 * out-of-date if any of its children was out-of-date.
                 */
                if (DEBUG(MAKE))
-                       printf(".JOIN node...");
+                       fprintf(stderr, ".JOIN node...");
                oodate = gn->childMade;
        } else if (gn->type & (OP_FORCE|OP_EXEC|OP_PHONY)) {
                /*
@@ -483,11 +483,11 @@ Make_OODate(GNode *gn)
                 */
                if (DEBUG(MAKE)) {
                        if (gn->type & OP_FORCE)
-                               printf("! operator...");
+                               fprintf(stderr, "! operator...");
                        else if (gn->type & OP_PHONY)
-                               printf(".PHONY node...");
+                               fprintf(stderr, ".PHONY node...");
                        else
-                               printf(".EXEC node...");
+                               fprintf(stderr, ".EXEC node...");
                }
                oodate = true;
        } else if (is_strictly_before(gn->mtime, gn->youngest->mtime) ||
@@ -501,12 +501,12 @@ Make_OODate(GNode *gn)
                 */
                if (DEBUG(MAKE)) {
                        if (is_strictly_before(gn->mtime, gn->youngest->mtime))
-                               printf("modified before source(%s)...",
+                               fprintf(stderr, "modified before source(%s)...",
                                    gn->youngest->name);
                        else if (is_out_of_date(gn->mtime))
-                               printf("non-existent and no sources...");
+                               fprintf(stderr, "non-existent and no 
sources...");
                        else
-                               printf(":: operator and no sources...");
+                               fprintf(stderr, ":: operator and no 
sources...");
                }
                oodate = true;
        } else {
Index: job.c
===================================================================
RCS file: /cvs/src/usr.bin/make/job.c,v
retrieving revision 1.135
diff -u -p -r1.135 job.c
--- job.c       14 Dec 2012 11:10:03 -0000      1.135
+++ job.c       31 Oct 2014 13:23:42 -0000
@@ -517,9 +517,9 @@ handle_all_signals(void)
 static void
 debug_vprintf(const char *fmt, va_list va)
 {
-       (void)printf("[%ld] ", (long)mypid);
-       (void)vprintf(fmt, va);
-       fflush(stdout);
+       (void)fprintf(stderr, "[%ld] ", (long)mypid);
+       (void)vfprintf(stderr, fmt, va);
+       //fflush(stdout);
 }
 
 void
Index: make.c
===================================================================
RCS file: /cvs/src/usr.bin/make/make.c,v
retrieving revision 1.68
diff -u -p -r1.68 make.c
--- make.c      6 Jan 2014 12:21:45 -0000       1.68
+++ make.c      31 Oct 2014 13:23:42 -0000
@@ -163,7 +163,7 @@ has_unmade_predecessor(GNode *gn)
 
                if (pgn->must_make && pgn->built_status == UNKNOWN) {
                        if (DEBUG(MAKE))
-                               printf("predecessor %s not made yet.\n", 
+                               fprintf(stderr, "predecessor %s not made 
yet.\n", 
                                    pgn->name);
                        return true;
                }
@@ -199,7 +199,7 @@ requeue(GNode *gn)
                        j--;
                        heldBack.a[i]->built_status = UNKNOWN;
                        if (DEBUG(HELDJOBS))
-                               printf("%s finished, releasing: %s\n", 
+                               fprintf(stderr, "%s finished, releasing: %s\n", 
                                    gn->name, heldBack.a[i]->name);
                        Array_Push(&toBeMade, heldBack.a[i]);
                        continue;
@@ -256,7 +256,7 @@ Make_Update(GNode *cgn)     /* the child nod
                if (noExecute || is_out_of_date(Dir_MTime(cgn)))
                        clock_gettime(CLOCK_REALTIME, &cgn->mtime);
                if (DEBUG(MAKE))
-                       printf("update time: %s\n", 
+                       fprintf(stderr, "update time: %s\n", 
                            time_to_string(&cgn->mtime));
        }
 
@@ -268,7 +268,7 @@ Make_Update(GNode *cgn)     /* the child nod
                pgn->unmade--;
                if (pgn->must_make) {
                        if (DEBUG(MAKE))
-                               printf("%s--=%d ", 
+                               fprintf(stderr, "%s--=%d ", 
                                    pgn->name, pgn->unmade);
 
                        if ( ! (cgn->type & (OP_EXEC|OP_USE))) {
@@ -283,7 +283,7 @@ Make_Update(GNode *cgn)     /* the child nod
                                 * MakeStartJobs.
                                 */
                                if (DEBUG(MAKE))
-                                       printf("QUEUING ");
+                                       fprintf(stderr, "QUEUING ");
                                Array_Push(&toBeMade, pgn);
                        } else if (pgn->unmade < 0) {
                                Error("Child %s discovered graph cycles through 
%s", cgn->name, pgn->name);
@@ -291,7 +291,7 @@ Make_Update(GNode *cgn)     /* the child nod
                }
        }
        if (DEBUG(MAKE))
-               printf("\n");
+               fprintf(stderr, "\n");
        requeue_successors(cgn);
 }
 
@@ -299,36 +299,36 @@ static bool
 try_to_make_node(GNode *gn)
 {
        if (DEBUG(MAKE))
-               printf("Examining %s...", gn->name);
+               fprintf(stderr, "Examining %s...", gn->name);
                
        if (gn->built_status == HELDBACK) {
                if (DEBUG(HELDJOBS))
-                       printf("%s already held back ???\n", gn->name);
+                       fprintf(stderr, "%s already held back ???\n", gn->name);
                return false;
        }
 
        if (gn->unmade != 0) {
                if (DEBUG(MAKE))
-                       printf(" Requeuing (%d)\n", gn->unmade);
+                       fprintf(stderr, " Requeuing (%d)\n", gn->unmade);
                add_targets_to_make(&gn->children);
                Array_Push(&toBeMade, gn);
                return false;
        }
        if (has_been_built(gn)) {
                if (DEBUG(MAKE))
-                       printf(" already made\n");
+                       fprintf(stderr, " already made\n");
                        return false;
        }
        if (has_unmade_predecessor(gn)) {
                if (DEBUG(MAKE))
-                       printf(" Dropping for now\n");
+                       fprintf(stderr, " Dropping for now\n");
                return false;
        }
 
        /* SIB: this is where there should be a siblings loop */
        if (gn->unmade != 0) {
                if (DEBUG(MAKE))
-                       printf(" Requeuing (after deps: %d)\n", gn->unmade);
+                       fprintf(stderr, " Requeuing (after deps: %d)\n", 
gn->unmade);
                add_targets_to_make(&gn->children);
                return false;
        }
@@ -340,7 +340,7 @@ try_to_make_node(GNode *gn)
                                gn->watched = gn2;
                                gn->built_status = HELDBACK;
                                if (DEBUG(HELDJOBS))
-                                       printf("Holding back job %s, "
+                                       fprintf(stderr, "Holding back job %s, "
                                            "groupling to %s\n", 
                                            gn->name, gn2->name);
                                Array_Push(&heldBack, gn);
@@ -354,7 +354,7 @@ try_to_make_node(GNode *gn)
                                gn->watched = gn2;
                                gn->built_status = HELDBACK;
                                if (DEBUG(HELDJOBS))
-                                       printf("Holding back job %s, "
+                                       fprintf(stderr, "Holding back job %s, "
                                            "sibling to %s\n", 
                                            gn->name, gn2->name);
                                Array_Push(&heldBack, gn);
@@ -363,7 +363,7 @@ try_to_make_node(GNode *gn)
        }
        if (Make_OODate(gn)) {
                if (DEBUG(MAKE))
-                       printf("out-of-date\n");
+                       fprintf(stderr, "out-of-date\n");
                if (queryFlag)
                        return true;
                /* SIB: this is where commands should get prepared */
@@ -371,7 +371,7 @@ try_to_make_node(GNode *gn)
                Job_Make(gn);
        } else {
                if (DEBUG(MAKE))
-                       printf("up-to-date\n");
+                       fprintf(stderr, "up-to-date\n");
                gn->built_status = UPTODATE;
                if (gn->type & OP_JOIN) {
                        /*
@@ -523,13 +523,13 @@ add_targets_to_make(Lst todo)
 
                if (gn->unmade != 0) {
                        if (DEBUG(MAKE))
-                               printf("%s: not queuing (%d unmade children)\n",
+                               fprintf(stderr, "%s: not queuing (%d unmade 
children)\n",
                                    gn->name, gn->unmade);
                        Lst_ForEach(&gn->children, MakeAddChild,
                            &examine);
                } else {
                        if (DEBUG(MAKE))
-                               printf("%s: queuing\n", gn->name);
+                               fprintf(stderr, "%s: queuing\n", gn->name);
                        Array_Push(&toBeMade, gn);
                }
        }
Index: suff.c
===================================================================
RCS file: /cvs/src/usr.bin/make/suff.c,v
retrieving revision 1.88
diff -u -p -r1.88 suff.c
--- suff.c      12 May 2014 19:11:19 -0000      1.88
+++ suff.c      31 Oct 2014 13:23:42 -0000
@@ -334,17 +334,17 @@ SuffInsert(Lst l, Suff *s)
        }
 
        if (DEBUG(SUFF))
-               printf("inserting %s(%d)...", s->name, s->order);
+               fprintf(stderr, "inserting %s(%d)...", s->name, s->order);
        if (ln == NULL) {
                if (DEBUG(SUFF))
-                       printf("at end of list\n");
+                       fprintf(stderr, "at end of list\n");
                Lst_AtEnd(l, s);
        } else if (s2->order != s->order) {
                if (DEBUG(SUFF))
-                       printf("before %s(%d)\n", s2->name, s2->order);
+                       fprintf(stderr, "before %s(%d)\n", s2->name, s2->order);
                Lst_Insert(l, ln, s);
        } else if (DEBUG(SUFF)) {
-               printf("already there\n");
+               fprintf(stderr, "already there\n");
        }
 }
 
@@ -528,7 +528,7 @@ Suff_ParseAsTransform(const char *line, 
        }
 
        if (DEBUG(SUFF))
-               printf("defining transformation from `%s' to `%s'\n",
+               fprintf(stderr, "defining transformation from `%s' to `%s'\n",
                    s->name, t->name);
        return gn;
 }
@@ -810,7 +810,7 @@ SuffFindThem(
 
        while ((s = (Src *)Lst_DeQueue(srcs)) != NULL) {
                if (DEBUG(SUFF))
-                       printf("\ttrying %s...", s->file);
+                       fprintf(stderr, "\ttrying %s...", s->file);
 
                /*
                 * A file is considered to exist if either a node exists in the
@@ -835,14 +835,14 @@ SuffFindThem(
                }
 
                if (DEBUG(SUFF))
-                   printf("not there\n");
+                   fprintf(stderr, "not there\n");
 
                SuffAddLevel(srcs, s);
                Lst_AtEnd(slst, s);
        }
 
        if (DEBUG(SUFF) && rs)
-           printf("got it\n");
+           fprintf(stderr, "got it\n");
        return rs;
 }
 
@@ -912,7 +912,7 @@ SuffFindCmds(Src *targ, Lst slst)
 #endif
                Lst_AtEnd(slst, ret);
                if (DEBUG(SUFF))
-                       printf("\tusing existing source %s\n", s->name);
+                       fprintf(stderr, "\tusing existing source %s\n", 
s->name);
                return ret;
        }
        return NULL;
@@ -940,7 +940,7 @@ SuffExpandVarChildren(LstNode after, GNo
 
 
        if (DEBUG(SUFF))
-               printf("Expanding \"%s\"...", cgn->name);
+               fprintf(stderr, "Expanding \"%s\"...", cgn->name);
 
        cp = Var_Subst(cgn->name, &pgn->context, true);
        if (cp == NULL) {
@@ -1003,7 +1003,7 @@ SuffExpandVarChildren(LstNode after, GNo
        /* Add all elements of the members list to the parent node.  */
        while ((gn = (GNode *)Lst_DeQueue(&members)) != NULL) {
                if (DEBUG(SUFF))
-                       printf("%s...", gn->name);
+                       fprintf(stderr, "%s...", gn->name);
                if (Lst_Member(&pgn->children, gn) == NULL) {
                        Lst_Append(&pgn->children, after, gn);
                        after = Lst_Adv(after);
@@ -1013,7 +1013,7 @@ SuffExpandVarChildren(LstNode after, GNo
        /* Free the result.  */
        free(cp);
        if (DEBUG(SUFF))
-               printf("\n");
+               fprintf(stderr, "\n");
 }
 
 static void
@@ -1026,7 +1026,7 @@ SuffExpandWildChildren(LstNode after, GN
        Lst path;       /* Search path along which to expand */
 
        if (DEBUG(SUFF))
-               printf("Wildcard expanding \"%s\"...", cgn->name);
+               fprintf(stderr, "Wildcard expanding \"%s\"...", cgn->name);
 
        /* Find a path along which to expand the word.
         *
@@ -1038,7 +1038,7 @@ SuffExpandWildChildren(LstNode after, GN
 
        if (s != NULL) {
                if (DEBUG(SUFF))
-                       printf("suffix is \"%s\"...", s->name);
+                       fprintf(stderr, "suffix is \"%s\"...", s->name);
                path = &s->searchPath;
        } else
                /* Use default search path.  */
@@ -1052,7 +1052,7 @@ SuffExpandWildChildren(LstNode after, GN
        while ((cp = (char *)Lst_DeQueue(&exp)) != NULL) {
                GNode *gn;              /* New source 8) */
                if (DEBUG(SUFF))
-                       printf("%s...", cp);
+                       fprintf(stderr, "%s...", cp);
                gn = Targ_FindNode(cp, TARG_CREATE);
 
                /* If gn isn't already a child of the parent, make it so and
@@ -1065,7 +1065,7 @@ SuffExpandWildChildren(LstNode after, GN
        }
 
        if (DEBUG(SUFF))
-               printf("\n");
+               fprintf(stderr, "\n");
 }
 
 /*-
@@ -1178,7 +1178,7 @@ SuffApplyTransform(
                return false;
 
        if (DEBUG(SUFF))
-               printf("\tapplying %s -> %s to \"%s\"\n", s->name, t->name,
+               fprintf(stderr, "\tapplying %s -> %s to \"%s\"\n", s->name, 
t->name,
                    tGn->name);
 
        /* Record last child for expansion purposes.  */
@@ -1264,7 +1264,7 @@ SuffFindArchiveDeps(
                /* Didn't know what it was -- use .NULL suffix if not in make
                 * mode.  */
                if (DEBUG(SUFF))
-                       printf("using empty suffix\n");
+                       fprintf(stderr, "using empty suffix\n");
                ms = emptySuff;
        }
 
@@ -1289,7 +1289,7 @@ SuffFindArchiveDeps(
                        /* Got one -- apply it.  */
                        if (!SuffApplyTransform(gn, mem, suff, ms) &&
                            DEBUG(SUFF))
-                               printf("\tNo transformation from %s -> %s\n",
+                               fprintf(stderr, "\tNo transformation from %s -> 
%s\n",
                                   ms->name, suff->name);
                }
        }
@@ -1412,7 +1412,7 @@ SuffFindNormalDeps(
        /* Handle target of unknown suffix...  */
        if (Lst_IsEmpty(&srcs)) {
                if (DEBUG(SUFF))
-                       printf("\tNo known suffix on %s. Using empty suffix\n",
+                       fprintf(stderr, "\tNo known suffix on %s. Using empty 
suffix\n",
                            gn->name);
 
                targ = emalloc(sizeof(Src));
@@ -1432,11 +1432,11 @@ SuffFindNormalDeps(
                        SuffAddLevel(&srcs, targ);
                else {
                        if (DEBUG(SUFF))
-                               printf("not ");
+                               fprintf(stderr, "not ");
                }
 
                if (DEBUG(SUFF))
-                       printf("adding suffix rules\n");
+                       fprintf(stderr, "adding suffix rules\n");
 
                Lst_AtEnd(&targs, targ);
        }
@@ -1474,7 +1474,7 @@ SuffFindNormalDeps(
 
        if (targ == NULL) {
                if (DEBUG(SUFF))
-                       printf("\tNo valid suffix on %s\n", gn->name);
+                       fprintf(stderr, "\tNo valid suffix on %s\n", gn->name);
 
 sfnd_abort:
                /* Deal with finding the thing on the default search path if the
@@ -1666,7 +1666,7 @@ SuffFindDeps(GNode *gn, Lst slst)
        }
 
        if (DEBUG(SUFF))
-               printf("SuffFindDeps (%s)\n", gn->name);
+               fprintf(stderr, "SuffFindDeps (%s)\n", gn->name);
 
        current_node = gn;
        if (gn->type & OP_ARCHV)
Index: targ.c
===================================================================
RCS file: /cvs/src/usr.bin/make/targ.c,v
retrieving revision 1.75
diff -u -p -r1.75 targ.c
--- targ.c      12 May 2014 19:11:19 -0000      1.75
+++ targ.c      31 Oct 2014 13:23:42 -0000
@@ -266,7 +266,7 @@ Targ_PrintType(int type)
        int    tbit;
 
 #define PRINTBIT(attr) case CONCAT(OP_,attr): printf("." #attr " "); break
-#define PRINTDBIT(attr) case CONCAT(OP_,attr): if (DEBUG(TARG)) printf("." 
#attr " "); break
+#define PRINTDBIT(attr) case CONCAT(OP_,attr): if (DEBUG(TARG)) 
fprintf(stderr, "." #attr " "); break
 
        type &= ~OP_OPMASK;
 
@@ -288,7 +288,7 @@ Targ_PrintType(int type)
                /*XXX: MEMBER is defined, so CONCAT(OP_,MEMBER) gives OP_"%" */
                case OP_MEMBER:
                        if (DEBUG(TARG))
-                               printf(".MEMBER ");
+                               fprintf(stderr, ".MEMBER ");
                        break;
                PRINTDBIT(ARCHV);
                }
Index: var.c
===================================================================
RCS file: /cvs/src/usr.bin/make/var.c,v
retrieving revision 1.98
diff -u -p -r1.98 var.c
--- var.c       12 May 2014 19:11:19 -0000      1.98
+++ var.c       31 Oct 2014 13:23:42 -0000
@@ -642,14 +642,14 @@ var_set_append(const char *name, const c
                        esetenv(v->name, val);
                }
                if (DEBUG(VAR))
-                       printf("command:%s = %s\n", v->name, var_get_value(v));
+                       fprintf(stderr, "command:%s = %s\n", v->name, 
var_get_value(v));
        } else if ((v->flags & VAR_FROM_CMD) == 0 &&
             (!checkEnvFirst || (v->flags & VAR_FROM_ENV) == 0)) {
                (append ? var_append_value : var_set_value)(v, val);
                if (DEBUG(VAR))
-                       printf("global:%s = %s\n", v->name, var_get_value(v));
+                       fprintf(stderr, "global:%s = %s\n", v->name, 
var_get_value(v));
        } else if (DEBUG(VAR))
-               printf("overridden:%s = %s\n", v->name, var_get_value(v));
+               fprintf(stderr, "overridden:%s = %s\n", v->name, 
var_get_value(v));
 }
 
 void

Reply via email to