fix swap file reference in CFILES (from mel@rockeffeller.arpa)
[unix-history] / usr / src / usr.sbin / config / mkmakefile.c
index d4009df..cd7f82b 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)mkmakefile.c       5.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkmakefile.c       5.13 (Berkeley) %G%";
 #endif not lint
 
 /*
 #endif not lint
 
 /*
@@ -412,23 +412,34 @@ 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) {
+                       sprintf(swapname, "swap%s.c", fl->f_fn);
+                       if ((len = 3 + strlen(swapname)) + lpos > 72) {
+                               lpos = 8;
+                               fputs("\\\n\t", fp);
+                       }
+                       fprintf(fp, "../%s/%s ", machinename, 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);
 }
@@ -556,24 +567,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 *
@@ -585,7 +589,7 @@ do_systemspec(f, fl, first)
 
        fprintf(f, "%s: Makefile", fl->f_needs);
        if (machine == MACHINE_VAX || machine == MACHINE_TAHOE)
 
        fprintf(f, "%s: Makefile", fl->f_needs);
        if (machine == MACHINE_VAX || machine == MACHINE_TAHOE)
-               fprintf(f, " ${INLINE}", machinename);
+               fprintf(f, " ${INLINE}");
        fprintf(f, " locore.o ${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);
        fprintf(f, " locore.o ${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);