Annotation of src/usr.bin/make/targ.c, Revision 1.33
1.31 espie 1: /* $OpenPackages$ */
1.33 ! espie 2: /* $OpenBSD: targ.c,v 1.32 2001/05/23 12:34:50 espie Exp $ */
1.6 millert 3: /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */
1.1 deraadt 4:
5: /*
1.31 espie 6: * Copyright (c) 1999 Marc Espie.
7: *
8: * Extensive code changes for the OpenBSD project.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: *
19: * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
20: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
23: * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30: */
31: /*
1.5 millert 32: * Copyright (c) 1988, 1989, 1990, 1993
33: * The Regents of the University of California. All rights reserved.
1.1 deraadt 34: * Copyright (c) 1989 by Berkeley Softworks
35: * All rights reserved.
36: *
37: * This code is derived from software contributed to Berkeley by
38: * Adam de Boor.
39: *
40: * Redistribution and use in source and binary forms, with or without
41: * modification, are permitted provided that the following conditions
42: * are met:
43: * 1. Redistributions of source code must retain the above copyright
44: * notice, this list of conditions and the following disclaimer.
45: * 2. Redistributions in binary form must reproduce the above copyright
46: * notice, this list of conditions and the following disclaimer in the
47: * documentation and/or other materials provided with the distribution.
48: * 3. All advertising materials mentioning features or use of this software
49: * must display the following acknowledgement:
50: * This product includes software developed by the University of
51: * California, Berkeley and its contributors.
52: * 4. Neither the name of the University nor the names of its contributors
53: * may be used to endorse or promote products derived from this software
54: * without specific prior written permission.
55: *
56: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
57: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
59: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
60: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
62: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
64: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
65: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66: * SUCH DAMAGE.
67: */
68:
69: /*-
70: * targ.c --
1.27 espie 71: * Target nodes are kept into a hash table.
1.1 deraadt 72: *
73: * Interface:
1.31 espie 74: * Targ_Init Initialization procedure.
1.1 deraadt 75: *
1.31 espie 76: * Targ_End Cleanup the module
1.1 deraadt 77: *
1.31 espie 78: * Targ_NewGN Create a new GNode for the passed target
79: * (string). The node is *not* placed in the
80: * hash table, though all its fields are
81: * initialized.
1.1 deraadt 82: *
1.31 espie 83: * Targ_FindNode Find the node for a given target, creating
84: * and storing it if it doesn't exist and the
85: * flags are right (TARG_CREATE)
1.1 deraadt 86: *
1.31 espie 87: * Targ_FindList Given a list of names, find nodes for all
88: * of them, creating nodes if needed.
1.1 deraadt 89: *
1.32 espie 90: * Targ_Ignore Return true if errors should be ignored when
1.31 espie 91: * creating the given target.
1.1 deraadt 92: *
1.32 espie 93: * Targ_Silent Return true if we should be silent when
1.31 espie 94: * creating the given target.
1.1 deraadt 95: *
1.32 espie 96: * Targ_Precious Return true if the target is precious and
1.31 espie 97: * should not be removed if we are interrupted.
1.1 deraadt 98: *
99: * Debugging:
1.31 espie 100: * Targ_PrintGraph Print out the entire graphm all variables
101: * and statistics for the directory cache. Should
102: * print something for suffixes, too, but...
1.1 deraadt 103: */
104:
1.32 espie 105: #include <sys/types.h>
106: #include <stddef.h>
107: #include <stdio.h>
1.33 ! espie 108: #include <string.h>
1.32 espie 109: #include "config.h"
110: #include "defines.h"
111: #include "ohash.h"
112: #include "stats.h"
113: #include "suff.h"
114: #include "var.h"
115: #include "targ.h"
116: #include "memory.h"
117: #include "gnode.h"
118: #include "extern.h"
119: #include "timestamp.h"
120: #include "lst.h"
1.31 espie 121:
122: static struct ohash targets; /* a hash table of same */
123: static struct ohash_info gnode_info = {
124: offsetof(GNode, name),
1.27 espie 125: NULL, hash_alloc, hash_free, element_alloc };
1.1 deraadt 126:
1.31 espie 127: static void TargPrintOnlySrc(GNode *);
128: static void TargPrintName(void *);
129: static void TargPrintNode(GNode *, int);
1.10 espie 130: #ifdef CLEANUP
1.31 espie 131: static void TargFreeGN(void *);
1.10 espie 132: #endif
1.1 deraadt 133:
134: /*-
135: *-----------------------------------------------------------------------
136: * Targ_Init --
137: * Initialize this module
138: *
1.31 espie 139: * Side Effects:
1.27 espie 140: * The targets hash table is initialized
1.1 deraadt 141: *-----------------------------------------------------------------------
142: */
143: void
1.19 espie 144: Targ_Init()
1.1 deraadt 145: {
1.27 espie 146: /* A small make file already creates 200 targets. */
1.30 espie 147: ohash_init(&targets, 10, &gnode_info);
1.1 deraadt 148: }
149:
150: /*-
151: *-----------------------------------------------------------------------
152: * Targ_End --
153: * Finalize this module
154: *
155: * Side Effects:
156: * All lists and gnodes are cleared
157: *-----------------------------------------------------------------------
158: */
1.32 espie 159: #ifdef CLEANUP
1.1 deraadt 160: void
1.31 espie 161: Targ_End()
1.1 deraadt 162: {
1.31 espie 163: unsigned int i;
164: GNode *n;
165:
166: for (n = ohash_first(&targets, &i); n != NULL; n = ohash_next(&targets, &i))
167: TargFreeGN(n);
168:
1.30 espie 169: ohash_delete(&targets);
1.32 espie 170: }
1.10 espie 171: #endif
1.1 deraadt 172:
173: /*-
174: *-----------------------------------------------------------------------
1.32 espie 175: * Targ_NewGNi --
1.1 deraadt 176: * Create and initialize a new graph node
177: *
178: * Results:
179: * An initialized graph node with the name field filled with a copy
180: * of the passed name
181: *
182: * Side Effects:
1.31 espie 183: * The gnode is added to the list of all gnodes.
1.1 deraadt 184: *-----------------------------------------------------------------------
185: */
186: GNode *
1.32 espie 187: Targ_NewGNi(name, end)
1.31 espie 188: const char *name; /* the name to stick in the new node */
189: const char *end;
1.1 deraadt 190: {
1.31 espie 191: GNode *gn;
1.1 deraadt 192:
1.30 espie 193: gn = ohash_create_entry(&gnode_info, name, &end);
1.27 espie 194: gn->path = NULL;
1.1 deraadt 195: if (name[0] == '-' && name[1] == 'l') {
196: gn->type = OP_LIB;
197: } else {
198: gn->type = 0;
199: }
1.31 espie 200: gn->unmade = 0;
1.32 espie 201: gn->make = false;
1.31 espie 202: gn->made = UNMADE;
1.32 espie 203: gn->childMade = false;
1.31 espie 204: gn->order = 0;
1.32 espie 205: ts_set_out_of_date(gn->mtime);
206: ts_set_out_of_date(gn->cmtime);
1.19 espie 207: Lst_Init(&gn->iParents);
208: Lst_Init(&gn->cohorts);
209: Lst_Init(&gn->parents);
210: Lst_Init(&gn->children);
211: Lst_Init(&gn->successors);
212: Lst_Init(&gn->preds);
1.25 espie 213: SymTable_Init(&gn->context);
1.16 espie 214: gn->lineno = 0;
215: gn->fname = NULL;
1.19 espie 216: Lst_Init(&gn->commands);
1.1 deraadt 217: gn->suffix = NULL;
218:
1.31 espie 219: #ifdef STATS_GN_CREATION
220: STAT_GN_COUNT++;
1.10 espie 221: #endif
1.1 deraadt 222:
1.27 espie 223: return gn;
1.1 deraadt 224: }
225:
1.10 espie 226: #ifdef CLEANUP
1.1 deraadt 227: /*-
228: *-----------------------------------------------------------------------
229: * TargFreeGN --
230: * Destroy a GNode
231: *-----------------------------------------------------------------------
232: */
233: static void
1.18 espie 234: TargFreeGN(gnp)
235: void *gnp;
1.1 deraadt 236: {
1.31 espie 237: GNode *gn = (GNode *)gnp;
1.1 deraadt 238:
1.9 espie 239: efree(gn->path);
1.24 espie 240: Lst_Destroy(&gn->iParents, NOFREE);
241: Lst_Destroy(&gn->cohorts, NOFREE);
242: Lst_Destroy(&gn->parents, NOFREE);
243: Lst_Destroy(&gn->children, NOFREE);
244: Lst_Destroy(&gn->successors, NOFREE);
245: Lst_Destroy(&gn->preds, NOFREE);
1.31 espie 246: Lst_Destroy(&gn->commands, NOFREE);
1.25 espie 247: SymTable_Destroy(&gn->context);
1.18 espie 248: free(gn);
1.1 deraadt 249: }
1.10 espie 250: #endif
1.1 deraadt 251:
252:
253: /*-
254: *-----------------------------------------------------------------------
1.32 espie 255: * Targ_FindNodei --
1.1 deraadt 256: * Find a node in the list using the given name for matching
257: *
258: * Results:
1.31 espie 259: * The node in the list if it was. If it wasn't, return NULL if
1.1 deraadt 260: * flags was TARG_NOCREATE or the newly created and initialized node
1.31 espie 261: * if flags was TARG_CREATE
1.1 deraadt 262: *
263: * Side Effects:
264: * Sometimes a node is created and added to the list
265: *-----------------------------------------------------------------------
266: */
267: GNode *
1.32 espie 268: Targ_FindNodei(name, end, flags)
1.27 espie 269: const char *name; /* the name to find */
1.31 espie 270: const char *end;
271: int flags; /* flags governing events when target not
1.1 deraadt 272: * found */
273: {
1.31 espie 274: GNode *gn; /* node in that element */
1.27 espie 275: unsigned int slot;
276:
1.30 espie 277: slot = ohash_qlookupi(&targets, name, &end);
1.27 espie 278:
1.30 espie 279: gn = ohash_find(&targets, slot);
1.31 espie 280:
1.27 espie 281: if (gn == NULL && (flags & TARG_CREATE)) {
1.32 espie 282: gn = Targ_NewGNi(name, end);
1.30 espie 283: ohash_insert(&targets, slot, gn);
1.1 deraadt 284: }
285:
1.27 espie 286: return gn;
1.1 deraadt 287: }
288:
289: /*-
290: *-----------------------------------------------------------------------
291: * Targ_FindList --
1.5 millert 292: * Make a complete list of GNodes from the given list of names
1.1 deraadt 293: *
1.20 espie 294: * Side Effects:
1.31 espie 295: * Nodes will be created for all names in names which do not yet have graph
1.20 espie 296: * nodes.
1.1 deraadt 297: *
1.31 espie 298: * A complete list of graph nodes corresponding to all instances of all
299: * the names in names is added to nodes.
1.1 deraadt 300: * -----------------------------------------------------------------------
301: */
1.20 espie 302: void
303: Targ_FindList(nodes, names)
1.31 espie 304: Lst nodes; /* result list */
305: Lst names; /* list of names to find */
1.1 deraadt 306: {
1.31 espie 307: LstNode ln; /* name list element */
308: GNode *gn; /* node in tLn */
309: char *name;
1.1 deraadt 310:
1.22 espie 311: for (ln = Lst_First(names); ln != NULL; ln = Lst_Adv(ln)) {
1.1 deraadt 312: name = (char *)Lst_Datum(ln);
1.32 espie 313: gn = Targ_FindNode(name, TARG_CREATE);
1.31 espie 314: /* Note: Lst_AtEnd must come before the Lst_Concat so the nodes
315: * are added to the list in the order in which they were
316: * encountered in the makefile. */
1.20 espie 317: Lst_AtEnd(nodes, gn);
318: if (gn->type & OP_DOUBLEDEP)
1.21 espie 319: Lst_Concat(nodes, &gn->cohorts);
1.1 deraadt 320: }
321: }
322:
323: /*-
324: *-----------------------------------------------------------------------
1.31 espie 325: * Targ_Ignore --
1.1 deraadt 326: * Return true if should ignore errors when creating gn
327: *-----------------------------------------------------------------------
328: */
1.32 espie 329: bool
1.27 espie 330: Targ_Ignore(gn)
1.31 espie 331: GNode *gn; /* node to check for */
1.1 deraadt 332: {
1.27 espie 333: if (ignoreErrors || gn->type & OP_IGNORE)
1.32 espie 334: return true;
1.27 espie 335: else
1.32 espie 336: return false;
1.1 deraadt 337: }
338:
339: /*-
340: *-----------------------------------------------------------------------
1.31 espie 341: * Targ_Silent --
1.1 deraadt 342: * Return true if be silent when creating gn
343: *-----------------------------------------------------------------------
344: */
1.32 espie 345: bool
1.27 espie 346: Targ_Silent(gn)
1.31 espie 347: GNode *gn; /* node to check for */
1.1 deraadt 348: {
1.27 espie 349: if (beSilent || gn->type & OP_SILENT)
1.32 espie 350: return true;
1.27 espie 351: else
1.32 espie 352: return false;
1.1 deraadt 353: }
354:
355: /*-
356: *-----------------------------------------------------------------------
357: * Targ_Precious --
358: * See if the given target is precious
359: *-----------------------------------------------------------------------
360: */
1.32 espie 361: bool
1.31 espie 362: Targ_Precious(gn)
363: GNode *gn; /* the node to check */
1.1 deraadt 364: {
1.27 espie 365: if (allPrecious || (gn->type & (OP_PRECIOUS|OP_DOUBLEDEP)))
1.32 espie 366: return true;
1.27 espie 367: else
1.32 espie 368: return false;
1.1 deraadt 369: }
370:
371: /******************* DEBUG INFO PRINTING ****************/
372:
373: static GNode *mainTarg; /* the main target, as set by Targ_SetMain */
1.5 millert 374: /*-
1.1 deraadt 375: *-----------------------------------------------------------------------
376: * Targ_SetMain --
377: * Set our idea of the main target we'll be creating. Used for
378: * debugging output.
379: *
380: * Side Effects:
381: * "mainTarg" is set to the main target's node.
382: *-----------------------------------------------------------------------
383: */
384: void
1.27 espie 385: Targ_SetMain(gn)
1.31 espie 386: GNode *gn; /* The main target we'll create */
1.1 deraadt 387: {
388: mainTarg = gn;
389: }
390:
1.17 espie 391: static void
392: TargPrintName(gnp)
1.18 espie 393: void *gnp;
1.1 deraadt 394: {
1.17 espie 395: GNode *gn = (GNode *)gnp;
396: printf("%s ", gn->name);
1.1 deraadt 397: }
398:
399:
1.17 espie 400: void
401: Targ_PrintCmd(cmd)
1.18 espie 402: void *cmd;
1.1 deraadt 403: {
1.17 espie 404: printf("\t%s\n", (char *)cmd);
1.1 deraadt 405: }
406:
407: /*-
408: *-----------------------------------------------------------------------
409: * Targ_FmtTime --
410: * Format a modification time in some reasonable way and return it.
411: *
412: * Results:
413: * The time reformatted.
414: *
415: * Side Effects:
416: * The time is placed in a static area, so it is overwritten
417: * with each call.
418: *-----------------------------------------------------------------------
419: */
420: char *
1.27 espie 421: Targ_FmtTime(time)
1.31 espie 422: TIMESTAMP time;
1.1 deraadt 423: {
1.31 espie 424: struct tm *parts;
425: static char buf[128];
1.29 espie 426: time_t t;
1.1 deraadt 427:
1.29 espie 428: t = timestamp2time_t(time);
429:
430: parts = localtime(&t);
1.31 espie 431: strftime(buf, sizeof buf, "%H:%M:%S %b %d, %Y", parts);
1.8 deraadt 432: buf[sizeof(buf) - 1] = '\0';
1.31 espie 433: return buf;
1.1 deraadt 434: }
1.5 millert 435:
1.1 deraadt 436: /*-
437: *-----------------------------------------------------------------------
438: * Targ_PrintType --
439: * Print out a type field giving only those attributes the user can
440: * set.
441: *-----------------------------------------------------------------------
442: */
443: void
1.27 espie 444: Targ_PrintType(type)
445: int type;
1.1 deraadt 446: {
1.27 espie 447: int tbit;
1.5 millert 448:
1.1 deraadt 449: #ifdef __STDC__
450: #define PRINTBIT(attr) case CONCAT(OP_,attr): printf("." #attr " "); break
451: #define PRINTDBIT(attr) case CONCAT(OP_,attr): if (DEBUG(TARG)) printf("." #attr " "); break
452: #else
1.31 espie 453: #define PRINTBIT(attr) case CONCAT(OP_,attr): printf(".attr "); break
454: #define PRINTDBIT(attr) case CONCAT(OP_,attr): if (DEBUG(TARG)) printf(".attr "); break
1.1 deraadt 455: #endif /* __STDC__ */
456:
457: type &= ~OP_OPMASK;
458:
459: while (type) {
460: tbit = 1 << (ffs(type) - 1);
461: type &= ~tbit;
462:
1.31 espie 463: switch (tbit) {
1.1 deraadt 464: PRINTBIT(OPTIONAL);
465: PRINTBIT(USE);
466: PRINTBIT(EXEC);
467: PRINTBIT(IGNORE);
468: PRINTBIT(PRECIOUS);
469: PRINTBIT(SILENT);
470: PRINTBIT(MAKE);
471: PRINTBIT(JOIN);
472: PRINTBIT(INVISIBLE);
473: PRINTBIT(NOTMAIN);
474: PRINTDBIT(LIB);
475: /*XXX: MEMBER is defined, so CONCAT(OP_,MEMBER) gives OP_"%" */
476: case OP_MEMBER: if (DEBUG(TARG)) printf(".MEMBER "); break;
477: PRINTDBIT(ARCHV);
478: }
479: }
480: }
481:
482: /*-
483: *-----------------------------------------------------------------------
484: * TargPrintNode --
485: * print the contents of a node
486: *-----------------------------------------------------------------------
487: */
1.17 espie 488: static void
1.27 espie 489: TargPrintNode(gn, pass)
1.31 espie 490: GNode *gn;
491: int pass;
1.1 deraadt 492: {
493: if (!OP_NOP(gn->type)) {
494: printf("#\n");
1.31 espie 495: if (gn == mainTarg) {
1.1 deraadt 496: printf("# *** MAIN TARGET ***\n");
1.31 espie 497: }
1.1 deraadt 498: if (pass == 2) {
1.31 espie 499: if (gn->unmade) {
1.1 deraadt 500: printf("# %d unmade children\n", gn->unmade);
1.31 espie 501: } else {
1.1 deraadt 502: printf("# No unmade children\n");
1.31 espie 503: }
1.1 deraadt 504: if (! (gn->type & (OP_JOIN|OP_USE|OP_EXEC))) {
1.31 espie 505: if (!is_out_of_date(gn->mtime)) {
1.1 deraadt 506: printf("# last modified %s: %s\n",
507: Targ_FmtTime(gn->mtime),
508: (gn->made == UNMADE ? "unmade" :
509: (gn->made == MADE ? "made" :
510: (gn->made == UPTODATE ? "up-to-date" :
511: "error when made"))));
1.31 espie 512: } else if (gn->made != UNMADE) {
1.1 deraadt 513: printf("# non-existent (maybe): %s\n",
514: (gn->made == MADE ? "made" :
515: (gn->made == UPTODATE ? "up-to-date" :
516: (gn->made == ERROR ? "error when made" :
517: "aborted"))));
1.31 espie 518: } else {
1.1 deraadt 519: printf("# unmade\n");
1.31 espie 520: }
1.1 deraadt 521: }
1.19 espie 522: if (!Lst_IsEmpty(&gn->iParents)) {
1.1 deraadt 523: printf("# implicit parents: ");
1.19 espie 524: Lst_Every(&gn->iParents, TargPrintName);
1.17 espie 525: fputc('\n', stdout);
1.1 deraadt 526: }
527: }
1.19 espie 528: if (!Lst_IsEmpty(&gn->parents)) {
1.1 deraadt 529: printf("# parents: ");
1.19 espie 530: Lst_Every(&gn->parents, TargPrintName);
1.31 espie 531: fputc('\n', stdout);
1.1 deraadt 532: }
1.5 millert 533:
1.1 deraadt 534: printf("%-16s", gn->name);
535: switch (gn->type & OP_OPMASK) {
536: case OP_DEPENDS:
537: printf(": "); break;
538: case OP_FORCE:
539: printf("! "); break;
540: case OP_DOUBLEDEP:
541: printf(":: "); break;
542: }
1.17 espie 543: Targ_PrintType(gn->type);
1.19 espie 544: Lst_Every(&gn->children, TargPrintName);
1.17 espie 545: fputc('\n', stdout);
1.19 espie 546: Lst_Every(&gn->commands, Targ_PrintCmd);
1.1 deraadt 547: printf("\n\n");
1.27 espie 548: if (gn->type & OP_DOUBLEDEP) {
549: LstNode ln;
1.31 espie 550:
551: for (ln = Lst_First(&gn->cohorts); ln != NULL; ln = Lst_Adv(ln))
1.27 espie 552: TargPrintNode((GNode *)Lst_Datum(ln), pass);
553: }
1.1 deraadt 554: }
555: }
556:
557: /*-
558: *-----------------------------------------------------------------------
559: * TargPrintOnlySrc --
1.31 espie 560: * Print targets that are just a source.
1.1 deraadt 561: *-----------------------------------------------------------------------
562: */
1.17 espie 563: static void
1.27 espie 564: TargPrintOnlySrc(gn)
1.31 espie 565: GNode *gn;
1.1 deraadt 566: {
567: if (OP_NOP(gn->type))
1.31 espie 568: printf("#\t%s [%s]\n", gn->name,
569: gn->path != NULL ? gn->path : gn->name);
1.1 deraadt 570: }
571:
572: /*-
573: *-----------------------------------------------------------------------
574: * Targ_PrintGraph --
1.27 espie 575: * print the entire graph.
1.1 deraadt 576: *-----------------------------------------------------------------------
577: */
578: void
1.27 espie 579: Targ_PrintGraph(pass)
1.31 espie 580: int pass; /* Which pass this is. 1 => no processing
581: * 2 => processing done */
1.1 deraadt 582: {
1.27 espie 583: GNode *gn;
584: unsigned int i;
585:
1.1 deraadt 586: printf("#*** Input graph:\n");
1.31 espie 587: for (gn = ohash_first(&targets, &i); gn != NULL;
1.30 espie 588: gn = ohash_next(&targets, &i))
1.27 espie 589: TargPrintNode(gn, pass);
1.1 deraadt 590: printf("\n\n");
591: printf("#\n# Files that are only sources:\n");
1.31 espie 592: for (gn = ohash_first(&targets, &i); gn != NULL;
1.30 espie 593: gn = ohash_next(&targets, &i))
1.27 espie 594: TargPrintOnlySrc(gn);
1.31 espie 595: Var_Dump();
1.1 deraadt 596: printf("\n");
1.32 espie 597: #ifdef DEBUG_DIRECTORY_CACHE
1.1 deraadt 598: Dir_PrintDirectories();
599: printf("\n");
1.32 espie 600: #endif
1.1 deraadt 601: Suff_PrintAll();
602: }