=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/make.c,v retrieving revision 1.25 retrieving revision 1.26 diff -c -r1.25 -r1.26 *** src/usr.bin/make/make.c 2001/05/03 13:41:08 1.25 --- src/usr.bin/make/make.c 2001/05/23 12:34:46 1.26 *************** *** 1,5 **** /* $OpenPackages$ */ ! /* $OpenBSD: make.c,v 1.25 2001/05/03 13:41:08 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* --- 1,5 ---- /* $OpenPackages$ */ ! /* $OpenBSD: make.c,v 1.26 2001/05/23 12:34:46 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* *************** *** 47,54 **** * * Interface: * Make_Run Initialize things for the module and recreate ! * whatever needs recreating. Returns TRUE if ! * work was (or would have been) done and FALSE * otherwise. * * Make_Update Update all parents of a given child. Performs --- 47,55 ---- * * Interface: * Make_Run Initialize things for the module and recreate ! * whatever needs recreating. Returns true if ! * work was (or would have been) done and ! * false * otherwise. * * Make_Update Update all parents of a given child. Performs *************** *** 72,93 **** * and perform the .USE actions if so. */ ! #include ! #include "make.h" ! #include "ohash.h" ! #include "dir.h" ! #include "job.h" - #ifndef lint - #if 0 - static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; - #else - UNUSED - static char rcsid[] = "$OpenBSD: make.c,v 1.25 2001/05/03 13:41:08 espie Exp $"; - #endif - #endif /* not lint */ - - static LIST toBeMade; /* The current fringe of the graph. These * are nodes which await examination by * MakeOODate. It is added to by --- 73,94 ---- * and perform the .USE actions if so. */ ! #include ! #include "config.h" ! #include "defines.h" ! #include "dir.h" ! #include "job.h" ! #include "arch.h" ! #include "suff.h" ! #include "var.h" ! #include "targ.h" ! #include "error.h" ! #include "make.h" ! #include "gnode.h" ! #include "extern.h" ! #include "timestamp.h" ! #include "lst.h" static LIST toBeMade; /* The current fringe of the graph. These * are nodes which await examination by * MakeOODate. It is added to by *************** *** 95,107 **** * MakeStartJobs */ static int numNodes; /* Number of nodes to be processed. If this * is non-zero when Job_Empty() returns ! * TRUE, there's a cycle in the graph */ static void MakeAddChild(void *, void *); static void MakeAddAllSrc(void *, void *); static void MakeTimeStamp(void *, void *); static void MakeHandleUse(void *, void *); ! static Boolean MakeStartJobs(void); static void MakePrintStatus(void *, void *); /*- *----------------------------------------------------------------------- --- 96,108 ---- * MakeStartJobs */ static int numNodes; /* Number of nodes to be processed. If this * is non-zero when Job_Empty() returns ! * true, there's a cycle in the graph */ static void MakeAddChild(void *, void *); static void MakeAddAllSrc(void *, void *); static void MakeTimeStamp(void *, void *); static void MakeHandleUse(void *, void *); ! static bool MakeStartJobs(void); static void MakePrintStatus(void *, void *); /*- *----------------------------------------------------------------------- *************** *** 119,125 **** GNode *pgn; /* the current parent */ GNode *cgn; /* the child we've just examined */ { ! if (is_before(pgn->cmtime, cgn->mtime)) pgn->cmtime = cgn->mtime; } --- 120,126 ---- GNode *pgn; /* the current parent */ GNode *cgn; /* the child we've just examined */ { ! if (is_strictly_before(pgn->cmtime, cgn->mtime)) pgn->cmtime = cgn->mtime; } *************** *** 143,160 **** * will have been recreated. * * Results: ! * TRUE if the node is out of date. FALSE otherwise. * * Side Effects: * The mtime field of the node and the cmtime field of its parents * will/may be changed. *----------------------------------------------------------------------- */ ! Boolean Make_OODate(gn) GNode *gn; /* the node to check */ { ! Boolean oodate; /* * Certain types of targets needn't even be sought as their datedness --- 144,161 ---- * will have been recreated. * * Results: ! * true if the node is out of date. false otherwise. * * Side Effects: * The mtime field of the node and the cmtime field of its parents * will/may be changed. *----------------------------------------------------------------------- */ ! bool Make_OODate(gn) GNode *gn; /* the node to check */ { ! bool oodate; /* * Certain types of targets needn't even be sought as their datedness *************** *** 193,199 **** if (DEBUG(MAKE)) { printf(".USE node..."); } ! oodate = FALSE; } else if ((gn->type & OP_LIB) && Arch_IsLib(gn)) { if (DEBUG(MAKE)) { printf("library..."); --- 194,200 ---- if (DEBUG(MAKE)) { printf(".USE node..."); } ! oodate = false; } else if ((gn->type & OP_LIB) && Arch_IsLib(gn)) { if (DEBUG(MAKE)) { printf("library..."); *************** *** 228,235 **** printf(".EXEC node..."); } } ! oodate = TRUE; ! } else if (is_before(gn->mtime, gn->cmtime) || (is_out_of_date(gn->cmtime) && (is_out_of_date(gn->mtime) || (gn->type & OP_DOUBLEDEP)))) { --- 229,236 ---- printf(".EXEC node..."); } } ! oodate = true; ! } else if (is_strictly_before(gn->mtime, gn->cmtime) || (is_out_of_date(gn->cmtime) && (is_out_of_date(gn->mtime) || (gn->type & OP_DOUBLEDEP)))) { *************** *** 241,247 **** * it. */ if (DEBUG(MAKE)) { ! if (is_before(gn->mtime, gn->cmtime)) { printf("modified before source..."); } else if (is_out_of_date(gn->mtime)) { printf("non-existent and no sources..."); --- 242,248 ---- * it. */ if (DEBUG(MAKE)) { ! if (is_strictly_before(gn->mtime, gn->cmtime)) { printf("modified before source..."); } else if (is_out_of_date(gn->mtime)) { printf("non-existent and no sources..."); *************** *** 249,255 **** printf(":: operator and no sources..."); } } ! oodate = TRUE; } else { #if 0 /* WHY? */ --- 250,256 ---- printf(":: operator and no sources..."); } } ! oodate = true; } else { #if 0 /* WHY? */ *************** *** 258,264 **** } oodate = gn->childMade; #else ! oodate = FALSE; #endif /* 0 */ } --- 259,265 ---- } oodate = gn->childMade; #else ! oodate = false; #endif /* 0 */ } *************** *** 279,285 **** *----------------------------------------------------------------------- * MakeAddChild -- * Function used by Make_Run to add a child to the list l. ! * It will only add the child if its make field is FALSE. * * Side Effects: * The given list is extended --- 280,286 ---- *----------------------------------------------------------------------- * MakeAddChild -- * Function used by Make_Run to add a child to the list l. ! * It will only add the child if its make field is false. * * Side Effects: * The given list is extended *************** *** 335,341 **** for (ln = Lst_First(&cgn->children); ln != NULL; ln = Lst_Adv(ln)) { gn = (GNode *)Lst_Datum(ln); ! if (Lst_AddNew(&pgn->children, gn) == SUCCESS) { Lst_AtEnd(&gn->parents, pgn); pgn->unmade += 1; } --- 336,342 ---- for (ln = Lst_First(&cgn->children); ln != NULL; ln = Lst_Adv(ln)) { gn = (GNode *)Lst_Datum(ln); ! if (Lst_AddNew(&pgn->children, gn)) { Lst_AtEnd(&gn->parents, pgn); pgn->unmade += 1; } *************** *** 473,480 **** if ( ! (cgn->type & (OP_EXEC|OP_USE))) { if (cgn->made == MADE) { ! pgn->childMade = TRUE; ! if (is_before(pgn->cmtime, cgn->mtime)) pgn->cmtime = cgn->mtime; } else { (void)Make_TimeStamp(pgn, cgn); --- 474,481 ---- if ( ! (cgn->type & (OP_EXEC|OP_USE))) { if (cgn->made == MADE) { ! pgn->childMade = true; ! if (is_strictly_before(pgn->cmtime, cgn->mtime)) pgn->cmtime = cgn->mtime; } else { (void)Make_TimeStamp(pgn, cgn); *************** *** 558,565 **** if (cgn->made == MADE) { Varq_Append(OODATE_INDEX, child, pgn); } ! } else if (is_before(pgn->mtime, cgn->mtime) || ! (!is_before(cgn->mtime, now) && cgn->made == MADE)) { /* * It goes in the OODATE variable if the parent is younger than the --- 559,566 ---- if (cgn->made == MADE) { Varq_Append(OODATE_INDEX, child, pgn); } ! } else if (is_strictly_before(pgn->mtime, cgn->mtime) || ! (!is_strictly_before(cgn->mtime, now) && cgn->made == MADE)) { /* * It goes in the OODATE variable if the parent is younger than the *************** *** 624,637 **** * Results: * If the query flag was given to pmake, no job will be started, * but as soon as an out-of-date target is found, this function ! * returns TRUE. At all other times, this function returns FALSE. * * Side Effects: * Nodes are removed from the toBeMade queue and job table slots * are filled. *----------------------------------------------------------------------- */ ! static Boolean MakeStartJobs() { GNode *gn; --- 625,638 ---- * Results: * If the query flag was given to pmake, no job will be started, * but as soon as an out-of-date target is found, this function ! * returns true. At all other times, this function returns false. * * Side Effects: * Nodes are removed from the toBeMade queue and job table slots * are filled. *----------------------------------------------------------------------- */ ! static bool MakeStartJobs() { GNode *gn; *************** *** 674,680 **** printf("out-of-date\n"); } if (queryFlag) { ! return TRUE; } Make_DoAllVar(gn); Job_Make(gn); --- 675,681 ---- printf("out-of-date\n"); } if (queryFlag) { ! return true; } Make_DoAllVar(gn); Job_Make(gn); *************** *** 696,702 **** Make_Update(gn); } } ! return FALSE; } /*- --- 697,703 ---- Make_Update(gn); } } ! return false; } /*- *************** *** 718,729 **** * inferior */ { GNode *gn = (GNode *)gnp; ! Boolean cycle = *(Boolean *)cyclep; if (gn->made == UPTODATE) { printf("`%s' is up to date.\n", gn->name); } else if (gn->unmade != 0) { if (cycle) { ! Boolean t = TRUE; /* * If printing cycles and came to one that has unmade children, * print out the cycle by recursing on its children. Note a --- 719,730 ---- * inferior */ { GNode *gn = (GNode *)gnp; ! bool cycle = *(bool *)cyclep; if (gn->made == UPTODATE) { printf("`%s' is up to date.\n", gn->name); } else if (gn->unmade != 0) { if (cycle) { ! bool t = true; /* * If printing cycles and came to one that has unmade children, * print out the cycle by recursing on its children. Note a *************** *** 763,769 **** * possible. * * Results: ! * TRUE if work was done. FALSE otherwise. * * Side Effects: * The make field of all nodes involved in the creation of the given --- 764,770 ---- * possible. * * Results: ! * true if work was done. false otherwise. * * Side Effects: * The make field of all nodes involved in the creation of the given *************** *** 771,777 **** * 'leaves' of these subgraphs. *----------------------------------------------------------------------- */ ! Boolean Make_Run(targs) Lst targs; /* the initial list of targets */ { --- 772,778 ---- * 'leaves' of these subgraphs. *----------------------------------------------------------------------- */ ! bool Make_Run(targs) Lst targs; /* the initial list of targets */ { *************** *** 794,800 **** */ while ((gn = (GNode *)Lst_DeQueue(&examine)) != NULL) { if (!gn->make) { ! gn->make = TRUE; numNodes++; /* --- 795,801 ---- */ while ((gn = (GNode *)Lst_DeQueue(&examine)) != NULL) { if (!gn->make) { ! gn->make = true; numNodes++; /* *************** *** 855,859 **** errors = errors == 0 && numNodes != 0; Lst_ForEach(targs, MakePrintStatus, &errors); ! return TRUE; } --- 856,860 ---- errors = errors == 0 && numNodes != 0; Lst_ForEach(targs, MakePrintStatus, &errors); ! return true; }