=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/usr.bin/make/main.c 1995/10/18 08:45:42 1.1 --- src/usr.bin/make/main.c 1995/12/14 03:23:33 1.2 *************** *** 1,4 **** ! /* $NetBSD: main.c,v 1.20 1995/09/27 18:42:21 jtc Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. --- 1,4 ---- ! /* $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. *************** *** 48,54 **** #if 0 static char sccsid[] = "@(#)main.c 5.25 (Berkeley) 4/1/91"; #else ! static char rcsid[] = "$NetBSD: main.c,v 1.20 1995/09/27 18:42:21 jtc Exp $"; #endif #endif /* not lint */ --- 48,54 ---- #if 0 static char sccsid[] = "@(#)main.c 5.25 (Berkeley) 4/1/91"; #else ! static char rcsid[] = "$NetBSD: main.c,v 1.23 1995/11/22 17:40:14 christos Exp $"; #endif #endif /* not lint */ *************** *** 83,93 **** #include #include #include #include #include #include #include - #include #include #if __STDC__ #include --- 83,94 ---- #include #include #include + #include #include #include + #include #include #include #include #if __STDC__ #include *************** *** 113,119 **** static Boolean noBuiltins; /* -r flag */ static Lst makefiles; /* ordered list of makefiles to read */ ! int maxJobs; /* -J argument */ static int maxLocal; /* -L argument */ Boolean compatMake; /* -B argument */ Boolean debug; /* -d flag */ --- 114,120 ---- static Boolean noBuiltins; /* -r flag */ static Lst makefiles; /* ordered list of makefiles to read */ ! int maxJobs; /* -j argument */ static int maxLocal; /* -L argument */ Boolean compatMake; /* -B argument */ Boolean debug; /* -d flag */ *************** *** 156,167 **** extern int optind; extern char *optarg; int c; optind = 1; /* since we're called more than once */ ! #ifdef notyet # define OPTFLAGS "BD:I:L:PSd:ef:ij:knqrst" #else ! # define OPTFLAGS "D:I:d:ef:ij:knqrst" #endif rearg: while((c = getopt(argc, argv, OPTFLAGS)) != EOF) { switch(c) { --- 157,169 ---- extern int optind; extern char *optarg; int c; + int forceJobs = 0; optind = 1; /* since we're called more than once */ ! #ifdef REMOTE # define OPTFLAGS "BD:I:L:PSd:ef:ij:knqrst" #else ! # define OPTFLAGS "BD:I:PSd:ef:ij:knqrst" #endif rearg: while((c = getopt(argc, argv, OPTFLAGS)) != EOF) { switch(c) { *************** *** 175,189 **** Var_Append(MAKEFLAGS, "-I", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); break; - #ifdef notyet case 'B': compatMake = TRUE; break; case 'L': maxLocal = atoi(optarg); Var_Append(MAKEFLAGS, "-L", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); break; case 'P': usePipes = FALSE; Var_Append(MAKEFLAGS, "-P", VAR_GLOBAL); --- 177,192 ---- Var_Append(MAKEFLAGS, "-I", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); break; case 'B': compatMake = TRUE; break; + #ifdef REMOTE case 'L': maxLocal = atoi(optarg); Var_Append(MAKEFLAGS, "-L", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); break; + #endif case 'P': usePipes = FALSE; Var_Append(MAKEFLAGS, "-P", VAR_GLOBAL); *************** *** 192,198 **** keepgoing = FALSE; Var_Append(MAKEFLAGS, "-S", VAR_GLOBAL); break; - #endif case 'd': { char *modules = optarg; --- 195,200 ---- *************** *** 260,266 **** --- 262,272 ---- Var_Append(MAKEFLAGS, "-i", VAR_GLOBAL); break; case 'j': + forceJobs = TRUE; maxJobs = atoi(optarg); + #ifndef REMOTE + maxLocal = maxJobs; + #endif Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); break; *************** *** 295,300 **** --- 301,313 ---- } } + /* + * Be compatible if user did not specify -j and did not explicitly + * turned compatibility on + */ + if (!compatMake && !forceJobs) + compatMake = TRUE; + oldVars = TRUE; /* *************** *** 384,390 **** --- 397,416 ---- struct utsname utsname; 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... * All this code is so that we know where we are when we start up * on a different machine with pmake. *************** *** 416,422 **** * MACHINE_ARCH is always known at compile time. */ if (!machine) { ! if (uname(&utsname)) { perror("make: uname"); exit(2); } --- 442,448 ---- * MACHINE_ARCH is always known at compile time. */ if (!machine) { ! if (uname(&utsname) == -1) { perror("make: uname"); exit(2); } *************** *** 491,503 **** debug = 0; /* No debug verbosity, please. */ jobsRunning = FALSE; - maxJobs = DEFMAXJOBS; /* Set default max concurrency */ maxLocal = DEFMAXLOCAL; /* Set default local max concurrency */ ! #ifdef notyet ! compatMake = FALSE; /* No compat mode */ #else ! compatMake = TRUE; /* No compat mode */ #endif /* --- 517,529 ---- debug = 0; /* No debug verbosity, please. */ jobsRunning = FALSE; maxLocal = DEFMAXLOCAL; /* Set default local max concurrency */ ! #ifdef REMOTE ! maxJobs = DEFMAXJOBS; /* Set default max concurrency */ #else ! maxJobs = maxLocal; #endif + compatMake = FALSE; /* No compat mode */ /* *************** *** 657,666 **** else targs = Targ_FindList(create, TARG_CREATE); - /* - * this was original amMake -- want to allow parallelism, so put this - * back in, eventually. - */ if (!compatMake) { /* * Initialize job module before traversing the graph, now that --- 683,688 ---- *************** *** 934,939 **** --- 956,981 ---- { (void)fprintf(stderr, "make: %s.\n", strerror(errno)); 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); } /*