[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.1 and 1.2

version 1.1, 1995/10/18 08:45:42 version 1.2, 1995/12/14 03:23:33
Line 1 
Line 1 
 /*      $NetBSD: main.c,v 1.20 1995/09/27 18:42:21 jtc Exp $    */  /*      $NetBSD: main.c,v 1.23 1995/11/22 17:40:14 christos Exp $       */
   
 /*  /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.   * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
Line 48 
Line 48 
 #if 0  #if 0
 static char sccsid[] = "@(#)main.c      5.25 (Berkeley) 4/1/91";  static char sccsid[] = "@(#)main.c      5.25 (Berkeley) 4/1/91";
 #else  #else
 static char rcsid[] = "$NetBSD: main.c,v 1.20 1995/09/27 18:42:21 jtc Exp $";  static char rcsid[] = "$NetBSD: main.c,v 1.23 1995/11/22 17:40:14 christos Exp $";
 #endif  #endif
 #endif /* not lint */  #endif /* not lint */
   
Line 83 
Line 83 
 #include <sys/time.h>  #include <sys/time.h>
 #include <sys/param.h>  #include <sys/param.h>
 #include <sys/resource.h>  #include <sys/resource.h>
   #include <sys/signal.h>
 #include <sys/stat.h>  #include <sys/stat.h>
 #include <sys/utsname.h>  #include <sys/utsname.h>
   #include <sys/resource.h>
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <signal.h>  
 #include <stdio.h>  #include <stdio.h>
 #if __STDC__  #if __STDC__
 #include <stdarg.h>  #include <stdarg.h>
Line 113 
Line 114 
   
 static Boolean          noBuiltins;     /* -r flag */  static Boolean          noBuiltins;     /* -r flag */
 static Lst              makefiles;      /* ordered list of makefiles to read */  static Lst              makefiles;      /* ordered list of makefiles to read */
 int                     maxJobs;        /* -J argument */  int                     maxJobs;        /* -j argument */
 static int              maxLocal;       /* -L argument */  static int              maxLocal;       /* -L argument */
 Boolean                 compatMake;     /* -B argument */  Boolean                 compatMake;     /* -B argument */
 Boolean                 debug;          /* -d flag */  Boolean                 debug;          /* -d flag */
Line 156 
Line 157 
         extern int optind;          extern int optind;
         extern char *optarg;          extern char *optarg;
         int c;          int c;
           int forceJobs = 0;
   
         optind = 1;     /* since we're called more than once */          optind = 1;     /* since we're called more than once */
 #ifdef notyet  #ifdef REMOTE
 # define OPTFLAGS "BD:I:L:PSd:ef:ij:knqrst"  # define OPTFLAGS "BD:I:L:PSd:ef:ij:knqrst"
 #else  #else
 # define OPTFLAGS "D:I:d:ef:ij:knqrst"  # define OPTFLAGS "BD:I:PSd:ef:ij:knqrst"
 #endif  #endif
 rearg:  while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {  rearg:  while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {
                 switch(c) {                  switch(c) {
Line 175 
Line 177 
                         Var_Append(MAKEFLAGS, "-I", VAR_GLOBAL);                          Var_Append(MAKEFLAGS, "-I", VAR_GLOBAL);
                         Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);                          Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
                         break;                          break;
 #ifdef notyet  
                 case 'B':                  case 'B':
                         compatMake = TRUE;                          compatMake = TRUE;
                         break;                          break;
   #ifdef REMOTE
                 case 'L':                  case 'L':
                         maxLocal = atoi(optarg);                          maxLocal = atoi(optarg);
                         Var_Append(MAKEFLAGS, "-L", VAR_GLOBAL);                          Var_Append(MAKEFLAGS, "-L", VAR_GLOBAL);
                         Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);                          Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
                         break;                          break;
   #endif
                 case 'P':                  case 'P':
                         usePipes = FALSE;                          usePipes = FALSE;
                         Var_Append(MAKEFLAGS, "-P", VAR_GLOBAL);                          Var_Append(MAKEFLAGS, "-P", VAR_GLOBAL);
Line 192 
Line 195 
                         keepgoing = FALSE;                          keepgoing = FALSE;
                         Var_Append(MAKEFLAGS, "-S", VAR_GLOBAL);                          Var_Append(MAKEFLAGS, "-S", VAR_GLOBAL);
                         break;                          break;
 #endif  
                 case 'd': {                  case 'd': {
                         char *modules = optarg;                          char *modules = optarg;
   
Line 260 
Line 262 
                         Var_Append(MAKEFLAGS, "-i", VAR_GLOBAL);                          Var_Append(MAKEFLAGS, "-i", VAR_GLOBAL);
                         break;                          break;
                 case 'j':                  case 'j':
                           forceJobs = TRUE;
                         maxJobs = atoi(optarg);                          maxJobs = atoi(optarg);
   #ifndef REMOTE
                           maxLocal = maxJobs;
   #endif
                         Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);                          Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);
                         Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);                          Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL);
                         break;                          break;
Line 295 
Line 301 
                 }                  }
         }          }
   
           /*
            * Be compatible if user did not specify -j and did not explicitly
            * turned compatibility on
            */
           if (!compatMake && !forceJobs)
                   compatMake = TRUE;
   
         oldVars = TRUE;          oldVars = TRUE;
   
         /*          /*
Line 384 
Line 397 
         struct utsname utsname;          struct utsname utsname;
         char *machine = getenv("MACHINE");          char *machine = getenv("MACHINE");
   
   #ifdef RLIMIT_NOFILE
         /*          /*
            * get rid of resource limit on file descriptors
            */
           {
                   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
           /*
          * Find where we are and take care of PWD for the automounter...           * Find where we are and take care of PWD for the automounter...
          * All this code is so that we know where we are when we start up           * All this code is so that we know where we are when we start up
          * on a different machine with pmake.           * on a different machine with pmake.
Line 416 
Line 442 
          * MACHINE_ARCH is always known at compile time.           * MACHINE_ARCH is always known at compile time.
          */           */
         if (!machine) {          if (!machine) {
             if (uname(&utsname)) {              if (uname(&utsname) == -1) {
                     perror("make: uname");                      perror("make: uname");
                     exit(2);                      exit(2);
             }              }
Line 491 
Line 517 
         debug = 0;                      /* No debug verbosity, please. */          debug = 0;                      /* No debug verbosity, please. */
         jobsRunning = FALSE;          jobsRunning = FALSE;
   
         maxJobs = DEFMAXJOBS;           /* Set default max concurrency */  
         maxLocal = DEFMAXLOCAL;         /* Set default local max concurrency */          maxLocal = DEFMAXLOCAL;         /* Set default local max concurrency */
 #ifdef notyet  #ifdef REMOTE
         compatMake = FALSE;             /* No compat mode */          maxJobs = DEFMAXJOBS;           /* Set default max concurrency */
 #else  #else
         compatMake = TRUE;              /* No compat mode */          maxJobs = maxLocal;
 #endif  #endif
           compatMake = FALSE;             /* No compat mode */
   
   
         /*          /*
Line 657 
Line 683 
         else          else
                 targs = Targ_FindList(create, TARG_CREATE);                  targs = Targ_FindList(create, TARG_CREATE);
   
 /*  
  * this was original amMake -- want to allow parallelism, so put this  
  * back in, eventually.  
  */  
         if (!compatMake) {          if (!compatMake) {
                 /*                  /*
                  * Initialize job module before traversing the graph, now that                   * Initialize job module before traversing the graph, now that
Line 934 
Line 956 
 {  {
         (void)fprintf(stderr, "make: %s.\n", strerror(errno));          (void)fprintf(stderr, "make: %s.\n", strerror(errno));
         exit(2);          exit(2);
   }
   
   /*
    * enunlink --
    *      Remove a file carefully, avoiding directories.
    */
   int
   eunlink(file)
           const char *file;
   {
           struct stat st;
   
           if (lstat(file, &st) == -1)
                   return -1;
   
           if (S_ISDIR(st.st_mode)) {
                   errno = EISDIR;
                   return -1;
           }
           return unlink(file);
 }  }
   
 /*  /*

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2