[BACK]Return to make.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/make.c between version 1.53 and 1.54

version 1.53, 2007/11/26 22:48:18 version 1.54, 2007/11/28 09:40:08
Line 61 
Line 61 
 #include <stdio.h>  #include <stdio.h>
 #include <signal.h>  #include <signal.h>
 #include <stddef.h>  #include <stddef.h>
   #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <ohash.h>  #include <ohash.h>
 #include "config.h"  #include "config.h"
Line 94 
Line 95 
   
 static bool has_unmade_predecessor(GNode *);  static bool has_unmade_predecessor(GNode *);
 static void requeue_successors(GNode *);  static void requeue_successors(GNode *);
   static void random_setup(void);
   
   static bool randomize_queue;
   long random_delay = 0;
   
   static void
   random_setup()
   {
           randomize_queue = Var_Definedi("RANDOM_ORDER", NULL);
   
           if (Var_Definedi("RANDOM_DELAY", NULL))
                   random_delay = strtonum(Var_Value("RANDOM_DELAY"), 0, 1000,
                       NULL) * 1000000;
   
           if (randomize_queue || random_delay) {
                   unsigned int random_seed;
                   char *t;
   
                   t = Var_Value("RANDOM_SEED");
                   if (t != NULL)
                           random_seed = strtonum(t, 0, UINT_MAX, NULL);
                   else
                           random_seed = time(NULL);
                   fprintf(stderr, "RANDOM_SEED=%u\n", random_seed);
                   srandom(random_seed);
           }
   }
   
 static bool  static bool
 has_unmade_predecessor(GNode *gn)  has_unmade_predecessor(GNode *gn)
 {  {
Line 193 
Line 221 
   
         for (ln = Lst_First(&cgn->parents); ln != NULL; ln = Lst_Adv(ln)) {          for (ln = Lst_First(&cgn->parents); ln != NULL; ln = Lst_Adv(ln)) {
                 pgn = (GNode *)Lst_Datum(ln);                  pgn = (GNode *)Lst_Datum(ln);
                 pgn->unmade--;  
                 if (pgn->must_make) {                  if (pgn->must_make) {
                           pgn->unmade--;
                         if (DEBUG(MAKE))                          if (DEBUG(MAKE))
                                 printf("%s--=%d ",                                  printf("%s--=%d ",
                                     pgn->name, pgn->unmade);                                      pgn->name, pgn->unmade);
Line 217 
Line 245 
                                  */                                   */
                                 if (DEBUG(MAKE))                                  if (DEBUG(MAKE))
                                         printf("QUEUING ");                                          printf("QUEUING ");
                                 Lst_EnQueue(&toBeMade, pgn);                                  Lst_Push(&toBeMade, pgn);
                         } else if (pgn->unmade < 0) {                          } else if (pgn->unmade < 0) {
                                 Error("Child %s discovered graph cycles through %s", cgn->name, pgn->name);                                  Error("Child %s discovered graph cycles through %s", cgn->name, pgn->name);
                         }                          }
Line 238 
Line 266 
                 if (DEBUG(MAKE))                  if (DEBUG(MAKE))
                         printf(" Requeuing (%d)\n", gn->unmade);                          printf(" Requeuing (%d)\n", gn->unmade);
                 add_targets_to_make(&gn->children);                  add_targets_to_make(&gn->children);
                 Lst_EnQueue(&toBeMade, gn);                  Lst_Push(&toBeMade, gn);
                 return false;                  return false;
         }          }
         if (has_been_built(gn)) {          if (has_been_built(gn)) {
Line 306 
Line 334 
 {  {
         GNode   *gn;          GNode   *gn;
   
         while (!Job_Full() && (gn = (GNode *)Lst_DeQueue(&toBeMade)) != NULL) {          while (!Job_Full() && (gn = (GNode *)Lst_Pop(&toBeMade)) != NULL) {
                 if (try_to_make_node(gn))                  if (try_to_make_node(gn))
                         return true;                          return true;
         }          }
Line 371 
Line 399 
         GNode *gn = (GNode *)to_addp;          GNode *gn = (GNode *)to_addp;
   
         if (!gn->must_make && !(gn->type & OP_USE))          if (!gn->must_make && !(gn->type & OP_USE))
                 Lst_EnQueue((Lst)lp, gn);                  Lst_Push((Lst)lp, gn);
 }  }
   
 static void  static void
Line 393 
Line 421 
   
         Lst_Clone(&examine, todo, NOCOPY);          Lst_Clone(&examine, todo, NOCOPY);
   
         while ((gn = (GNode *)Lst_DeQueue(&examine)) != NULL) {          while ((gn = (GNode *)Lst_Pop(&examine)) != NULL) {
                 if (gn->must_make)      /* already known */                  if (gn->must_make)      /* already known */
                         continue;                          continue;
                 gn->must_make = true;                  gn->must_make = true;
Line 421 
Line 449 
                 } else {                  } else {
                         if (DEBUG(MAKE))                          if (DEBUG(MAKE))
                                 printf("%s: queuing\n", gn->name);                                  printf("%s: queuing\n", gn->name);
                         Lst_EnQueue(&toBeMade, gn);                          Lst_Push(&toBeMade, gn);
                 }                  }
         }          }
 }  }
Line 456 
Line 484 
         bool cycle;          bool cycle;
   
         Static_Lst_Init(&toBeMade);          Static_Lst_Init(&toBeMade);
           /* wild guess at initial sizes */
         ohash_init(&targets, 10, &gnode_info);          ohash_init(&targets, 10, &gnode_info);
           if (DEBUG(PARALLEL))
                   random_setup();
   
         add_targets_to_make(targs);          add_targets_to_make(targs);
         if (queryFlag) {          if (queryFlag) {

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54