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

Diff for /src/usr.bin/make/main.c between version 1.95 and 1.96

version 1.95, 2010/07/19 19:46:44 version 1.96, 2012/09/21 07:55:20
Line 49 
Line 49 
 #include "config.h"  #include "config.h"
 #include "defines.h"  #include "defines.h"
 #include "var.h"  #include "var.h"
   #include "lowparse.h"
 #include "parse.h"  #include "parse.h"
 #include "parsevar.h"  #include "parsevar.h"
 #include "dir.h"  #include "dir.h"
Line 65 
Line 66 
 #include "lst.h"  #include "lst.h"
 #include "memory.h"  #include "memory.h"
 #include "make.h"  #include "make.h"
   #include "dump.h"
   
 #ifndef PATH_MAX  #ifndef PATH_MAX
 # ifdef MAXPATHLEN  # ifdef MAXPATHLEN
Line 94 
Line 96 
 bool            touchFlag;      /* -t flag */  bool            touchFlag;      /* -t flag */
 bool            ignoreErrors;   /* -i flag */  bool            ignoreErrors;   /* -i flag */
 bool            beSilent;       /* -s flag */  bool            beSilent;       /* -s flag */
   bool            dumpData;       /* -p flag */
   
 struct dirs {  struct dirs {
         char *current;          char *current;
Line 109 
Line 112 
 static char *figure_out_MACHINE(void);  static char *figure_out_MACHINE(void);
 static char *figure_out_MACHINE_ARCH(void);  static char *figure_out_MACHINE_ARCH(void);
 static char *figure_out_MACHINE_CPU(void);  static char *figure_out_MACHINE_CPU(void);
 static void no_fd_limits(void);  
   
 static char *chdir_verify_path(const char *, struct dirs *);  static char *chdir_verify_path(const char *, struct dirs *);
 static char *concat_verify(const char *, const char *, char, struct dirs *);  static char *concat_verify(const char *, const char *, char, struct dirs *);
Line 122 
Line 124 
 static void read_makefile_list(Lst, struct dirs *);  static void read_makefile_list(Lst, struct dirs *);
 static int ReadMakefile(void *, void *);  static int ReadMakefile(void *, void *);
   
   
 static void record_option(int c, const char *arg)  static void record_option(int c, const char *arg)
 {  {
     char opt[3];      char opt[3];
Line 159 
Line 160 
         case 'n':          case 'n':
                 noExecute = true;                  noExecute = true;
                 break;                  break;
           case 'p':
                   dumpData = true;
                   break;
         case 'q':          case 'q':
                 queryFlag = true;                  queryFlag = true;
                 /* Kind of nonsensical, wot? */                  /* Kind of nonsensical, wot? */
Line 195 
Line 199 
 {  {
         int c, optend;          int c, optend;
   
 #define OPTFLAGS "BD:I:PSV:d:ef:ij:km:nqrst"  #define OPTFLAGS "BD:I:PSV:d:ef:ij:km:npqrst"
 #define OPTLETTERS "BPSiknqrst"  #define OPTLETTERS "BPSiknpqrst"
   
         optind = 1;     /* since we're called more than once */          optind = 1;     /* since we're called more than once */
         optreset = 1;          optreset = 1;
Line 242 
Line 246 
                                 case 'd':                                  case 'd':
                                         debug |= DEBUG_DIR;                                          debug |= DEBUG_DIR;
                                         break;                                          break;
                                   case 'e':
                                           debug |= DEBUG_EXPENSIVE;
                                           break;
                                 case 'f':                                  case 'f':
                                         debug |= DEBUG_FOR;                                          debug |= DEBUG_FOR;
                                         break;                                          break;
Line 259 
Line 266 
                                         debug |= DEBUG_JOB;                                          debug |= DEBUG_JOB;
                                         break;                                          break;
                                 case 'J':                                  case 'J':
                                         debug |= DEBUG_JOBBANNER;                                          /* ignore */
                                         break;                                          break;
                                 case 'l':                                  case 'l':
                                         debug |= DEBUG_LOUD;                                          debug |= DEBUG_LOUD;
Line 273 
Line 280 
                                 case 'p':                                  case 'p':
                                         debug |= DEBUG_PARALLEL;                                          debug |= DEBUG_PARALLEL;
                                         break;                                          break;
                                   case 'q':
                                           debug |= DEBUG_QUICKDEATH;
                                           break;
                                 case 's':                                  case 's':
                                         debug |= DEBUG_SUFF;                                          debug |= DEBUG_SUFF;
                                         break;                                          break;
Line 460 
Line 470 
         return r;          return r;
 }  }
   
 /* get rid of resource limit on file descriptors */  
 static void  
 no_fd_limits()  
 {  
 #ifdef RLIMIT_NOFILE  
         struct rlimit rl;  
         if (getrlimit(RLIMIT_NOFILE, &rl) != -1 &&  
             rl.rlim_cur != rl.rlim_max) {  
                 rl.rlim_cur = rl.rlim_max;  
                 (void)setrlimit(RLIMIT_NOFILE, &rl);  
         }  
 #endif  
 }  
   
 static char *  static char *
 figure_out_CURDIR()  figure_out_CURDIR()
 {  {
Line 676 
Line 672 
         static struct dirs d;          static struct dirs d;
         bool read_depend = true;/* false if we don't want to read .depend */          bool read_depend = true;/* false if we don't want to read .depend */
   
         no_fd_limits();  
         setup_CURDIR_OBJDIR(&d, machine);          setup_CURDIR_OBJDIR(&d, machine);
   
         esetenv("PWD", d.object);          esetenv("PWD", d.object);
Line 710 
Line 705 
                 Dir_AddDir(defaultPath, d.current);                  Dir_AddDir(defaultPath, d.current);
         Var_Set(".CURDIR", d.current);          Var_Set(".CURDIR", d.current);
         Var_Set(".OBJDIR", d.object);          Var_Set(".OBJDIR", d.object);
           Parse_setcurdir(d.current);
         Targ_setdirs(d.current, d.object);          Targ_setdirs(d.current, d.object);
   
         /*          /*
Line 788 
Line 784 
         if (DEBUG(GRAPH1))          if (DEBUG(GRAPH1))
                 Targ_PrintGraph(1);                  Targ_PrintGraph(1);
   
           if (dumpData) {
                   dump_data();
                   exit(0);
           }
         /* Print the values of any variables requested by the user.  */          /* Print the values of any variables requested by the user.  */
         if (!Lst_IsEmpty(&varstoprint)) {          if (!Lst_IsEmpty(&varstoprint)) {
                 LstNode ln;                  LstNode ln;
Line 808 
Line 808 
                 else                  else
                         Targ_FindList(&targs, create);                          Targ_FindList(&targs, create);
   
                   Job_Init(maxJobs);
                   /* If the user has defined a .BEGIN target, execute the commands
                    * attached to it.  */
                   if (!queryFlag)
                           Job_Begin();
                 if (compatMake)                  if (compatMake)
                         /* Compat_Init will take care of creating all the                          /* Compat_Init will take care of creating all the
                          * targets as well as initializing the module.  */                           * targets as well as initializing the module.  */
                         Compat_Run(&targs);                          Compat_Run(&targs);
                 else {                  else {
                         /* Initialize job module before traversing the graph,  
                          * now that any .BEGIN and .END targets have been  
                          * read. This is done only if the -q flag wasn't given  
                          * (to prevent the .BEGIN from being executed should  
                          * it exist).  */  
                         if (!queryFlag)  
                                 Job_Init(maxJobs);  
   
                         /* Traverse the graph, checking on all the targets.  */                          /* Traverse the graph, checking on all the targets.  */
                         outOfDate = Make_Run(&targs);                          outOfDate = Make_Run(&targs);
                 }                  }

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.96