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