Deleted Added
full compact
suff.c (103508) suff.c (103545)
1/*
2 * Copyright (c) 1988, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1989 by Berkeley Softworks
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.

--- 25 unchanged lines hidden (view full) ---

34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)suff.c 8.4 (Berkeley) 3/21/94
39 */
40
41#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1988, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1989 by Berkeley Softworks
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.

--- 25 unchanged lines hidden (view full) ---

34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)suff.c 8.4 (Berkeley) 3/21/94
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/usr.bin/make/suff.c 103508 2002-09-17 22:31:26Z jmallett $");
42__FBSDID("$FreeBSD: head/usr.bin/make/suff.c 103545 2002-09-18 16:13:03Z jmallett $");
43
44/*-
45 * suff.c --
46 * Functions to maintain suffix lists and find implicit dependents
47 * using suffix transformation rules
48 *
49 * Interface:
50 * Suff_Init Initialize all things to do with suffixes.

--- 358 unchanged lines hidden (view full) ---

409 while ((ln = Lst_Next (l)) != NULL) {
410 s2 = (Suff *) Lst_Datum (ln);
411 if (s2->sNum >= s->sNum) {
412 break;
413 }
414 }
415
416 Lst_Close (l);
43
44/*-
45 * suff.c --
46 * Functions to maintain suffix lists and find implicit dependents
47 * using suffix transformation rules
48 *
49 * Interface:
50 * Suff_Init Initialize all things to do with suffixes.

--- 358 unchanged lines hidden (view full) ---

409 while ((ln = Lst_Next (l)) != NULL) {
410 s2 = (Suff *) Lst_Datum (ln);
411 if (s2->sNum >= s->sNum) {
412 break;
413 }
414 }
415
416 Lst_Close (l);
417 DEBUGF(SUFF, "inserting %s(%d)...", s->name, s->sNum);
417 DEBUGF(SUFF, ("inserting %s(%d)...", s->name, s->sNum));
418 if (ln == NULL) {
418 if (ln == NULL) {
419 DEBUGF(SUFF, "at end of list\n");
419 DEBUGF(SUFF, ("at end of list\n"));
420 (void)Lst_AtEnd (l, (void *)s);
421 s->refCount++;
422 (void)Lst_AtEnd(s->ref, (void *) l);
423 } else if (s2->sNum != s->sNum) {
420 (void)Lst_AtEnd (l, (void *)s);
421 s->refCount++;
422 (void)Lst_AtEnd(s->ref, (void *) l);
423 } else if (s2->sNum != s->sNum) {
424 DEBUGF(SUFF, "before %s(%d)\n", s2->name, s2->sNum);
424 DEBUGF(SUFF, ("before %s(%d)\n", s2->name, s2->sNum));
425 (void)Lst_Insert (l, ln, (void *)s);
426 s->refCount++;
427 (void)Lst_AtEnd(s->ref, (void *) l);
428 } else {
425 (void)Lst_Insert (l, ln, (void *)s);
426 s->refCount++;
427 (void)Lst_AtEnd(s->ref, (void *) l);
428 } else {
429 DEBUGF(SUFF, "already there\n");
429 DEBUGF(SUFF, ("already there\n"));
430 }
431}
432
433/*-
434 *-----------------------------------------------------------------------
435 * Suff_ClearSuffixes --
436 * This is gross. Nuke the list of suffixes but keep all transformation
437 * rules around. The transformation graph is destroyed in this process,

--- 176 unchanged lines hidden (view full) ---

614
615 gn->type = OP_TRANSFORM;
616
617 (void)SuffParseTransform(line, &s, &t);
618
619 /*
620 * link the two together in the proper relationship and order
621 */
430 }
431}
432
433/*-
434 *-----------------------------------------------------------------------
435 * Suff_ClearSuffixes --
436 * This is gross. Nuke the list of suffixes but keep all transformation
437 * rules around. The transformation graph is destroyed in this process,

--- 176 unchanged lines hidden (view full) ---

614
615 gn->type = OP_TRANSFORM;
616
617 (void)SuffParseTransform(line, &s, &t);
618
619 /*
620 * link the two together in the proper relationship and order
621 */
622 DEBUGF(SUFF, "defining transformation from `%s' to `%s'\n",
623 s->name, t->name);
622 DEBUGF(SUFF, ("defining transformation from `%s' to `%s'\n",
623 s->name, t->name));
624 SuffInsert (t->children, s);
625 SuffInsert (s->parents, t);
626
627 return (gn);
628}
629
630/*-
631 *-----------------------------------------------------------------------

--- 21 unchanged lines hidden (view full) ---

653
654 if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
655 Lst_IsEmpty(gn->children))
656 {
657 Suff *s, *t;
658
659 (void)SuffParseTransform(gn->name, &s, &t);
660
624 SuffInsert (t->children, s);
625 SuffInsert (s->parents, t);
626
627 return (gn);
628}
629
630/*-
631 *-----------------------------------------------------------------------

--- 21 unchanged lines hidden (view full) ---

653
654 if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
655 Lst_IsEmpty(gn->children))
656 {
657 Suff *s, *t;
658
659 (void)SuffParseTransform(gn->name, &s, &t);
660
661 DEBUGF(SUFF, "deleting transformation from `%s' to `%s'\n",
662 s->name, t->name);
661 DEBUGF(SUFF, ("deleting transformation from `%s' to `%s'\n",
662 s->name, t->name));
663
664 /*
665 * Remove the source from the target's children list. We check for a
666 * NULL return to handle a beanhead saying something like
667 * .c.o .c.o:
668 *
669 * We'll be called twice when the next target is seen, but .c and .o
670 * are only linked once...
671 */
672 SuffRemove(t->children, s);
673
674 /*
675 * Remove the target from the source's parents list
676 */
677 SuffRemove(s->parents, t);
678 } else if (gn->type & OP_TRANSFORM) {
663
664 /*
665 * Remove the source from the target's children list. We check for a
666 * NULL return to handle a beanhead saying something like
667 * .c.o .c.o:
668 *
669 * We'll be called twice when the next target is seen, but .c and .o
670 * are only linked once...
671 */
672 SuffRemove(t->children, s);
673
674 /*
675 * Remove the target from the source's parents list
676 */
677 SuffRemove(s->parents, t);
678 } else if (gn->type & OP_TRANSFORM) {
679 DEBUGF(SUFF, "transformation %s complete\n", gn->name);
679 DEBUGF(SUFF, ("transformation %s complete\n", gn->name));
680 }
681
682 return(dummy ? 0 : 0);
683}
684
685/*-
686 *-----------------------------------------------------------------------
687 * SuffRebuildGraph --

--- 457 unchanged lines hidden (view full) ---

1145 Src *rs; /* returned Src */
1146 char *ptr;
1147
1148 rs = (Src *) NULL;
1149
1150 while (!Lst_IsEmpty (srcs)) {
1151 s = (Src *) Lst_DeQueue (srcs);
1152
680 }
681
682 return(dummy ? 0 : 0);
683}
684
685/*-
686 *-----------------------------------------------------------------------
687 * SuffRebuildGraph --

--- 457 unchanged lines hidden (view full) ---

1145 Src *rs; /* returned Src */
1146 char *ptr;
1147
1148 rs = (Src *) NULL;
1149
1150 while (!Lst_IsEmpty (srcs)) {
1151 s = (Src *) Lst_DeQueue (srcs);
1152
1153 DEBUGF(SUFF, "\ttrying %s...", s->file);
1153 DEBUGF(SUFF, ("\ttrying %s...", s->file));
1154
1155 /*
1156 * A file is considered to exist if either a node exists in the
1157 * graph for it or the file actually exists.
1158 */
1159 if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) {
1160#ifdef DEBUG_SRC
1161 printf("remove %x from %x\n", s, srcs);

--- 6 unchanged lines hidden (view full) ---

1168 rs = s;
1169#ifdef DEBUG_SRC
1170 printf("remove %x from %x\n", s, srcs);
1171#endif
1172 free(ptr);
1173 break;
1174 }
1175
1154
1155 /*
1156 * A file is considered to exist if either a node exists in the
1157 * graph for it or the file actually exists.
1158 */
1159 if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) {
1160#ifdef DEBUG_SRC
1161 printf("remove %x from %x\n", s, srcs);

--- 6 unchanged lines hidden (view full) ---

1168 rs = s;
1169#ifdef DEBUG_SRC
1170 printf("remove %x from %x\n", s, srcs);
1171#endif
1172 free(ptr);
1173 break;
1174 }
1175
1176 DEBUGF(SUFF, "not there\n");
1176 DEBUGF(SUFF, ("not there\n"));
1177
1178 SuffAddLevel (srcs, s);
1179 Lst_AtEnd(slst, (void *) s);
1180 }
1181
1182 if (rs) {
1177
1178 SuffAddLevel (srcs, s);
1179 Lst_AtEnd(slst, (void *) s);
1180 }
1181
1182 if (rs) {
1183 DEBUGF(SUFF, "got it\n");
1183 DEBUGF(SUFF, ("got it\n"));
1184 }
1185 return (rs);
1186}
1187
1188/*-
1189 *-----------------------------------------------------------------------
1190 * SuffFindCmds --
1191 * See if any of the children of the target in the Src structure is

--- 69 unchanged lines hidden (view full) ---

1261 ret->children = 0;
1262 targ->children += 1;
1263#ifdef DEBUG_SRC
1264 ret->cp = Lst_Init(FALSE);
1265 printf("3 add %x %x\n", targ, ret);
1266 Lst_AtEnd(targ->cp, (void *) ret);
1267#endif
1268 Lst_AtEnd(slst, (void *) ret);
1184 }
1185 return (rs);
1186}
1187
1188/*-
1189 *-----------------------------------------------------------------------
1190 * SuffFindCmds --
1191 * See if any of the children of the target in the Src structure is

--- 69 unchanged lines hidden (view full) ---

1261 ret->children = 0;
1262 targ->children += 1;
1263#ifdef DEBUG_SRC
1264 ret->cp = Lst_Init(FALSE);
1265 printf("3 add %x %x\n", targ, ret);
1266 Lst_AtEnd(targ->cp, (void *) ret);
1267#endif
1268 Lst_AtEnd(slst, (void *) ret);
1269 DEBUGF(SUFF, "\tusing existing source %s\n", s->name);
1269 DEBUGF(SUFF, ("\tusing existing source %s\n", s->name));
1270 return (ret);
1271 }
1272 }
1273 }
1274 }
1275 Lst_Close (t->children);
1276 return ((Src *)NULL);
1277}

--- 34 unchanged lines hidden (view full) ---

1312
1313 /*
1314 * First do variable expansion -- this takes precedence over
1315 * wildcard expansion. If the result contains wildcards, they'll be gotten
1316 * to later since the resulting words are tacked on to the end of
1317 * the children list.
1318 */
1319 if (strchr(cgn->name, '$') != (char *)NULL) {
1270 return (ret);
1271 }
1272 }
1273 }
1274 }
1275 Lst_Close (t->children);
1276 return ((Src *)NULL);
1277}

--- 34 unchanged lines hidden (view full) ---

1312
1313 /*
1314 * First do variable expansion -- this takes precedence over
1315 * wildcard expansion. If the result contains wildcards, they'll be gotten
1316 * to later since the resulting words are tacked on to the end of
1317 * the children list.
1318 */
1319 if (strchr(cgn->name, '$') != (char *)NULL) {
1320 DEBUGF(SUFF, "Expanding \"%s\"...", cgn->name);
1320 DEBUGF(SUFF, ("Expanding \"%s\"...", cgn->name));
1321 cp = Var_Subst(NULL, cgn->name, pgn, TRUE);
1322
1323 if (cp != (char *)NULL) {
1324 Lst members = Lst_Init(FALSE);
1325
1326 if (cgn->type & OP_ARCHV) {
1327 /*
1328 * Node was an archive(member) target, so we want to call

--- 72 unchanged lines hidden (view full) ---

1401 cp = initcp;
1402 }
1403 /*
1404 * Add all elements of the members list to the parent node.
1405 */
1406 while(!Lst_IsEmpty(members)) {
1407 gn = (GNode *)Lst_DeQueue(members);
1408
1321 cp = Var_Subst(NULL, cgn->name, pgn, TRUE);
1322
1323 if (cp != (char *)NULL) {
1324 Lst members = Lst_Init(FALSE);
1325
1326 if (cgn->type & OP_ARCHV) {
1327 /*
1328 * Node was an archive(member) target, so we want to call

--- 72 unchanged lines hidden (view full) ---

1401 cp = initcp;
1402 }
1403 /*
1404 * Add all elements of the members list to the parent node.
1405 */
1406 while(!Lst_IsEmpty(members)) {
1407 gn = (GNode *)Lst_DeQueue(members);
1408
1409 DEBUGF(SUFF, "%s...", gn->name);
1409 DEBUGF(SUFF, ("%s...", gn->name));
1410 if (Lst_Member(pgn->children, (void *)gn) == NULL) {
1411 (void)Lst_Append(pgn->children, prevLN, (void *)gn);
1412 prevLN = Lst_Succ(prevLN);
1413 (void)Lst_AtEnd(gn->parents, (void *)pgn);
1414 pgn->unmade++;
1415 }
1416 }
1417 Lst_Destroy(members, NOFREE);

--- 4 unchanged lines hidden (view full) ---

1422 }
1423 /*
1424 * Now the source is expanded, remove it from the list of children to
1425 * keep it from being processed.
1426 */
1427 ln = Lst_Member(pgn->children, (void *)cgn);
1428 pgn->unmade--;
1429 Lst_Remove(pgn->children, ln);
1410 if (Lst_Member(pgn->children, (void *)gn) == NULL) {
1411 (void)Lst_Append(pgn->children, prevLN, (void *)gn);
1412 prevLN = Lst_Succ(prevLN);
1413 (void)Lst_AtEnd(gn->parents, (void *)pgn);
1414 pgn->unmade++;
1415 }
1416 }
1417 Lst_Destroy(members, NOFREE);

--- 4 unchanged lines hidden (view full) ---

1422 }
1423 /*
1424 * Now the source is expanded, remove it from the list of children to
1425 * keep it from being processed.
1426 */
1427 ln = Lst_Member(pgn->children, (void *)cgn);
1428 pgn->unmade--;
1429 Lst_Remove(pgn->children, ln);
1430 DEBUGF(SUFF, "\n");
1430 DEBUGF(SUFF, ("\n"));
1431 } else if (Dir_HasWildcards(cgn->name)) {
1432 Lst exp; /* List of expansions */
1433 Lst path; /* Search path along which to expand */
1434
1435 /*
1436 * Find a path along which to expand the word.
1437 *
1438 * If the word has a known suffix, use that path.
1439 * If it has no known suffix and we're allowed to use the null
1440 * suffix, use its path.
1441 * Else use the default system search path.
1442 */
1443 cp = cgn->name + strlen(cgn->name);
1444 ln = Lst_Find(sufflist, (void *)cp, SuffSuffIsSuffixP);
1445
1431 } else if (Dir_HasWildcards(cgn->name)) {
1432 Lst exp; /* List of expansions */
1433 Lst path; /* Search path along which to expand */
1434
1435 /*
1436 * Find a path along which to expand the word.
1437 *
1438 * If the word has a known suffix, use that path.
1439 * If it has no known suffix and we're allowed to use the null
1440 * suffix, use its path.
1441 * Else use the default system search path.
1442 */
1443 cp = cgn->name + strlen(cgn->name);
1444 ln = Lst_Find(sufflist, (void *)cp, SuffSuffIsSuffixP);
1445
1446 DEBUGF(SUFF, "Wildcard expanding \"%s\"...", cgn->name);
1446 DEBUGF(SUFF, ("Wildcard expanding \"%s\"...", cgn->name));
1447
1448 if (ln != NULL) {
1449 Suff *s = (Suff *)Lst_Datum(ln);
1450
1447
1448 if (ln != NULL) {
1449 Suff *s = (Suff *)Lst_Datum(ln);
1450
1451 DEBUGF(SUFF, "suffix is \"%s\"...", s->name);
1451 DEBUGF(SUFF, ("suffix is \"%s\"...", s->name));
1452 path = s->searchPath;
1453 } else {
1454 /*
1455 * Use default search path
1456 */
1457 path = dirSearchPath;
1458 }
1459

--- 4 unchanged lines hidden (view full) ---

1464 Dir_Expand(cgn->name, path, exp);
1465
1466 while (!Lst_IsEmpty(exp)) {
1467 /*
1468 * Fetch next expansion off the list and find its GNode
1469 */
1470 cp = (char *)Lst_DeQueue(exp);
1471
1452 path = s->searchPath;
1453 } else {
1454 /*
1455 * Use default search path
1456 */
1457 path = dirSearchPath;
1458 }
1459

--- 4 unchanged lines hidden (view full) ---

1464 Dir_Expand(cgn->name, path, exp);
1465
1466 while (!Lst_IsEmpty(exp)) {
1467 /*
1468 * Fetch next expansion off the list and find its GNode
1469 */
1470 cp = (char *)Lst_DeQueue(exp);
1471
1472 DEBUGF(SUFF, "%s...", cp);
1472 DEBUGF(SUFF, ("%s...", cp));
1473 gn = Targ_FindNode(cp, TARG_CREATE);
1474
1475 /*
1476 * If gn isn't already a child of the parent, make it so and
1477 * up the parent's count of unmade children.
1478 */
1479 if (Lst_Member(pgn->children, (void *)gn) == NULL) {
1480 (void)Lst_Append(pgn->children, prevLN, (void *)gn);

--- 10 unchanged lines hidden (view full) ---

1491
1492 /*
1493 * Now the source is expanded, remove it from the list of children to
1494 * keep it from being processed.
1495 */
1496 ln = Lst_Member(pgn->children, (void *)cgn);
1497 pgn->unmade--;
1498 Lst_Remove(pgn->children, ln);
1473 gn = Targ_FindNode(cp, TARG_CREATE);
1474
1475 /*
1476 * If gn isn't already a child of the parent, make it so and
1477 * up the parent's count of unmade children.
1478 */
1479 if (Lst_Member(pgn->children, (void *)gn) == NULL) {
1480 (void)Lst_Append(pgn->children, prevLN, (void *)gn);

--- 10 unchanged lines hidden (view full) ---

1491
1492 /*
1493 * Now the source is expanded, remove it from the list of children to
1494 * keep it from being processed.
1495 */
1496 ln = Lst_Member(pgn->children, (void *)cgn);
1497 pgn->unmade--;
1498 Lst_Remove(pgn->children, ln);
1499 DEBUGF(SUFF, "\n");
1499 DEBUGF(SUFF, ("\n"));
1500 }
1501
1502 return(0);
1503}
1504
1505/*-
1506 *-----------------------------------------------------------------------
1507 * SuffApplyTransform --

--- 67 unchanged lines hidden (view full) ---

1575 * called to link an OP_MEMBER and OP_ARCHV node), so return
1576 * FALSE.
1577 */
1578 return(FALSE);
1579 }
1580
1581 gn = (GNode *)Lst_Datum(ln);
1582
1500 }
1501
1502 return(0);
1503}
1504
1505/*-
1506 *-----------------------------------------------------------------------
1507 * SuffApplyTransform --

--- 67 unchanged lines hidden (view full) ---

1575 * called to link an OP_MEMBER and OP_ARCHV node), so return
1576 * FALSE.
1577 */
1578 return(FALSE);
1579 }
1580
1581 gn = (GNode *)Lst_Datum(ln);
1582
1583 DEBUGF(SUFF, "\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name);
1583 DEBUGF(SUFF, ("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name));
1584
1585 /*
1586 * Record last child for expansion purposes
1587 */
1588 ln = Lst_Last(tGn->children);
1589
1590 /*
1591 * Pass the buck to Make_HandleUse to apply the rule

--- 89 unchanged lines hidden (view full) ---

1681
1682 }
1683
1684 ms = mem->suffix;
1685 if (ms == NULL) {
1686 /*
1687 * Didn't know what it was -- use .NULL suffix if not in make mode
1688 */
1584
1585 /*
1586 * Record last child for expansion purposes
1587 */
1588 ln = Lst_Last(tGn->children);
1589
1590 /*
1591 * Pass the buck to Make_HandleUse to apply the rule

--- 89 unchanged lines hidden (view full) ---

1681
1682 }
1683
1684 ms = mem->suffix;
1685 if (ms == NULL) {
1686 /*
1687 * Didn't know what it was -- use .NULL suffix if not in make mode
1688 */
1689 DEBUGF(SUFF, "using null suffix\n");
1689 DEBUGF(SUFF, ("using null suffix\n"));
1690 ms = suffNull;
1691 }
1692
1693
1694 /*
1695 * Set the other two local variables required for this target.
1696 */
1697 Var_Set (MEMBER, name, gn);

--- 13 unchanged lines hidden (view full) ---

1711 */
1712 ln = Lst_Find(ms->parents, eoarch, SuffSuffIsSuffixP);
1713
1714 if (ln != NULL) {
1715 /*
1716 * Got one -- apply it
1717 */
1718 if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms)) {
1690 ms = suffNull;
1691 }
1692
1693
1694 /*
1695 * Set the other two local variables required for this target.
1696 */
1697 Var_Set (MEMBER, name, gn);

--- 13 unchanged lines hidden (view full) ---

1711 */
1712 ln = Lst_Find(ms->parents, eoarch, SuffSuffIsSuffixP);
1713
1714 if (ln != NULL) {
1715 /*
1716 * Got one -- apply it
1717 */
1718 if (!SuffApplyTransform(gn, mem, (Suff *)Lst_Datum(ln), ms)) {
1719 DEBUGF(SUFF, "\tNo transformation from %s -> %s\n",
1720 ms->name, ((Suff *)Lst_Datum(ln))->name);
1719 DEBUGF(SUFF, ("\tNo transformation from %s -> %s\n",
1720 ms->name, ((Suff *)Lst_Datum(ln))->name));
1721 }
1722 }
1723 }
1724
1725 /*
1726 * Replace the opening and closing parens now we've no need of the separate
1727 * pieces.
1728 */

--- 125 unchanged lines hidden (view full) ---

1854 ln = Lst_Succ(ln);
1855 }
1856 }
1857
1858 /*
1859 * Handle target of unknown suffix...
1860 */
1861 if (Lst_IsEmpty(targs) && suffNull != NULL) {
1721 }
1722 }
1723 }
1724
1725 /*
1726 * Replace the opening and closing parens now we've no need of the separate
1727 * pieces.
1728 */

--- 125 unchanged lines hidden (view full) ---

1854 ln = Lst_Succ(ln);
1855 }
1856 }
1857
1858 /*
1859 * Handle target of unknown suffix...
1860 */
1861 if (Lst_IsEmpty(targs) && suffNull != NULL) {
1862 DEBUGF(SUFF, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name);
1862 DEBUGF(SUFF, ("\tNo known suffix on %s. Using .NULL suffix\n", gn->name));
1863
1864 targ = (Src *)emalloc(sizeof (Src));
1865 targ->file = estrdup(gn->name);
1866 targ->suff = suffNull;
1867 targ->suff->refCount++;
1868 targ->node = gn;
1869 targ->parent = (Src *)NULL;
1870 targ->children = 0;

--- 4 unchanged lines hidden (view full) ---

1875
1876 /*
1877 * Only use the default suffix rules if we don't have commands
1878 * or dependencies defined for this gnode
1879 */
1880 if (Lst_IsEmpty(gn->commands) && Lst_IsEmpty(gn->children))
1881 SuffAddLevel(srcs, targ);
1882 else {
1863
1864 targ = (Src *)emalloc(sizeof (Src));
1865 targ->file = estrdup(gn->name);
1866 targ->suff = suffNull;
1867 targ->suff->refCount++;
1868 targ->node = gn;
1869 targ->parent = (Src *)NULL;
1870 targ->children = 0;

--- 4 unchanged lines hidden (view full) ---

1875
1876 /*
1877 * Only use the default suffix rules if we don't have commands
1878 * or dependencies defined for this gnode
1879 */
1880 if (Lst_IsEmpty(gn->commands) && Lst_IsEmpty(gn->children))
1881 SuffAddLevel(srcs, targ);
1882 else {
1883 DEBUGF(SUFF, "not ");
1883 DEBUGF(SUFF, ("not "));
1884 }
1885
1884 }
1885
1886 DEBUGF(SUFF, "adding suffix rules\n");
1886 DEBUGF(SUFF, ("adding suffix rules\n"));
1887
1888 (void)Lst_AtEnd(targs, (void *)targ);
1889 }
1890
1891 /*
1892 * Using the list of possible sources built up from the target suffix(es),
1893 * try and find an existing file/target that matches.
1894 */

--- 31 unchanged lines hidden (view full) ---

1926
1927 /*
1928 * Now we've got the important local variables set, expand any sources
1929 * that still contain variables or wildcards in their names.
1930 */
1931 Lst_ForEach(gn->children, SuffExpandChildren, (void *)gn);
1932
1933 if (targ == NULL) {
1887
1888 (void)Lst_AtEnd(targs, (void *)targ);
1889 }
1890
1891 /*
1892 * Using the list of possible sources built up from the target suffix(es),
1893 * try and find an existing file/target that matches.
1894 */

--- 31 unchanged lines hidden (view full) ---

1926
1927 /*
1928 * Now we've got the important local variables set, expand any sources
1929 * that still contain variables or wildcards in their names.
1930 */
1931 Lst_ForEach(gn->children, SuffExpandChildren, (void *)gn);
1932
1933 if (targ == NULL) {
1934 DEBUGF(SUFF, "\tNo valid suffix on %s\n", gn->name);
1934 DEBUGF(SUFF, ("\tNo valid suffix on %s\n", gn->name));
1935
1936sfnd_abort:
1937 /*
1938 * Deal with finding the thing on the default search path if the
1939 * node is only a source (not on the lhs of a dependency operator
1940 * or [XXX] it has neither children or commands).
1941 */
1942 if (OP_NOP(gn->type) ||

--- 226 unchanged lines hidden (view full) ---

2169 /*
2170 * If dependencies already found, no need to do it again...
2171 */
2172 return;
2173 } else {
2174 gn->type |= OP_DEPS_FOUND;
2175 }
2176
1935
1936sfnd_abort:
1937 /*
1938 * Deal with finding the thing on the default search path if the
1939 * node is only a source (not on the lhs of a dependency operator
1940 * or [XXX] it has neither children or commands).
1941 */
1942 if (OP_NOP(gn->type) ||

--- 226 unchanged lines hidden (view full) ---

2169 /*
2170 * If dependencies already found, no need to do it again...
2171 */
2172 return;
2173 } else {
2174 gn->type |= OP_DEPS_FOUND;
2175 }
2176
2177 DEBUGF(SUFF, "SuffFindDeps (%s)\n", gn->name);
2177 DEBUGF(SUFF, ("SuffFindDeps (%s)\n", gn->name));
2178
2179 if (gn->type & OP_ARCHV) {
2180 SuffFindArchiveDeps(gn, slst);
2181 } else if (gn->type & OP_LIB) {
2182 /*
2183 * If the node is a library, it is the arch module's job to find it
2184 * and set the TARGET variable accordingly. We merely provide the
2185 * search path, assuming all libraries end in ".a" (if the suffix

--- 215 unchanged lines hidden ---
2178
2179 if (gn->type & OP_ARCHV) {
2180 SuffFindArchiveDeps(gn, slst);
2181 } else if (gn->type & OP_LIB) {
2182 /*
2183 * If the node is a library, it is the arch module's job to find it
2184 * and set the TARGET variable accordingly. We merely provide the
2185 * search path, assuming all libraries end in ".a" (if the suffix

--- 215 unchanged lines hidden ---