vax's require emulate.o in dependency list (from jim mckie)
[unix-history] / usr / src / usr.sbin / config / mkmakefile.c
CommitLineData
cd68466f
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
524aa063 7#ifndef lint
22a93bf2 8static char sccsid[] = "@(#)mkmakefile.c 5.15 (Berkeley) %G%";
cd68466f 9#endif not lint
28061b3f 10
01d17851 11/*
28061b3f
BJ
12 * Build the makefile for the system, from
13 * the information in the files files and the
14 * additional files for the machine being compiled to.
01d17851
MT
15 */
16
17#include <stdio.h>
d5429061 18#include <ctype.h>
01d17851
MT
19#include "y.tab.h"
20#include "config.h"
21
28061b3f
BJ
22#define next_word(fp, wd) \
23 { register char *word = get_word(fp); \
22d68ad0
BJ
24 if (word == (char *)EOF) \
25 return; \
28061b3f
BJ
26 else \
27 wd = word; \
28 }
01d17851 29
28061b3f 30static struct file_list *fcur;
15eb15d7 31char *tail();
01d17851
MT
32
33/*
e3dad45e 34 * Lookup a file, by name.
01d17851 35 */
28061b3f
BJ
36struct file_list *
37fl_lookup(file)
38 register char *file;
01d17851 39{
28061b3f
BJ
40 register struct file_list *fp;
41
22d68ad0 42 for (fp = ftab ; fp != 0; fp = fp->f_next) {
28061b3f
BJ
43 if (eq(fp->f_fn, file))
44 return (fp);
45 }
46 return (0);
01d17851
MT
47}
48
15eb15d7
KM
49/*
50 * Lookup a file, by final component name.
51 */
52struct file_list *
53fltail_lookup(file)
54 register char *file;
55{
56 register struct file_list *fp;
57
58 for (fp = ftab ; fp != 0; fp = fp->f_next) {
59 if (eq(tail(fp->f_fn), tail(file)))
60 return (fp);
61 }
62 return (0);
63}
64
01d17851 65/*
28061b3f 66 * Make a new file list entry
01d17851 67 */
28061b3f
BJ
68struct file_list *
69new_fent()
01d17851 70{
28061b3f
BJ
71 register struct file_list *fp;
72
73 fp = (struct file_list *) malloc(sizeof *fp);
22d68ad0
BJ
74 fp->f_needs = 0;
75 fp->f_next = 0;
3c812eeb
SL
76 fp->f_flags = 0;
77 fp->f_type = 0;
22d68ad0 78 if (fcur == 0)
28061b3f
BJ
79 fcur = ftab = fp;
80 else
81 fcur->f_next = fp;
82 fcur = fp;
83 return (fp);
01d17851
MT
84}
85
28061b3f 86char *COPTS;
18d7531d
SL
87static struct users {
88 int u_default;
89 int u_min;
90 int u_max;
91} users[] = {
92 { 24, 8, 1024 }, /* MACHINE_VAX */
a0105456 93 { 4, 2, 128 }, /* MACHINE_TAHOE */
18d7531d
SL
94};
95#define NUSERS (sizeof (users) / sizeof (users[0]))
28061b3f 96
01d17851 97/*
28061b3f 98 * Build the makefile from the skeleton
01d17851 99 */
01d17851
MT
100makefile()
101{
28061b3f
BJ
102 FILE *ifp, *ofp;
103 char line[BUFSIZ];
104 struct opt *op;
18d7531d 105 struct users *up;
28061b3f
BJ
106
107 read_files();
05b83a6c 108 strcpy(line, "../conf/Makefile.");
22d68ad0 109 (void) strcat(line, machinename);
28061b3f 110 ifp = fopen(line, "r");
22d68ad0 111 if (ifp == 0) {
28061b3f
BJ
112 perror(line);
113 exit(1);
114 }
05b83a6c 115 ofp = fopen(path("Makefile"), "w");
22d68ad0 116 if (ofp == 0) {
05b83a6c 117 perror(path("Makefile"));
28061b3f
BJ
118 exit(1);
119 }
120 fprintf(ofp, "IDENT=-D%s", raise(ident));
121 if (profiling)
122 fprintf(ofp, " -DGPROF");
123 if (cputype == 0) {
124 printf("cpu type must be specified\n");
125 exit(1);
126 }
127 { struct cputype *cp;
128 for (cp = cputype; cp; cp = cp->cpu_next)
129 fprintf(ofp, " -D%s", cp->cpu_name);
130 }
131 for (op = opt; op; op = op->op_next)
132 if (op->op_value)
133 fprintf(ofp, " -D%s=\"%s\"", op->op_name, op->op_value);
134 else
135 fprintf(ofp, " -D%s", op->op_name);
136 fprintf(ofp, "\n");
137 if (hadtz == 0)
138 printf("timezone not specified; gmt assumed\n");
18d7531d
SL
139 if ((unsigned)machine > NUSERS) {
140 printf("maxusers config info isn't present, using vax\n");
141 up = &users[MACHINE_VAX-1];
142 } else
143 up = &users[machine-1];
28061b3f 144 if (maxusers == 0) {
18d7531d
SL
145 printf("maxusers not specified; %d assumed\n", up->u_default);
146 maxusers = up->u_default;
147 } else if (maxusers < up->u_min) {
148 printf("minimum of %d maxusers assumed\n", up->u_min);
149 maxusers = up->u_min;
150 } else if (maxusers > up->u_max)
151 printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers);
28061b3f
BJ
152 fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d\n",
153 timezone, dst, maxusers);
7c1d4665
MK
154 for (op = mkopt; op; op = op->op_next)
155 fprintf(ofp, "%s=%s\n", op->op_name, op->op_value);
22d68ad0 156 while (fgets(line, BUFSIZ, ifp) != 0) {
28061b3f
BJ
157 if (*line == '%')
158 goto percent;
159 if (profiling && strncmp(line, "COPTS=", 6) == 0) {
160 register char *cp;
161
0356b29c
SL
162 fprintf(ofp,
163 "GPROF.EX=/usr/src/lib/libc/%s/csu/gmon.ex\n",
164 machinename);
28061b3f
BJ
165 cp = index(line, '\n');
166 if (cp)
167 *cp = 0;
168 cp = line + 6;
169 while (*cp && (*cp == ' ' || *cp == '\t'))
170 cp++;
22d68ad0 171 COPTS = malloc((unsigned)(strlen(cp) + 1));
28061b3f 172 if (COPTS == 0) {
f2db9eb7 173 printf("config: out of memory\n");
28061b3f
BJ
174 exit(1);
175 }
176 strcpy(COPTS, cp);
177 fprintf(ofp, "%s -pg\n", line);
178 continue;
8486638c 179 }
28061b3f 180 fprintf(ofp, "%s", line);
8486638c 181 continue;
28061b3f
BJ
182 percent:
183 if (eq(line, "%OBJS\n"))
184 do_objs(ofp);
185 else if (eq(line, "%CFILES\n"))
186 do_cfiles(ofp);
187 else if (eq(line, "%RULES\n"))
188 do_rules(ofp);
189 else if (eq(line, "%LOAD\n"))
190 do_load(ofp);
191 else
192 fprintf(stderr,
193 "Unknown %% construct in generic makefile: %s",
194 line);
01d17851 195 }
73845e07
SL
196 (void) fclose(ifp);
197 (void) fclose(ofp);
01d17851
MT
198}
199
200/*
28061b3f
BJ
201 * Read in the information about files used in making the system.
202 * Store it in the ftab linked list.
01d17851 203 */
01d17851
MT
204read_files()
205{
28061b3f 206 FILE *fp;
e3dad45e 207 register struct file_list *tp, *pf;
28061b3f 208 register struct device *dp;
05b83a6c 209 register struct opt *op;
28061b3f
BJ
210 char *wd, *this, *needs, *devorprof;
211 char fname[32];
05b83a6c 212 int nreqs, first = 1, configdep, isdup;
28061b3f 213
22d68ad0
BJ
214 ftab = 0;
215 (void) strcpy(fname, "files");
28061b3f
BJ
216openit:
217 fp = fopen(fname, "r");
22d68ad0 218 if (fp == 0) {
73845e07 219 perror(fname);
28061b3f
BJ
220 exit(1);
221 }
222next:
3c812eeb
SL
223 /*
224 * filename [ standard | optional ] [ config-dependent ]
225 * [ dev* | profiling-routine ] [ device-driver]
226 */
28061b3f 227 wd = get_word(fp);
22d68ad0
BJ
228 if (wd == (char *)EOF) {
229 (void) fclose(fp);
15eb15d7 230 if (first == 1) {
22d68ad0 231 (void) sprintf(fname, "files.%s", machinename);
15eb15d7 232 first++;
28061b3f
BJ
233 goto openit;
234 }
15eb15d7
KM
235 if (first == 2) {
236 (void) sprintf(fname, "files.%s", raise(ident));
237 first++;
238 fp = fopen(fname, "r");
239 if (fp != 0)
240 goto next;
241 }
28061b3f
BJ
242 return;
243 }
22d68ad0 244 if (wd == 0)
28061b3f 245 goto next;
01d17851 246 this = ns(wd);
01d17851 247 next_word(fp, wd);
22d68ad0 248 if (wd == 0) {
f2db9eb7 249 printf("%s: No type for %s.\n",
28061b3f
BJ
250 fname, this);
251 exit(1);
01d17851 252 }
e3dad45e 253 if ((pf = fl_lookup(this)) && (pf->f_type != INVISIBLE || pf->f_flags))
05b83a6c
MK
254 isdup = 1;
255 else
256 isdup = 0;
15eb15d7
KM
257 tp = 0;
258 if (first == 3 && (tp = fltail_lookup(this)) != 0)
259 printf("%s: Local file %s overrides %s.\n",
260 fname, this, tp->f_fn);
28061b3f
BJ
261 nreqs = 0;
262 devorprof = "";
3c812eeb 263 configdep = 0;
28061b3f
BJ
264 needs = 0;
265 if (eq(wd, "standard"))
266 goto checkdev;
267 if (!eq(wd, "optional")) {
3c812eeb 268 printf("%s: %s must be optional or standard\n", fname, this);
28061b3f
BJ
269 exit(1);
270 }
271nextopt:
272 next_word(fp, wd);
22d68ad0 273 if (wd == 0)
28061b3f 274 goto doneopt;
3c812eeb
SL
275 if (eq(wd, "config-dependent")) {
276 configdep++;
277 goto nextopt;
278 }
28061b3f 279 devorprof = wd;
73845e07
SL
280 if (eq(wd, "device-driver") || eq(wd, "profiling-routine")) {
281 next_word(fp, wd);
28061b3f 282 goto save;
73845e07 283 }
28061b3f 284 nreqs++;
05b83a6c 285 if (needs == 0 && nreqs == 1)
28061b3f 286 needs = ns(wd);
05b83a6c
MK
287 if (isdup)
288 goto invis;
22d68ad0 289 for (dp = dtab; dp != 0; dp = dp->d_next)
28061b3f
BJ
290 if (eq(dp->d_name, wd))
291 goto nextopt;
05b83a6c
MK
292 for (op = opt; op != 0; op = op->op_next)
293 if (op->op_value == 0 && opteq(op->op_name, wd)) {
294 if (nreqs == 1) {
295 free(needs);
296 needs = 0;
297 }
298 goto nextopt;
299 }
300invis:
22d68ad0 301 while ((wd = get_word(fp)) != 0)
28061b3f 302 ;
92a477cd
MK
303 if (tp == 0)
304 tp = new_fent();
01d17851 305 tp->f_fn = this;
28061b3f
BJ
306 tp->f_type = INVISIBLE;
307 tp->f_needs = needs;
05b83a6c 308 tp->f_flags = isdup;
28061b3f 309 goto next;
3c812eeb 310
28061b3f
BJ
311doneopt:
312 if (nreqs == 0) {
f2db9eb7 313 printf("%s: what is %s optional on?\n",
28061b3f
BJ
314 fname, this);
315 exit(1);
316 }
3c812eeb 317
28061b3f
BJ
318checkdev:
319 if (wd) {
2fcca161 320 next_word(fp, wd);
3c812eeb
SL
321 if (wd) {
322 if (eq(wd, "config-dependent")) {
323 configdep++;
324 goto checkdev;
325 }
28061b3f
BJ
326 devorprof = wd;
327 next_word(fp, wd);
2fcca161 328 }
01d17851 329 }
3c812eeb 330
28061b3f 331save:
3c812eeb 332 if (wd) {
f2db9eb7 333 printf("%s: syntax error describing %s\n",
28061b3f
BJ
334 fname, this);
335 exit(1);
2fcca161 336 }
73845e07
SL
337 if (eq(devorprof, "profiling-routine") && profiling == 0)
338 goto next;
92a477cd
MK
339 if (tp == 0)
340 tp = new_fent();
28061b3f
BJ
341 tp->f_fn = this;
342 if (eq(devorprof, "device-driver"))
3c812eeb 343 tp->f_type = DRIVER;
28061b3f
BJ
344 else if (eq(devorprof, "profiling-routine"))
345 tp->f_type = PROFILING;
346 else
347 tp->f_type = NORMAL;
3c812eeb
SL
348 tp->f_flags = 0;
349 if (configdep)
350 tp->f_flags |= CONFIGDEP;
28061b3f 351 tp->f_needs = needs;
e3dad45e
MK
352 if (pf && pf->f_type == INVISIBLE)
353 pf->f_flags = 1; /* mark as duplicate */
28061b3f 354 goto next;
01d17851
MT
355}
356
05b83a6c
MK
357opteq(cp, dp)
358 char *cp, *dp;
359{
360 char c, d;
361
362 for (; ; cp++, dp++) {
363 if (*cp != *dp) {
364 c = isupper(*cp) ? tolower(*cp) : *cp;
365 d = isupper(*dp) ? tolower(*dp) : *dp;
366 if (c != d)
367 return (0);
368 }
369 if (*cp == 0)
370 return (1);
371 }
372}
373
01d17851 374do_objs(fp)
28061b3f 375 FILE *fp;
01d17851 376{
15eb15d7 377 register struct file_list *tp, *fl;
28061b3f
BJ
378 register int lpos, len;
379 register char *cp, och, *sp;
15eb15d7 380 char swapname[32];
28061b3f
BJ
381
382 fprintf(fp, "OBJS=");
383 lpos = 6;
22d68ad0 384 for (tp = ftab; tp != 0; tp = tp->f_next) {
28061b3f
BJ
385 if (tp->f_type == INVISIBLE)
386 continue;
387 sp = tail(tp->f_fn);
36edb824
SL
388 for (fl = conf_list; fl; fl = fl->f_next) {
389 if (fl->f_type != SWAPSPEC)
390 continue;
391 sprintf(swapname, "swap%s.c", fl->f_fn);
15eb15d7
KM
392 if (eq(sp, swapname))
393 goto cont;
394 }
28061b3f
BJ
395 cp = sp + (len = strlen(sp)) - 1;
396 och = *cp;
397 *cp = 'o';
398 if (len + lpos > 72) {
399 lpos = 8;
400 fprintf(fp, "\\\n\t");
401 }
402 fprintf(fp, "%s ", sp);
403 lpos += len + 1;
404 *cp = och;
36edb824
SL
405cont:
406 ;
01d17851 407 }
28061b3f
BJ
408 if (lpos != 8)
409 putc('\n', fp);
01d17851
MT
410}
411
01d17851 412do_cfiles(fp)
28061b3f 413 FILE *fp;
01d17851 414{
36e6aa7b 415 register struct file_list *tp, *fl;
28061b3f 416 register int lpos, len;
36e6aa7b 417 char swapname[32];
28061b3f 418
36e6aa7b 419 fputs("CFILES=", fp);
28061b3f 420 lpos = 8;
36e6aa7b
KB
421 for (tp = ftab; tp; tp = tp->f_next)
422 if (tp->f_type != INVISIBLE) {
423 len = strlen(tp->f_fn);
424 if (tp->f_fn[len - 1] != 'c')
425 continue;
426 if ((len = 3 + len) + lpos > 72) {
427 lpos = 8;
428 fputs("\\\n\t", fp);
429 }
430 fprintf(fp, "../%s ", tp->f_fn);
431 lpos += len + 1;
432 }
433 for (fl = conf_list; fl; fl = fl->f_next)
434 if (fl->f_type == SYSTEMSPEC) {
435 sprintf(swapname, "swap%s.c", fl->f_fn);
436 if ((len = 3 + strlen(swapname)) + lpos > 72) {
437 lpos = 8;
438 fputs("\\\n\t", fp);
439 }
f4970b85
MK
440 if (eq(fl->f_fn, "generic"))
441 fprintf(fp, "../%s/%s ", machinename, swapname);
442 else
443 fprintf(fp, "%s ", swapname);
36e6aa7b 444 lpos += len + 1;
28061b3f 445 }
28061b3f
BJ
446 if (lpos != 8)
447 putc('\n', fp);
01d17851
MT
448}
449
28061b3f
BJ
450char *
451tail(fn)
452 char *fn;
01d17851 453{
28061b3f 454 register char *cp;
01d17851 455
28061b3f 456 cp = rindex(fn, '/');
15eb15d7
KM
457 if (cp == 0)
458 return (fn);
28061b3f 459 return (cp+1);
01d17851
MT
460}
461
462/*
28061b3f
BJ
463 * Create the makerules for each file
464 * which is part of the system.
465 * Devices are processed with the special c2 option -i
466 * which avoids any problem areas with i/o addressing
467 * (e.g. for the VAX); assembler files are processed by as.
01d17851 468 */
01d17851 469do_rules(f)
28061b3f 470 FILE *f;
01d17851 471{
28061b3f
BJ
472 register char *cp, *np, och, *tp;
473 register struct file_list *ftp;
3c812eeb 474 char *extras;
01d17851 475
22d68ad0 476for (ftp = ftab; ftp != 0; ftp = ftp->f_next) {
01d17851 477 if (ftp->f_type == INVISIBLE)
28061b3f 478 continue;
01d17851
MT
479 cp = (np = ftp->f_fn) + strlen(ftp->f_fn) - 1;
480 och = *cp;
481 *cp = '\0';
fb547c4b
MK
482 if (och == 'o') {
483 fprintf(f, "%so:\n\t-cp ../%so .\n", tail(np), np);
484 continue;
485 }
01d17851
MT
486 fprintf(f, "%so: ../%s%c\n", tail(np), np, och);
487 tp = tail(np);
28061b3f 488 if (och == 's') {
cd42919c 489 fprintf(f, "\t-ln -s ../%ss %sc\n", np, tp);
46e3cd06 490 fprintf(f, "\t${CC} -E ${COPTS} %sc | ${AS} -o %so\n",
cd42919c
KM
491 tp, tp);
492 fprintf(f, "\trm -f %sc\n\n", tp);
28061b3f 493 continue;
01d17851 494 }
3c812eeb
SL
495 if (ftp->f_flags & CONFIGDEP)
496 extras = "${PARAM} ";
497 else
498 extras = "";
28061b3f
BJ
499 switch (ftp->f_type) {
500
501 case NORMAL:
502 switch (machine) {
503
504 case MACHINE_VAX:
a0105456 505 case MACHINE_TAHOE:
46e3cd06 506 fprintf(f, "\t${CC} -c -S ${COPTS} %s../%sc\n",
3c812eeb 507 extras, np);
18d7531d
SL
508 fprintf(f, "\t${C2} %ss | ${INLINE} | ${AS} -o %so\n",
509 tp, tp);
28061b3f
BJ
510 fprintf(f, "\trm -f %ss\n\n", tp);
511 break;
28061b3f
BJ
512 }
513 break;
514
3c812eeb 515 case DRIVER:
28061b3f
BJ
516 switch (machine) {
517
518 case MACHINE_VAX:
a0105456 519 case MACHINE_TAHOE:
46e3cd06 520 fprintf(f, "\t${CC} -c -S ${COPTS} %s../%sc\n",
3c812eeb 521 extras, np);
18d7531d
SL
522 fprintf(f,"\t${C2} -i %ss | ${INLINE} | ${AS} -o %so\n",
523 tp, tp);
28061b3f
BJ
524 fprintf(f, "\trm -f %ss\n\n", tp);
525 break;
28061b3f
BJ
526 }
527 break;
528
529 case PROFILING:
8486638c
SL
530 if (!profiling)
531 continue;
532 if (COPTS == 0) {
533 fprintf(stderr,
28061b3f 534 "config: COPTS undefined in generic makefile");
8486638c
SL
535 COPTS = "";
536 }
28061b3f
BJ
537 switch (machine) {
538
a0105456
SL
539 case MACHINE_TAHOE:
540 fprintf(f, "\t${CC} -c -S %s %s../%sc\n",
541 COPTS, extras, np);
542 fprintf(f, "\tex - %ss < ${GPROF.EX}\n", tp);
543 fprintf(f,"\t${C2} %ss | ${INLINE} | ${AS} -o %so\n",
544 tp, tp);
545 fprintf(f, "\trm -f %ss\n\n", tp);
546 break;
547
28061b3f 548 case MACHINE_VAX:
46e3cd06 549 fprintf(f, "\t${CC} -c -S %s %s../%sc\n",
3c812eeb 550 COPTS, extras, np);
c7456392 551 fprintf(f, "\tex - %ss < ${GPROF.EX}\n", tp);
18d7531d 552 fprintf(f, "\t${INLINE} %ss | ${AS} -o %so\n", tp, tp);
28061b3f
BJ
553 fprintf(f, "\trm -f %ss\n\n", tp);
554 break;
28061b3f 555 }
73845e07 556 break;
28061b3f
BJ
557
558 default:
3c812eeb 559 printf("Don't know rules for %s\n", np);
28061b3f
BJ
560 break;
561 }
01d17851 562 *cp = och;
28061b3f 563}
01d17851
MT
564}
565
566/*
567 * Create the load strings
568 */
01d17851 569do_load(f)
28061b3f 570 register FILE *f;
01d17851 571{
28061b3f 572 register struct file_list *fl;
36e6aa7b 573 register int first;
36edb824 574 struct file_list *do_systemspec();
28061b3f 575
36e6aa7b
KB
576 for (first = 1, fl = conf_list; fl; first = 0)
577 fl = fl->f_type == SYSTEMSPEC ?
578 do_systemspec(f, fl, first) : fl->f_next;
579 fputs("all:", f);
580 for (fl = conf_list; fl; fl = fl->f_next)
36edb824
SL
581 if (fl->f_type == SYSTEMSPEC)
582 fprintf(f, " %s", fl->f_needs);
36e6aa7b 583 putc('\n', f);
36edb824 584}
28061b3f 585
36edb824
SL
586struct file_list *
587do_systemspec(f, fl, first)
588 FILE *f;
589 register struct file_list *fl;
590 int first;
591{
28061b3f 592
05b83a6c 593 fprintf(f, "%s: Makefile", fl->f_needs);
22a93bf2
SL
594 if (machine == MACHINE_VAX)
595 fprintf(f, " ${INLINE} locore.o emulate.o");
596 else if (machine == MACHINE_TAHOE)
597 fprintf(f, " ${INLINE} locore.o");
598 else
599 fprintf(f, " locore.o");
600 fprintf(f, " ${OBJS} param.o ioconf.o swap%s.o\n", fl->f_fn);
36edb824
SL
601 fprintf(f, "\t@echo loading %s\n\t@rm -f %s\n",
602 fl->f_needs, fl->f_needs);
603 if (first) {
604 fprintf(f, "\t@sh ../conf/newvers.sh\n");
605 fprintf(f, "\t@${CC} $(CFLAGS) -c vers.c\n");
190b5698 606 }
36edb824 607 switch (machine) {
28061b3f 608
36edb824
SL
609 case MACHINE_VAX:
610 fprintf(f, "\t@${LD} -n -o %s -e start -x -T 80000000 ",
611 fl->f_needs);
a0105456
SL
612 fprintf(f,
613 "locore.o emulate.o ${OBJS} vers.o ioconf.o param.o ");
614 break;
615
616 case MACHINE_TAHOE:
617 fprintf(f, "\t@${LD} -n -o %s -e start -x -T C0000800 ",
618 fl->f_needs);
619 fprintf(f, "locore.o ${OBJS} vers.o ioconf.o param.o ");
36edb824 620 break;
36edb824 621 }
36edb824
SL
622 fprintf(f, "swap%s.o\n", fl->f_fn);
623 fprintf(f, "\t@echo rearranging symbols\n");
624 fprintf(f, "\t@-symorder ../%s/symbols.sort %s\n",
625 machinename, fl->f_needs);
626 fprintf(f, "\t@size %s\n", fl->f_needs);
627 fprintf(f, "\t@chmod 755 %s\n\n", fl->f_needs);
628 do_swapspec(f, fl->f_fn);
629 for (fl = fl->f_next; fl->f_type == SWAPSPEC; fl = fl->f_next)
630 ;
631 return (fl);
632}
633
634do_swapspec(f, name)
635 FILE *f;
636 register char *name;
637{
638
639 if (!eq(name, "generic")) {
640 fprintf(f, "swap%s.o: swap%s.c\n", name, name);
46e3cd06 641 fprintf(f, "\t${CC} -c -O ${COPTS} swap%s.c\n\n", name);
36edb824
SL
642 return;
643 }
644 fprintf(f, "swapgeneric.o: ../%s/swapgeneric.c\n", machinename);
645 switch (machine) {
646
647 case MACHINE_VAX:
a0105456 648 case MACHINE_TAHOE:
46e3cd06 649 fprintf(f, "\t${CC} -c -S ${COPTS} ");
36edb824 650 fprintf(f, "../%s/swapgeneric.c\n", machinename);
18d7531d 651 fprintf(f, "\t${C2} swapgeneric.s | ${INLINE}");
36edb824
SL
652 fprintf(f, " | ${AS} -o swapgeneric.o\n");
653 fprintf(f, "\trm -f swapgeneric.s\n\n");
654 break;
28061b3f 655 }
01d17851 656}
d5429061 657
22d68ad0 658char *
d5429061 659raise(str)
28061b3f 660 register char *str;
d5429061 661{
28061b3f
BJ
662 register char *cp = str;
663
664 while (*str) {
665 if (islower(*str))
666 *str = toupper(*str);
667 str++;
668 }
669 return (cp);
d5429061 670}