Annotation of src/usr.bin/make/targ.c, Revision 1.32
1.31 espie 1: /* $OpenPackages$ */
2: /* $OpenBSD: targ.c,v 1.10 1999/10/05 22:06:24 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>
! 108: #include "config.h"
! 109: #include "defines.h"
! 110: #include "ohash.h"
! 111: #include "stats.h"
! 112: #include "suff.h"
! 113: #include "var.h"
! 114: #include "targ.h"
! 115: #include "memory.h"
! 116: #include "gnode.h"
! 117: #include "extern.h"
! 118: #include "timestamp.h"
! 119: #include "lst.h"
1.31 espie 120:
121: static struct ohash targets; /* a hash table of same */
122: static struct ohash_info gnode_info = {
123: offsetof(GNode, name),
1.27 espie 124: NULL, hash_alloc, hash_free, element_alloc };
1.1 deraadt 125:
1.31 espie 126: static void TargPrintOnlySrc(GNode *);
127: static void TargPrintName(void *);
128: static void TargPrintNode(GNode *, int);
1.10 espie 129: #ifdef CLEANUP
1.31 espie 130: static void TargFreeGN(void *);
1.10 espie 131: #endif
1.1 deraadt 132:
133: /*-
134: *-----------------------------------------------------------------------
135: * Targ_Init --
136: * Initialize this module
137: *
1.31 espie 138: * Side Effects:
1.27 espie 139: * The targets hash table is initialized
1.1 deraadt 140: *-----------------------------------------------------------------------
141: */
142: void
1.19 espie 143: Targ_Init()
1.1 deraadt 144: {
1.27 espie 145: /* A small make file already creates 200 targets. */
1.30 espie 146: ohash_init(&targets, 10, &gnode_info);
1.1 deraadt 147: }
148:
149: /*-
150: *-----------------------------------------------------------------------
151: * Targ_End --
152: * Finalize this module
153: *
154: * Side Effects:
155: * All lists and gnodes are cleared
156: *-----------------------------------------------------------------------
157: */
1.32 ! espie 158: #ifdef CLEANUP
1.1 deraadt 159: void
1.31 espie 160: Targ_End()
1.1 deraadt 161: {
1.31 espie 162: unsigned int i;
163: GNode *n;
164:
165: for (n = ohash_first(&targets, &i); n != NULL; n = ohash_next(&targets, &i))
166: TargFreeGN(n);
167:
1.30 espie 168: ohash_delete(&targets);
1.32 ! espie 169: }
1.10 espie 170: #endif
1.1 deraadt 171:
172: /*-
173: *-----------------------------------------------------------------------
1.32 ! espie 174: * Targ_NewGNi --
1.1 deraadt 175: * Create and initialize a new graph node
176: *
177: * Results:
178: * An initialized graph node with the name field filled with a copy
179: * of the passed name
180: *
181: * Side Effects:
1.31 espie 182: * The gnode is added to the list of all gnodes.
1.1 deraadt 183: *-----------------------------------------------------------------------
184: */
185: GNode *
1.32 ! espie 186: Targ_NewGNi(name, end)
1.31 espie 187: const char *name; /* the name to stick in the new node */
188: const char *end;
1.1 deraadt 189: {
1.31 espie 190: GNode *gn;
1.1 deraadt 191:
1.30 espie 192: gn = ohash_create_entry(&gnode_info, name, &end);
1.27 espie 193: gn->path = NULL;
1.1 deraadt 194: if (name[0] == '-' && name[1] == 'l') {
195: gn->type = OP_LIB;
196: } else {
197: gn->type = 0;
198: }
1.31 espie 199: gn->unmade = 0;
1.32 ! espie 200: gn->make = false;
1.31 espie 201: gn->made = UNMADE;
1.32 ! espie 202: gn->childMade = false;
1.31 espie 203: gn->order = 0;
1.32 ! espie 204: ts_set_out_of_date(gn->mtime);
! 205: ts_set_out_of_date(gn->cmtime);
1.19 espie 206: Lst_Init(&gn->iParents);
207: Lst_Init(&gn->cohorts);
208: Lst_Init(&gn->parents);
209: Lst_Init(&gn->children);
210: Lst_Init(&gn->successors);
211: Lst_Init(&gn->preds);
1.25 espie 212: SymTable_Init(&gn->context);
1.16 espie 213: gn->lineno = 0;
214: gn->fname = NULL;
1.19 espie 215: Lst_Init(&gn->commands);
1.1 deraadt 216: gn->suffix = NULL;
217:
1.31 espie 218: #ifdef STATS_GN_CREATION
219: STAT_GN_COUNT++;
1.10 espie 220: #endif
1.1 deraadt 221:
1.27 espie 222: return gn;
1.1 deraadt 223: }
224:
1.10 espie 225: #ifdef CLEANUP
1.1 deraadt 226: /*-
227: *-----------------------------------------------------------------------
228: * TargFreeGN --
229: * Destroy a GNode
230: *-----------------------------------------------------------------------
231: */
232: static void
1.18 espie 233: TargFreeGN(gnp)
234: void *gnp;
1.1 deraadt 235: {
1.31 espie 236: GNode *gn = (GNode *)gnp;
1.1 deraadt 237:
1.9 espie 238: efree(gn->path);
1.24 espie 239: Lst_Destroy(&gn->iParents, NOFREE);
240: Lst_Destroy(&gn->cohorts, NOFREE);
241: Lst_Destroy(&gn->parents, NOFREE);
242: Lst_Destroy(&gn->children, NOFREE);
243: Lst_Destroy(&gn->successors, NOFREE);
244: Lst_Destroy(&gn->preds, NOFREE);
1.31 espie 245: Lst_Destroy(&gn->commands, NOFREE);
1.25 espie 246: SymTable_Destroy(&gn->context);
1.18 espie 247: free(gn);
1.1 deraadt 248: }
1.10 espie 249: #endif
1.1 deraadt 250:
251:
252: /*-
253: *-----------------------------------------------------------------------
1.32 ! espie 254: * Targ_FindNodei --
1.1 deraadt 255: * Find a node in the list using the given name for matching
256: *
257: * Results:
1.31 espie 258: * The node in the list if it was. If it wasn't, return NULL if
1.1 deraadt 259: * flags was TARG_NOCREATE or the newly created and initialized node
1.31 espie 260: * if flags was TARG_CREATE
1.1 deraadt 261: *
262: * Side Effects:
263: * Sometimes a node is created and added to the list
264: *-----------------------------------------------------------------------
265: */
266: GNode *
1.32 ! espie 267: Targ_FindNodei(name, end, flags)
1.27 espie 268: const char *name; /* the name to find */
1.31 espie 269: const char *end;
270: int flags; /* flags governing events when target not
1.1 deraadt 271: * found */
272: {
1.31 espie 273: GNode *gn; /* node in that element */
1.27 espie 274: unsigned int slot;
275:
1.30 espie 276: slot = ohash_qlookupi(&targets, name, &end);
1.27 espie 277:
1.30 espie 278: gn = ohash_find(&targets, slot);
1.31 espie 279:
1.27 espie 280: if (gn == NULL && (flags & TARG_CREATE)) {
1.32 ! espie 281: gn = Targ_NewGNi(name, end);
1.30 espie 282: ohash_insert(&targets, slot, gn);
1.1 deraadt 283: }
284:
1.27 espie 285: return gn;
1.1 deraadt 286: }
287:
288: /*-
289: *-----------------------------------------------------------------------
290: * Targ_FindList --
1.5 millert 291: * Make a complete list of GNodes from the given list of names
1.1 deraadt 292: *
1.20 espie 293: * Side Effects:
1.31 espie 294: * Nodes will be created for all names in names which do not yet have graph
1.20 espie 295: * nodes.
1.1 deraadt 296: *
1.31 espie 297: * A complete list of graph nodes corresponding to all instances of all
298: * the names in names is added to nodes.
1.1 deraadt 299: * -----------------------------------------------------------------------
300: */
1.20 espie 301: void
302: Targ_FindList(nodes, names)
1.31 espie 303: Lst nodes; /* result list */
304: Lst names; /* list of names to find */
1.1 deraadt 305: {
1.31 espie 306: LstNode ln; /* name list element */
307: GNode *gn; /* node in tLn */
308: char *name;
1.1 deraadt 309:
1.22 espie 310: for (ln = Lst_First(names); ln != NULL; ln = Lst_Adv(ln)) {
1.1 deraadt 311: name = (char *)Lst_Datum(ln);
1.32 ! espie 312: gn = Targ_FindNode(name, TARG_CREATE);
1.31 espie 313: /* Note: Lst_AtEnd must come before the Lst_Concat so the nodes
314: * are added to the list in the order in which they were
315: * encountered in the makefile. */
1.20 espie 316: Lst_AtEnd(nodes, gn);
317: if (gn->type & OP_DOUBLEDEP)
1.21 espie 318: Lst_Concat(nodes, &gn->cohorts);
1.1 deraadt 319: }
320: }
321:
322: /*-
323: *-----------------------------------------------------------------------
1.31 espie 324: * Targ_Ignore --
1.1 deraadt 325: * Return true if should ignore errors when creating gn
326: *-----------------------------------------------------------------------
327: */
1.32 ! espie 328: bool
1.27 espie 329: Targ_Ignore(gn)
1.31 espie 330: GNode *gn; /* node to check for */
1.1 deraadt 331: {
1.27 espie 332: if (ignoreErrors || gn->type & OP_IGNORE)
1.32 ! espie 333: return true;
1.27 espie 334: else
1.32 ! espie 335: return false;
1.1 deraadt 336: }
337:
338: /*-
339: *-----------------------------------------------------------------------
1.31 espie 340: * Targ_Silent --
1.1 deraadt 341: * Return true if be silent when creating gn
342: *-----------------------------------------------------------------------
343: */
1.32 ! espie 344: bool
1.27 espie 345: Targ_Silent(gn)
1.31 espie 346: GNode *gn; /* node to check for */
1.1 deraadt 347: {
1.27 espie 348: if (beSilent || gn->type & OP_SILENT)
1.32 ! espie 349: return true;
1.27 espie 350: else
1.32 ! espie 351: return false;
1.1 deraadt 352: }
353:
354: /*-
355: *-----------------------------------------------------------------------
356: * Targ_Precious --
357: * See if the given target is precious
358: *-----------------------------------------------------------------------
359: */
1.32 ! espie 360: bool
1.31 espie 361: Targ_Precious(gn)
362: GNode *gn; /* the node to check */
1.1 deraadt 363: {
1.27 espie 364: if (allPrecious || (gn->type & (OP_PRECIOUS|OP_DOUBLEDEP)))
1.32 ! espie 365: return true;
1.27 espie 366: else
1.32 ! espie 367: return false;
1.1 deraadt 368: }
369:
370: /******************* DEBUG INFO PRINTING ****************/
371:
372: static GNode *mainTarg; /* the main target, as set by Targ_SetMain */
1.5 millert 373: /*-
1.1 deraadt 374: *-----------------------------------------------------------------------
375: * Targ_SetMain --
376: * Set our idea of the main target we'll be creating. Used for
377: * debugging output.
378: *
379: * Side Effects:
380: * "mainTarg" is set to the main target's node.
381: *-----------------------------------------------------------------------
382: */
383: void
1.27 espie 384: Targ_SetMain(gn)
1.31 espie 385: GNode *gn; /* The main target we'll create */
1.1 deraadt 386: {
387: mainTarg = gn;
388: }
389:
1.17 espie 390: static void
391: TargPrintName(gnp)
1.18 espie 392: void *gnp;
1.1 deraadt 393: {
1.17 espie 394: GNode *gn = (GNode *)gnp;
395: printf("%s ", gn->name);
1.1 deraadt 396: }
397:
398:
1.17 espie 399: void
400: Targ_PrintCmd(cmd)
1.18 espie 401: void *cmd;
1.1 deraadt 402: {
1.17 espie 403: printf("\t%s\n", (char *)cmd);
1.1 deraadt 404: }
405:
406: /*-
407: *-----------------------------------------------------------------------
408: * Targ_FmtTime --
409: * Format a modification time in some reasonable way and return it.
410: *
411: * Results:
412: * The time reformatted.
413: *
414: * Side Effects:
415: * The time is placed in a static area, so it is overwritten
416: * with each call.
417: *-----------------------------------------------------------------------
418: */
419: char *
1.27 espie 420: Targ_FmtTime(time)
1.31 espie 421: TIMESTAMP time;
1.1 deraadt 422: {
1.31 espie 423: struct tm *parts;
424: static char buf[128];
1.29 espie 425: time_t t;
1.1 deraadt 426:
1.29 espie 427: t = timestamp2time_t(time);
428:
429: parts = localtime(&t);
1.31 espie 430: strftime(buf, sizeof buf, "%H:%M:%S %b %d, %Y", parts);
1.8 deraadt 431: buf[sizeof(buf) - 1] = '\0';
1.31 espie 432: return buf;
1.1 deraadt 433: }
1.5 millert 434:
1.1 deraadt 435: /*-
436: *-----------------------------------------------------------------------
437: * Targ_PrintType --
438: * Print out a type field giving only those attributes the user can
439: * set.
440: *-----------------------------------------------------------------------
441: */
442: void
1.27 espie 443: Targ_PrintType(type)
444: int type;
1.1 deraadt 445: {
1.27 espie 446: int tbit;
1.5 millert 447:
1.1 deraadt 448: #ifdef __STDC__
449: #define PRINTBIT(attr) case CONCAT(OP_,attr): printf("." #attr " "); break
450: #define PRINTDBIT(attr) case CONCAT(OP_,attr): if (DEBUG(TARG)) printf("." #attr " "); break
451: #else
1.31 espie 452: #define PRINTBIT(attr) case CONCAT(OP_,attr): printf(".attr "); break
453: #define PRINTDBIT(attr) case CONCAT(OP_,attr): if (DEBUG(TARG)) printf(".attr "); break
1.1 deraadt 454: #endif /* __STDC__ */
455:
456: type &= ~OP_OPMASK;
457:
458: while (type) {
459: tbit = 1 << (ffs(type) - 1);
460: type &= ~tbit;
461:
1.31 espie 462: switch (tbit) {
1.1 deraadt 463: PRINTBIT(OPTIONAL);
464: PRINTBIT(USE);
465: PRINTBIT(EXEC);
466: PRINTBIT(IGNORE);
467: PRINTBIT(PRECIOUS);
468: PRINTBIT(SILENT);
469: PRINTBIT(MAKE);
470: PRINTBIT(JOIN);
471: PRINTBIT(INVISIBLE);
472: PRINTBIT(NOTMAIN);
473: PRINTDBIT(LIB);
474: /*XXX: MEMBER is defined, so CONCAT(OP_,MEMBER) gives OP_"%" */
475: case OP_MEMBER: if (DEBUG(TARG)) printf(".MEMBER "); break;
476: PRINTDBIT(ARCHV);
477: }
478: }
479: }
480:
481: /*-
482: *-----------------------------------------------------------------------
483: * TargPrintNode --
484: * print the contents of a node
485: *-----------------------------------------------------------------------
486: */
1.17 espie 487: static void
1.27 espie 488: TargPrintNode(gn, pass)
1.31 espie 489: GNode *gn;
490: int pass;
1.1 deraadt 491: {
492: if (!OP_NOP(gn->type)) {
493: printf("#\n");
1.31 espie 494: if (gn == mainTarg) {
1.1 deraadt 495: printf("# *** MAIN TARGET ***\n");
1.31 espie 496: }
1.1 deraadt 497: if (pass == 2) {
1.31 espie 498: if (gn->unmade) {
1.1 deraadt 499: printf("# %d unmade children\n", gn->unmade);
1.31 espie 500: } else {
1.1 deraadt 501: printf("# No unmade children\n");
1.31 espie 502: }
1.1 deraadt 503: if (! (gn->type & (OP_JOIN|OP_USE|OP_EXEC))) {
1.31 espie 504: if (!is_out_of_date(gn->mtime)) {
1.1 deraadt 505: printf("# last modified %s: %s\n",
506: Targ_FmtTime(gn->mtime),
507: (gn->made == UNMADE ? "unmade" :
508: (gn->made == MADE ? "made" :
509: (gn->made == UPTODATE ? "up-to-date" :
510: "error when made"))));
1.31 espie 511: } else if (gn->made != UNMADE) {
1.1 deraadt 512: printf("# non-existent (maybe): %s\n",
513: (gn->made == MADE ? "made" :
514: (gn->made == UPTODATE ? "up-to-date" :
515: (gn->made == ERROR ? "error when made" :
516: "aborted"))));
1.31 espie 517: } else {
1.1 deraadt 518: printf("# unmade\n");
1.31 espie 519: }
1.1 deraadt 520: }
1.19 espie 521: if (!Lst_IsEmpty(&gn->iParents)) {
1.1 deraadt 522: printf("# implicit parents: ");
1.19 espie 523: Lst_Every(&gn->iParents, TargPrintName);
1.17 espie 524: fputc('\n', stdout);
1.1 deraadt 525: }
526: }
1.19 espie 527: if (!Lst_IsEmpty(&gn->parents)) {
1.1 deraadt 528: printf("# parents: ");
1.19 espie 529: Lst_Every(&gn->parents, TargPrintName);
1.31 espie 530: fputc('\n', stdout);
1.1 deraadt 531: }
1.5 millert 532:
1.1 deraadt 533: printf("%-16s", gn->name);
534: switch (gn->type & OP_OPMASK) {
535: case OP_DEPENDS:
536: printf(": "); break;
537: case OP_FORCE:
538: printf("! "); break;
539: case OP_DOUBLEDEP:
540: printf(":: "); break;
541: }
1.17 espie 542: Targ_PrintType(gn->type);
1.19 espie 543: Lst_Every(&gn->children, TargPrintName);
1.17 espie 544: fputc('\n', stdout);
1.19 espie 545: Lst_Every(&gn->commands, Targ_PrintCmd);
1.1 deraadt 546: printf("\n\n");
1.27 espie 547: if (gn->type & OP_DOUBLEDEP) {
548: LstNode ln;
1.31 espie 549:
550: for (ln = Lst_First(&gn->cohorts); ln != NULL; ln = Lst_Adv(ln))
1.27 espie 551: TargPrintNode((GNode *)Lst_Datum(ln), pass);
552: }
1.1 deraadt 553: }
554: }
555:
556: /*-
557: *-----------------------------------------------------------------------
558: * TargPrintOnlySrc --
1.31 espie 559: * Print targets that are just a source.
1.1 deraadt 560: *-----------------------------------------------------------------------
561: */
1.17 espie 562: static void
1.27 espie 563: TargPrintOnlySrc(gn)
1.31 espie 564: GNode *gn;
1.1 deraadt 565: {
566: if (OP_NOP(gn->type))
1.31 espie 567: printf("#\t%s [%s]\n", gn->name,
568: gn->path != NULL ? gn->path : gn->name);
1.1 deraadt 569: }
570:
571: /*-
572: *-----------------------------------------------------------------------
573: * Targ_PrintGraph --
1.27 espie 574: * print the entire graph.
1.1 deraadt 575: *-----------------------------------------------------------------------
576: */
577: void
1.27 espie 578: Targ_PrintGraph(pass)
1.31 espie 579: int pass; /* Which pass this is. 1 => no processing
580: * 2 => processing done */
1.1 deraadt 581: {
1.27 espie 582: GNode *gn;
583: unsigned int i;
584:
1.1 deraadt 585: printf("#*** Input graph:\n");
1.31 espie 586: for (gn = ohash_first(&targets, &i); gn != NULL;
1.30 espie 587: gn = ohash_next(&targets, &i))
1.27 espie 588: TargPrintNode(gn, pass);
1.1 deraadt 589: printf("\n\n");
590: printf("#\n# Files that are only sources:\n");
1.31 espie 591: for (gn = ohash_first(&targets, &i); gn != NULL;
1.30 espie 592: gn = ohash_next(&targets, &i))
1.27 espie 593: TargPrintOnlySrc(gn);
1.31 espie 594: Var_Dump();
1.1 deraadt 595: printf("\n");
1.32 ! espie 596: #ifdef DEBUG_DIRECTORY_CACHE
1.1 deraadt 597: Dir_PrintDirectories();
598: printf("\n");
1.32 ! espie 599: #endif
1.1 deraadt 600: Suff_PrintAll();
601: }