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