install correct aliases file
[unix-history] / usr / src / usr.sbin / config / mkmakefile.c
index 6f4fd54..f99b466 100644 (file)
@@ -1,12 +1,23 @@
 /*
  * Copyright (c) 1980 Regents of the University of California.
 /*
  * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)mkmakefile.c       5.5 (Berkeley) %G%";
-#endif not lint
+static char sccsid[] = "@(#)mkmakefile.c       5.21 (Berkeley) %G%";
+#endif /* not lint */
 
 /*
  * Build the makefile for the system, from
 
 /*
  * Build the makefile for the system, from
@@ -84,6 +95,15 @@ new_fent()
 }
 
 char   *COPTS;
 }
 
 char   *COPTS;
+static struct users {
+       int     u_default;
+       int     u_min;
+       int     u_max;
+} users[] = {
+       { 24, 8, 1024 },                /* MACHINE_VAX */
+       { 4, 2, 128 },                  /* MACHINE_TAHOE */
+};
+#define        NUSERS  (sizeof (users) / sizeof (users[0]))
 
 /*
  * Build the makefile from the skeleton
 
 /*
  * Build the makefile from the skeleton
@@ -93,6 +113,7 @@ makefile()
        FILE *ifp, *ofp;
        char line[BUFSIZ];
        struct opt *op;
        FILE *ifp, *ofp;
        char line[BUFSIZ];
        struct opt *op;
+       struct users *up;
 
        read_files();
        strcpy(line, "../conf/Makefile.");
 
        read_files();
        strcpy(line, "../conf/Makefile.");
@@ -126,18 +147,23 @@ makefile()
        fprintf(ofp, "\n");
        if (hadtz == 0)
                printf("timezone not specified; gmt assumed\n");
        fprintf(ofp, "\n");
        if (hadtz == 0)
                printf("timezone not specified; gmt assumed\n");
-#ifdef vax
+       if ((unsigned)machine > NUSERS) {
+               printf("maxusers config info isn't present, using vax\n");
+               up = &users[MACHINE_VAX-1];
+       } else
+               up = &users[machine-1];
        if (maxusers == 0) {
        if (maxusers == 0) {
-               printf("maxusers not specified; 24 assumed\n");
-               maxusers = 24;
-       } else if (maxusers < 8) {
-               printf("minimum of 8 maxusers assumed\n");
-               maxusers = 8;
-       } else if (maxusers > 1024)
-               printf("warning: maxusers > 1024 (%d)\n", maxusers);
-#endif
+               printf("maxusers not specified; %d assumed\n", up->u_default);
+               maxusers = up->u_default;
+       } else if (maxusers < up->u_min) {
+               printf("minimum of %d maxusers assumed\n", up->u_min);
+               maxusers = up->u_min;
+       } else if (maxusers > up->u_max)
+               printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers);
        fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d\n",
            timezone, dst, maxusers);
        fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d\n",
            timezone, dst, maxusers);
+       for (op = mkopt; op; op = op->op_next)
+               fprintf(ofp, "%s=%s\n", op->op_name, op->op_value);
        while (fgets(line, BUFSIZ, ifp) != 0) {
                if (*line == '%')
                        goto percent;
        while (fgets(line, BUFSIZ, ifp) != 0) {
                if (*line == '%')
                        goto percent;
@@ -373,7 +399,7 @@ do_objs(fp)
                for (fl = conf_list; fl; fl = fl->f_next) {
                        if (fl->f_type != SWAPSPEC)
                                continue;
                for (fl = conf_list; fl; fl = fl->f_next) {
                        if (fl->f_type != SWAPSPEC)
                                continue;
-                       sprintf(swapname, "swap%s.c", fl->f_fn);
+                       (void) sprintf(swapname, "swap%s.c", fl->f_fn);
                        if (eq(sp, swapname))
                                goto cont;
                }
                        if (eq(sp, swapname))
                                goto cont;
                }
@@ -397,23 +423,37 @@ cont:
 do_cfiles(fp)
        FILE *fp;
 {
 do_cfiles(fp)
        FILE *fp;
 {
-       register struct file_list *tp;
+       register struct file_list *tp, *fl;
        register int lpos, len;
        register int lpos, len;
+       char swapname[32];
 
 
-       fprintf(fp, "CFILES=");
+       fputs("CFILES=", fp);
        lpos = 8;
        lpos = 8;
-       for (tp = ftab; tp != 0; tp = tp->f_next) {
-               if (tp->f_type == INVISIBLE)
-                       continue;
-               if (tp->f_fn[strlen(tp->f_fn)-1] != 'c')
-                       continue;
-               if ((len = 3 + strlen(tp->f_fn)) + lpos > 72) {
-                       lpos = 8;
-                       fprintf(fp, "\\\n\t");
+       for (tp = ftab; tp; tp = tp->f_next)
+               if (tp->f_type != INVISIBLE) {
+                       len = strlen(tp->f_fn);
+                       if (tp->f_fn[len - 1] != 'c')
+                               continue;
+                       if ((len = 3 + len) + lpos > 72) {
+                               lpos = 8;
+                               fputs("\\\n\t", fp);
+                       }
+                       fprintf(fp, "../%s ", tp->f_fn);
+                       lpos += len + 1;
+               }
+       for (fl = conf_list; fl; fl = fl->f_next)
+               if (fl->f_type == SYSTEMSPEC) {
+                       (void) sprintf(swapname, "swap%s.c", fl->f_fn);
+                       if ((len = 3 + strlen(swapname)) + lpos > 72) {
+                               lpos = 8;
+                               fputs("\\\n\t", fp);
+                       }
+                       if (eq(fl->f_fn, "generic"))
+                               fprintf(fp, "../%s/%s ", machinename, swapname);
+                       else
+                               fprintf(fp, "%s ", swapname);
+                       lpos += len + 1;
                }
                }
-               fprintf(fp, "../%s ", tp->f_fn);
-               lpos += len + 1;
-       }
        if (lpos != 8)
                putc('\n', fp);
 }
        if (lpos != 8)
                putc('\n', fp);
 }
@@ -451,7 +491,7 @@ for (ftp = ftab; ftp != 0; ftp = ftp->f_next) {
        och = *cp;
        *cp = '\0';
        if (och == 'o') {
        och = *cp;
        *cp = '\0';
        if (och == 'o') {
-               fprintf(f, "%so:\n\t-cp ../%so .\n", tail(np), np);
+               fprintf(f, "%so:\n\t-cp ../%so .\n\n", tail(np), np);
                continue;
        }
        fprintf(f, "%so: ../%s%c\n", tail(np), np, och);
                continue;
        }
        fprintf(f, "%so: ../%s%c\n", tail(np), np, och);
@@ -473,14 +513,13 @@ for (ftp = ftab; ftp != 0; ftp = ftp->f_next) {
                switch (machine) {
 
                case MACHINE_VAX:
                switch (machine) {
 
                case MACHINE_VAX:
+               case MACHINE_TAHOE:
                        fprintf(f, "\t${CC} -c -S ${COPTS} %s../%sc\n",
                                extras, np);
                        fprintf(f, "\t${CC} -c -S ${COPTS} %s../%sc\n",
                                extras, np);
-                       fprintf(f, "\t${C2} %ss | ../%s/inline/inline |",
-                           tp, machinename);
-                       fprintf(f, " ${AS} -o %so\n", tp);
+                       fprintf(f, "\t${C2} %ss | ${INLINE} | ${AS} -o %so\n",
+                           tp, tp);
                        fprintf(f, "\trm -f %ss\n\n", tp);
                        break;
                        fprintf(f, "\trm -f %ss\n\n", tp);
                        break;
-
                }
                break;
 
                }
                break;
 
@@ -488,14 +527,13 @@ for (ftp = ftab; ftp != 0; ftp = ftp->f_next) {
                switch (machine) {
 
                case MACHINE_VAX:
                switch (machine) {
 
                case MACHINE_VAX:
+               case MACHINE_TAHOE:
                        fprintf(f, "\t${CC} -c -S ${COPTS} %s../%sc\n",
                                extras, np);
                        fprintf(f, "\t${CC} -c -S ${COPTS} %s../%sc\n",
                                extras, np);
-                       fprintf(f,"\t${C2} -i %ss | ../%s/inline/inline |",
-                           tp, machinename);
-                       fprintf(f, " ${AS} -o %so\n", tp);
+                       fprintf(f,"\t${C2} -i %ss | ${INLINE} | ${AS} -o %so\n",
+                           tp, tp);
                        fprintf(f, "\trm -f %ss\n\n", tp);
                        break;
                        fprintf(f, "\trm -f %ss\n\n", tp);
                        break;
-
                }
                break;
 
                }
                break;
 
@@ -509,15 +547,22 @@ for (ftp = ftab; ftp != 0; ftp = ftp->f_next) {
                }
                switch (machine) {
 
                }
                switch (machine) {
 
-               case MACHINE_VAX:
+               case MACHINE_TAHOE:
                        fprintf(f, "\t${CC} -c -S %s %s../%sc\n",
                                COPTS, extras, np);
                        fprintf(f, "\tex - %ss < ${GPROF.EX}\n", tp);
                        fprintf(f, "\t${CC} -c -S %s %s../%sc\n",
                                COPTS, extras, np);
                        fprintf(f, "\tex - %ss < ${GPROF.EX}\n", tp);
-                       fprintf(f, "\t../%s/inline/inline %ss | ${AS} -o %so\n",
-                           machinename, tp, tp);
+                       fprintf(f,"\t${C2} %ss | ${INLINE} | ${AS} -o %so\n",
+                           tp, tp);
                        fprintf(f, "\trm -f %ss\n\n", tp);
                        break;
 
                        fprintf(f, "\trm -f %ss\n\n", tp);
                        break;
 
+               case MACHINE_VAX:
+                       fprintf(f, "\t${CC} -c -S %s %s../%sc\n",
+                               COPTS, extras, np);
+                       fprintf(f, "\tex - %ss < ${GPROF.EX}\n", tp);
+                       fprintf(f, "\t${INLINE} %ss | ${AS} -o %so\n", tp, tp);
+                       fprintf(f, "\trm -f %ss\n\n", tp);
+                       break;
                }
                break;
 
                }
                break;
 
@@ -536,24 +581,17 @@ do_load(f)
        register FILE *f;
 {
        register struct file_list *fl;
        register FILE *f;
 {
        register struct file_list *fl;
-       int first = 1;
+       register int first;
        struct file_list *do_systemspec();
 
        struct file_list *do_systemspec();
 
-       fl = conf_list;
-       while (fl) {
-               if (fl->f_type != SYSTEMSPEC) {
-                       fl = fl->f_next;
-                       continue;
-               }
-               fl = do_systemspec(f, fl, first);
-               if (first)
-                       first = 0;
-       }
-       fprintf(f, "all:");
-       for (fl = conf_list; fl != 0; fl = fl->f_next)
+       for (first = 1, fl = conf_list; fl; first = 0)
+               fl = fl->f_type == SYSTEMSPEC ?
+                       do_systemspec(f, fl, first) : fl->f_next;
+       fputs("all:", f);
+       for (fl = conf_list; fl; fl = fl->f_next)
                if (fl->f_type == SYSTEMSPEC)
                        fprintf(f, " %s", fl->f_needs);
                if (fl->f_type == SYSTEMSPEC)
                        fprintf(f, " %s", fl->f_needs);
-       fprintf(f, "\n");
+       putc('\n', f);
 }
 
 struct file_list *
 }
 
 struct file_list *
@@ -563,10 +601,14 @@ do_systemspec(f, fl, first)
        int first;
 {
 
        int first;
 {
 
-       fprintf(f, "%s: Makefile", fl->f_needs);
+       fprintf(f, "%s: Makefile ../machine/symbols.sort", fl->f_needs);
        if (machine == MACHINE_VAX)
        if (machine == MACHINE_VAX)
-               fprintf(f, " ../%s/inline/inline", machinename);
-       fprintf(f, " locore.o ${OBJS} param.o ioconf.o swap%s.o\n", fl->f_fn);
+               fprintf(f, " ${INLINECMD} locore.o emulate.o");
+       else if (machine == MACHINE_TAHOE)
+               fprintf(f, " ${INLINE} locore.o");
+       else
+               fprintf(f, " locore.o");
+       fprintf(f, " ${OBJS} param.o ioconf.o swap%s.o\n", fl->f_fn);
        fprintf(f, "\t@echo loading %s\n\t@rm -f %s\n",
            fl->f_needs, fl->f_needs);
        if (first) {
        fprintf(f, "\t@echo loading %s\n\t@rm -f %s\n",
            fl->f_needs, fl->f_needs);
        if (first) {
@@ -578,10 +620,16 @@ do_systemspec(f, fl, first)
        case MACHINE_VAX:
                fprintf(f, "\t@${LD} -n -o %s -e start -x -T 80000000 ",
                        fl->f_needs);
        case MACHINE_VAX:
                fprintf(f, "\t@${LD} -n -o %s -e start -x -T 80000000 ",
                        fl->f_needs);
+               fprintf(f,
+                   "locore.o emulate.o ${OBJS} vers.o ioconf.o param.o ");
                break;
 
                break;
 
+       case MACHINE_TAHOE:
+               fprintf(f, "\t@${LD} -n -o %s -e start -x -T C0000800 ",
+                       fl->f_needs);
+               fprintf(f, "locore.o ${OBJS} vers.o ioconf.o param.o ");
+               break;
        }
        }
-       fprintf(f, "locore.o ${OBJS} vers.o ioconf.o param.o ");
        fprintf(f, "swap%s.o\n", fl->f_fn);
        fprintf(f, "\t@echo rearranging symbols\n");
        fprintf(f, "\t@-symorder ../%s/symbols.sort %s\n",
        fprintf(f, "swap%s.o\n", fl->f_fn);
        fprintf(f, "\t@echo rearranging symbols\n");
        fprintf(f, "\t@-symorder ../%s/symbols.sort %s\n",
@@ -608,14 +656,13 @@ do_swapspec(f, name)
        switch (machine) {
 
        case MACHINE_VAX:
        switch (machine) {
 
        case MACHINE_VAX:
+       case MACHINE_TAHOE:
                fprintf(f, "\t${CC} -c -S ${COPTS} ");
                fprintf(f, "../%s/swapgeneric.c\n", machinename);
                fprintf(f, "\t${CC} -c -S ${COPTS} ");
                fprintf(f, "../%s/swapgeneric.c\n", machinename);
-               fprintf(f, "\t${C2} swapgeneric.s | ");
-               fprintf(f, "../%s/inline/inline", machinename);
+               fprintf(f, "\t${C2} swapgeneric.s | ${INLINE}");
                fprintf(f, " | ${AS} -o swapgeneric.o\n");
                fprintf(f, "\trm -f swapgeneric.s\n\n");
                break;
                fprintf(f, " | ${AS} -o swapgeneric.o\n");
                fprintf(f, "\trm -f swapgeneric.s\n\n");
                break;
-
        }
 }
 
        }
 }