]>
git.saurik.com Git - apple/xnu.git/blob - SETUP/config/mkmakefile.c
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 * Mach Operating System
26 * Copyright (c) 1990 Carnegie-Mellon University
27 * Copyright (c) 1989 Carnegie-Mellon University
28 * Copyright (c) 1988 Carnegie-Mellon University
29 * Copyright (c) 1987 Carnegie-Mellon University
30 * All rights reserved. The CMU software License Agreement specifies
31 * the terms and conditions for use and redistribution.
35 * Copyright (c) 1980 Regents of the University of California.
36 * All rights reserved.
38 * Redistribution and use in source and binary forms are permitted
39 * provided that the above copyright notice and this paragraph are
40 * duplicated in all such forms and that any documentation,
41 * advertising materials, and other materials related to such
42 * distribution and use acknowledge that the software was developed
43 * by the University of California, Berkeley. The name of the
44 * University may not be used to endorse or promote products derived
45 * from this software without specific prior written permission.
46 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
47 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
48 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
52 static char sccsid
[] __attribute__((used
)) = "@(#)mkmakefile.c 5.21 (Berkeley) 6/18/88";
56 * Build the makefile for the system, from
57 * the information in the files files and the
58 * additional files for the machine being compiled to.
62 #include <unistd.h> /* for unlink */
67 void read_files(void);
68 void do_objs(FILE *fp
, const char *msg
, int ext
);
69 void do_ordered(FILE *fp
);
70 void do_files(FILE *fp
, const char *msg
, char ext
);
71 void do_machdep(FILE *ofp
);
72 void do_build(const char *name
, void (*format
)(FILE *));
73 void do_rules(FILE *f
);
74 void do_load(FILE *f
);
75 struct file_list
*do_systemspec(FILE *f
, struct file_list
*fl
, int first
);
76 void do_swapspec(FILE *f
, const char *name
, char *sysname
);
77 void copy_dependencies(FILE *makin
, FILE *makout
);
79 void build_cputypes(FILE *fp
);
80 void build_confdep(FILE *fp
);
82 struct file_list
*fl_lookup(char *file
);
83 struct file_list
*fltail_lookup(char *file
);
84 struct file_list
*new_fent(void);
86 void put_source_file_name(FILE *fp
, struct file_list
*tp
);
91 #define next_word(fp, wd) \
92 { register const char *word = get_word(fp); \
93 if (word == (char *)EOF) \
99 static struct file_list
*fcur
;
100 const char *tail(const char *fn
);
101 char *allCaps(char *str
);
104 * Lookup a file, by name.
107 fl_lookup(char *file
)
109 register struct file_list
*fp
;
111 for (fp
= ftab
; fp
!= 0; fp
= fp
->f_next
) {
112 if (eq(fp
->f_fn
, file
))
119 * Lookup a file, by final component name.
122 fltail_lookup(char *file
)
124 register struct file_list
*fp
;
126 for (fp
= ftab
; fp
!= 0; fp
= fp
->f_next
) {
127 if (eq(tail(fp
->f_fn
), tail(file
)))
134 * Make a new file list entry
139 register struct file_list
*fp
;
141 fp
= (struct file_list
*) malloc(sizeof *fp
);
146 fp
->f_extra
= (char *) 0;
156 static struct users
{
161 { 24, 2, 1024 }, /* MACHINE_VAX */
162 { 8, 2, 32 }, /* MACHINE_SUN */
163 { 16, 4, 32 }, /* MACHINE_ROMP */
164 { 8, 2, 32 }, /* MACHINE_SUN2 */
165 { 8, 2, 32 }, /* MACHINE_SUN3 */
166 { 24, 8, 1024}, /* MACHINE_MMAX */
167 { 32, 8, 1024}, /* MACHINE_SQT */
168 { 8, 2, 32 }, /* MACHINE_SUN4 */
169 { 2, 2, 1024 }, /* MACHINE_I386 */
170 { 32, 8, 1024 }, /* MACHINE_IX */
171 { 32, 8, 1024 }, /* MACHINE_MIPSY */
172 { 32, 8, 1024 }, /* MACHINE_MIPS*/
173 { 32, 8, 1024 }, /* MACHINE_I860*/
174 { 8, 2, 32 }, /* MACHINE_M68K */
175 { 8, 2, 32 }, /* MACHINE_M88K */
176 { 8, 2, 32 }, /* MACHINE_M98K */
177 { 8, 2, 32 }, /* MACHINE_HPPA */
178 { 8, 2, 32 }, /* MACHINE_SPARC */
179 { 8, 2, 32 }, /* MACHINE_PPC */
180 { 8, 2, 32 }, /* MACHINE_ARM */
181 { 8, 2, 32 }, /* MACHINE_X86_64 */
183 #define NUSERS (sizeof (users) / sizeof (users[0]))
188 static char *vpath
= NULL
;
190 if ((vpath
== NULL
) &&
191 ((vpath
= getenv("VPATH")) != NULL
) &&
193 register char *buf
= malloc((unsigned)(strlen(vpath
) + 2));
195 vpath
= strcat(strcpy(buf
, ":"), vpath
);
198 return vpath
? vpath
: "";
203 * Build the makefile from the skeleton
216 (void) sprintf(line
, "%s/Makefile.template", config_directory
);
217 ifp
= fopenp(VPATH
, line
, pname
, "r");
222 dfp
= fopen(path("Makefile"), "r");
223 rename(path("Makefile"), path("Makefile.old"));
224 unlink(path("Makefile.old"));
226 if ((ofp
= fopen(path("M.d"), "w")) == NULL
) {
228 /* We'll let this error go */
232 ofp
= fopen(path("Makefile"), "w");
234 perror(path("Makefile"));
237 fprintf(ofp
, "SOURCE_DIR=%s\n", source_directory
);
239 if (machine
== MACHINE_SUN
|| machine
== MACHINE_SUN2
240 || machine
== MACHINE_SUN3
|| machine
== MACHINE_SUN4
)
241 fprintf(ofp
, "IDENT=-D%s -D%s", machinename
, allCaps(ident
));
243 fprintf(ofp
, "IDENT=-D%s", allCaps(ident
));
245 fprintf(ofp
, " -DGPROF");
247 printf("cpu type must be specified\n");
250 do_build("cputypes.h", build_cputypes
);
252 for (op
= opt
; op
; op
= op
->op_next
)
254 fprintf(ofp
, " -D%s=\"%s\"", op
->op_name
, op
->op_value
);
256 fprintf(ofp
, " -D%s", op
->op_name
);
258 if ((unsigned)machine
> NUSERS
) {
259 printf("maxusers config info isn't present, using vax\n");
260 up
= &users
[MACHINE_VAX
-1];
262 up
= &users
[machine
-1];
263 if (maxusers
< up
->u_min
) {
264 maxusers
= up
->u_min
;
265 } else if (maxusers
> up
->u_max
)
266 printf("warning: maxusers > %d (%d)\n", up
->u_max
, maxusers
);
268 do_build("confdep.h", build_confdep
);
270 for (op
= mkopt
; op
; op
= op
->op_next
)
272 fprintf(ofp
, "%s=%s\n", op
->op_name
, op
->op_value
);
274 fprintf(ofp
, "%s\n", op
->op_name
);
276 while (fgets(line
, BUFSIZ
, ifp
) != 0) {
279 if (profiling
&& strncmp(line
, "COPTS=", 6) == 0) {
281 if (machine
!= MACHINE_MMAX
)
283 "GPROF.EX=$(SOURCE_DIR)/machdep/%s/gmon.ex\n", machinename
);
284 cp
= index(line
, '\n');
288 while (*cp
&& (*cp
== ' ' || *cp
== '\t'))
290 COPTS
= malloc((unsigned)(strlen(cp
) + 1));
292 printf("config: out of memory\n");
296 if (machine
== MACHINE_MIPSY
|| machine
== MACHINE_MIPS
) {
297 fprintf(ofp
, "%s ${CCPROFOPT}\n", line
);
298 fprintf(ofp
, "PCOPTS=%s\n", cp
);
299 } else if (machine
== MACHINE_MMAX
)
300 fprintf(ofp
, "%s -p\n",line
);
302 fprintf(ofp
, "%s -pg\n", line
);
305 fprintf(ofp
, "%s", line
);
308 if (eq(line
, "%OBJS\n")) {
309 do_objs(ofp
, "OBJS=", -1);
310 } else if (eq(line
, "%CFILES\n")) {
311 do_files(ofp
, "CFILES=", 'c');
312 do_objs(ofp
, "COBJS=", 'c');
313 } else if (eq(line
, "%MFILES\n")) {
314 do_files(ofp
, "MFILES=", 'm');
315 do_objs(ofp
, "MOBJS=", 'm');
316 } else if (eq(line
, "%SFILES\n")) {
317 do_files(ofp
, "SFILES=", 's');
318 do_objs(ofp
, "SOBJS=", 's');
319 } else if (eq(line
, "%BFILES\n"))
320 do_files(ofp
, "BFILES=", 'b');
321 else if (eq(line
, "%MACHDEP\n")) {
323 * Move do_machdep() after the mkopt stuff.
325 for (op
= mkopt
; op
; op
= op
->op_next
)
326 fprintf(ofp
, "%s=%s\n", op
->op_name
, op
->op_value
);
328 } else if (eq(line
, "%ORDERED\n"))
330 else if (eq(line
, "%RULES\n"))
332 else if (eq(line
, "%LOAD\n"))
336 "Unknown %% construct in generic makefile: %s",
341 copy_dependencies(dfp
, ofp
);
349 * Read in the information about files used in making the system.
350 * Store it in the ftab linked list.
356 register struct file_list
*tp
, *pf
;
357 register struct device
*dp
;
358 register struct opt
*op
;
361 const char *devorprof
;
368 char *rest
= (char *) 0;
370 int nreqs
, first
= 1, isdup
;
373 (void) sprintf(fname
, "%s/files", config_directory
);
375 fp
= fopenp(VPATH
, fname
, pname
, "r");
384 * filename [ standard | optional ]
385 * [ dev* | profiling-routine ] [ device-driver]
390 * filename [ standard | optional ]
391 * [ ordered | sedit ]
392 * [ dev* | profiling-routine ] [ device-driver]
395 if (wd
== (char *)EOF
) {
398 (void) sprintf(fname
, "%s/files.%s", config_directory
, machinename
);
403 (void) sprintf(fname
, "files.%s", allCaps(ident
));
405 fp
= fopenp(VPATH
, fname
, pname
, "r");
414 * Allow comment lines beginning witha '#' character.
418 while ((wd
=get_word(fp
)) && wd
!= (char *)EOF
)
426 printf("%s: No type for %s.\n",
430 if ((pf
= fl_lookup(this)) && (pf
->f_type
!= INVISIBLE
|| pf
->f_flags
))
435 if (first
== 3 && (tp
= fltail_lookup(this)) != 0)
436 printf("%s: Local file %s overrides %s.\n",
437 fname
, this, tp
->f_fn
);
441 sedit
= 1; /* SQT: assume sedit for now */
443 if (eq(wd
, "standard"))
445 if (!eq(wd
, "optional")) {
446 printf("%s: %s must be optional or standard\n", fname
, this);
449 if (strncmp(this, "OPTIONS/", 8) == 0)
456 if (eq(wd
, "ordered")) {
460 if (machine
== MACHINE_SQT
&& eq(wd
, "sedit")) {
465 not_option
= !not_option
;
469 if (eq(wd
, "device-driver") || eq(wd
, "profiling-routine")) {
474 if (needs
== 0 && nreqs
== 1)
484 * Allocate a pseudo-device entry which we will insert into
485 * the device list below. The flags field is set non-zero to
486 * indicate an internal entry rather than one generated from
487 * the configuration file. The slave field is set to define
488 * the corresponding symbol as 0 should we fail to find the
489 * option in the option list.
492 tdev
.d_name
= ns(wd
);
493 tdev
.d_type
= PSEUDO_DEVICE
;
497 for (op
=opt
; op
; lop
=op
, op
=op
->op_next
)
499 char *od
= allCaps(ns(wd
));
502 * Found an option which matches the current device
503 * dependency identifier. Set the slave field to
504 * define the option in the header file.
506 if (strcmp(op
->op_name
, od
) == 0)
512 lop
->op_next
= op
->op_next
;
522 for (dp
= dtab
; dp
!= 0; dp
= dp
->d_next
) {
523 if (eq(dp
->d_name
, wd
) && (dp
->d_type
!= PSEUDO_DEVICE
|| dp
->d_slave
)) {
525 goto invis
; /* dont want file if option present */
531 goto nextopt
; /* want file if option missing */
533 for (op
= opt
; op
!= 0; op
= op
->op_next
)
534 if (op
->op_value
== 0 && opteq(op
->op_name
, wd
)) {
542 for (cp
= cputype
; cp
; cp
= cp
->cpu_next
)
543 if (opteq(cp
->cpu_name
, wd
)) {
552 while ((wd
= get_word(fp
)) != 0)
557 tp
->f_type
= INVISIBLE
;
564 printf("%s: what is %s optional on?\n",
575 if (eq(wd
, "ordered")) {
579 if (machine
== MACHINE_SQT
&& eq(wd
, "sedit")) {
592 rest
= ns(get_rest(fp
));
594 printf("%s: syntax error describing %s\n",
599 if (eq(devorprof
, "profiling-routine") && profiling
== 0)
606 tp
->f_type
= INVISIBLE
;
608 if (eq(devorprof
, "device-driver"))
610 else if (eq(devorprof
, "profiling-routine"))
611 tp
->f_type
= PROFILING
;
616 tp
->f_flags
|= ORDERED
;
618 tp
->f_flags
|= SEDIT
;
620 if (pf
&& pf
->f_type
== INVISIBLE
)
621 pf
->f_flags
= 1; /* mark as duplicate */
626 opteq(const char *cp
, const char *dp
)
630 for (; ; cp
++, dp
++) {
632 c
= isupper(*cp
) ? tolower(*cp
) : *cp
;
633 d
= isupper(*dp
) ? tolower(*dp
) : *dp
;
643 put_source_file_name(FILE *fp
, struct file_list
*tp
)
645 if ((tp
->f_fn
[0] == '.') && (tp
->f_fn
[1] == '/'))
646 fprintf(fp
, "%s ", tp
->f_fn
);
648 fprintf(fp
, "$(SOURCE_DIR)/%s ", tp
->f_fn
);
652 do_objs(FILE *fp
, const char *msg
, int ext
)
654 register struct file_list
*tp
;
655 register int lpos
, len
;
660 register struct file_list
*fl
;
662 #endif /* DO_SWAPFILE */
664 fprintf(fp
, "%s", msg
);
666 for (tp
= ftab
; tp
!= 0; tp
= tp
->f_next
) {
667 if (tp
->f_type
== INVISIBLE
)
671 * Check for '.o' file in list
673 cp
= tp
->f_fn
+ (len
= strlen(tp
->f_fn
)) - 1;
674 if ((ext
== -1 && tp
->f_flags
& ORDERED
) || /* not in objs */
675 (ext
!= -1 && *cp
!= ext
))
677 else if (*cp
== 'o') {
678 if (len
+ lpos
> 72) {
680 fprintf(fp
, "\\\n\t");
682 put_source_file_name(fp
, tp
);
689 for (fl
= conf_list
; fl
; fl
= fl
->f_next
) {
690 if (fl
->f_type
!= SWAPSPEC
)
692 (void) sprintf(swapname
, "swap%s.c", fl
->f_fn
);
693 if (eq(sp
, swapname
))
696 #endif /* DO_SWAPFILE */
697 cp
= (char *)sp
+ (len
= strlen(sp
)) - 1;
700 if (len
+ lpos
> 72) {
702 fprintf(fp
, "\\\n\t");
704 fprintf(fp
, "%s ", sp
);
710 #endif /* DO_SWAPFILE */
716 /* not presently used and probably broken, use ORDERED instead */
720 register struct file_list
*tp
;
721 register int lpos
, len
;
726 fprintf(fp
, "ORDERED=");
728 for (tp
= ftab
; tp
!= 0; tp
= tp
->f_next
) {
729 if ((tp
->f_flags
& ORDERED
) != ORDERED
)
732 cp
= (char *)sp
+ (len
= strlen(sp
)) - 1;
735 if (len
+ lpos
> 72) {
737 fprintf(fp
, "\\\n\t");
739 fprintf(fp
, "%s ", sp
);
748 do_files(FILE *fp
, const char *msg
, char ext
)
750 register struct file_list
*tp
;
751 register int lpos
, len
=0; /* dvw: init to 0 */
753 fprintf(fp
, "%s", msg
);
755 for (tp
= ftab
; tp
!= 0; tp
= tp
->f_next
) {
756 if (tp
->f_type
== INVISIBLE
)
758 if (tp
->f_fn
[strlen(tp
->f_fn
)-1] != ext
)
761 * Always generate a newline.
762 * Our Makefile's aren't readable anyway.
766 fprintf(fp
, "\\\n\t");
767 put_source_file_name(fp
, tp
);
775 * Include machine dependent makefile in output
779 do_machdep(FILE *ofp
)
785 (void) sprintf(line
, "%s/Makefile.%s", config_directory
, machinename
);
786 ifp
= fopenp(VPATH
, line
, pname
, "r");
791 while (fgets(line
, BUFSIZ
, ifp
) != 0) {
792 if (profiling
&& (strncmp(line
, "LIBS=", 5) == 0))
793 fprintf(ofp
,"LIBS=${LIBS_P}\n");
802 * Format configuration dependent parameter file.
806 build_confdep(FILE *fp
)
808 fprintf(fp
, "#define MAXUSERS %d\n", maxusers
);
812 * Format cpu types file.
816 build_cputypes(FILE *fp
)
820 for (cp
= cputype
; cp
; cp
= cp
->cpu_next
)
821 fprintf(fp
, "#define\t%s\t1\n", cp
->cpu_name
);
827 * Build a define parameter file. Create it first in a temporary location and
828 * determine if this new contents differs from the old before actually
829 * replacing the original (so as not to introduce avoidable extraneous
834 do_build(const char *name
, void (*format
)(FILE *))
836 static char temp
[]="#config.tmp";
841 tfp
= fopen(path(temp
), "w+");
848 ofp
= fopen(path(name
), "r");
852 while ((c
= fgetc(tfp
)) != EOF
)
855 if (fgetc(ofp
) == EOF
)
863 ofp
= fopen(path(name
), "w");
869 while ((c
= fgetc(tfp
)) != EOF
)
879 register const char *cp
;
881 cp
= rindex(fn
, '/');
888 * Create the makerules for each file
889 * which is part of the system.
890 * Devices are processed with the special c2 option -i
891 * which avoids any problem areas with i/o addressing
892 * (e.g. for the VAX); assembler files are processed by as.
900 register struct file_list
*ftp
;
901 const char *extras
= ""; /* dvw: init to "" */
906 for (ftp
= ftab
; ftp
!= 0; ftp
= ftp
->f_next
) {
907 if (ftp
->f_type
== INVISIBLE
)
909 cp
= (np
= ftp
->f_fn
) + strlen(ftp
->f_fn
) - 1;
912 * Don't compile '.o' files
917 * Determine where sources should come from
919 if ((np
[0] == '.') && (np
[1] == '/')) {
923 source_dir
= "$(SOURCE_DIR)/";
925 tp
= tail(np
); /* dvw: init tp before 'if' */
927 fprintf(f
, "%so: %so\n\t${O_RULE_1A}%s%.*s${O_RULE_1B}\n\n",
928 tp
, np
, source_dir
, (int)(tp
-np
), np
);
931 fprintf(f
, "%so: %s%s%c\n", tp
, source_dir
, np
, och
);
936 switch (ftp
->f_type
) {
939 fprintf(f
, "\t@${RM} %so\n", tp
);
940 fprintf(f
, "\t${CC} ${CCASFLAGS}%s %s%s%ss\n\n",
941 (ftp
->f_extra
?ftp
->f_extra
:""), extras
, source_dir
, np
);
947 fprintf(f
, "\t@${RM} %so\n", tp
);
948 fprintf(f
, "\t${CC} ${CCPASFLAGS}%s %s%s%ss\n\n",
949 (ftp
->f_extra
?ftp
->f_extra
:""), extras
, source_dir
, np
);
953 printf("Don't know rules for %s.s\n", np
);
958 fprintf(f
, "\t${S_RULE_1A}%s%.*s${S_RULE_1B}%s\n",
959 source_dir
, (int)(tp
-np
), np
, nl
);
960 fprintf(f
, "\t${S_RULE_2}%s\n", nl
);
961 fprintf(f
, "\t${S_RULE_3}\n\n");
967 fprintf(f
, "\t${B_RULE_1A}%s%.*s${B_RULE_1B}\n\n",
968 source_dir
, (int)(tp
-np
), np
);
972 switch (ftp
->f_type
) {
979 fprintf(f
, "\t@${RM} %so\n", tp
);
980 fprintf(f
, "\t${CC} ${CCNFLAGS}%s %s%s%sc\n\n",
981 (ftp
->f_extra
?ftp
->f_extra
:""), extras
, source_dir
, np
);
985 if (ftp
->f_flags
& SEDIT
) {
986 fprintf(f
, "\t${CC} -SO ${COPTS} %s%s%sc | \\\n", extras
, source_dir
, np
);
987 fprintf(f
, "\t${SEDCMD} | ${C2} | ${AS} ${CAFLAGS} -o %so\n\n", tp
);
989 fprintf(f
, "\t${CC} -c -O ${COPTS} %s%s%sc\n\n",
990 source_dir
, extras
, np
);
1004 fprintf(f
, "\t@${RM} %so\n", tp
);
1005 fprintf(f
, "\t${CC} ${CCDFLAGS}%s %s%s%sc\n\n",
1006 (ftp
->f_extra
?ftp
->f_extra
:""), extras
, source_dir
, np
);
1019 "config: COPTS undefined in generic makefile");
1025 fprintf(f
, "\t@${RM} %so\n", tp
);
1026 fprintf(f
, "\t${CC} ${CCPFLAGS}%s %s../%sc\n\n",
1027 (ftp
->f_extra
?ftp
->f_extra
:""), extras
, np
);
1041 case MACHINE_X86_64
:
1046 "config: don't know how to profile kernel on this cpu\n");
1051 och_upper
= och
+ 'A' - 'a';
1052 fprintf(f
, "\t${%c_RULE_1A%s}", och_upper
, extras
);
1054 fprintf(f
, "%s", ftp
->f_extra
);
1055 fprintf(f
, "%s%.*s${%c_RULE_1B%s}%s\n",
1056 source_dir
, (int)(tp
-np
), np
, och_upper
, extras
, nl
);
1057 fprintf(f
, "\t${%c_RULE_2%s}%s\n", och_upper
, extras
, nl
);
1058 fprintf(f
, "\t${%c_RULE_3%s}%s\n", och_upper
, extras
, nl
);
1059 fprintf(f
, "\t${%c_RULE_4%s}\n\n", och_upper
, extras
);
1063 printf("Don't know rules for %s\n", np
);
1071 * Create the load strings
1076 register struct file_list
*fl
;
1081 if (fl
->f_type
!= SYSTEMSPEC
) {
1085 fl
= do_systemspec(f
, fl
, first
);
1089 fprintf(f
, "LOAD =");
1090 for (fl
= conf_list
; fl
!= 0; fl
= fl
->f_next
)
1091 if (fl
->f_type
== SYSTEMSPEC
)
1092 fprintf(f
, " %s", fl
->f_needs
);
1094 fprintf(f
, "\n\nall .ORDER: includelinks ${LOAD}\n");
1095 #else /* multimax */
1096 fprintf(f
, "\n\nall: includelinks ${LOAD}\n");
1097 #endif /* multimax */
1102 do_systemspec(FILE *f
, struct file_list
*fl
, __unused
int first
)
1105 * Variable for kernel name.
1107 fprintf(f
, "KERNEL_NAME=%s\n", fl
->f_needs
);
1109 fprintf(f
, "%s .ORDER: %s.sys ${SYSDEPS}\n",
1110 fl
->f_needs
, fl
->f_needs
);
1111 fprintf(f
, "\t${SYS_RULE_1}\n");
1112 fprintf(f
, "\t${SYS_RULE_2}\n");
1113 fprintf(f
, "\t${SYS_RULE_3}\n");
1114 fprintf(f
, "\t${SYS_RULE_4}\n\n");
1115 do_swapspec(f
, fl
->f_fn
, fl
->f_needs
);
1116 for (fl
= fl
->f_next
; fl
!= NULL
&& fl
->f_type
== SWAPSPEC
; fl
= fl
->f_next
)
1122 do_swapspec(__unused
FILE *f
, __unused
const char *name
, __unused
char *sysname
)
1126 char *gdir
= eq(name
, "generic")?"$(MACHINEDIR)/":"";
1128 fprintf(f
, "%s.sys:${P} ${PRELDDEPS} ${LDOBJS} ${LDDEPS}\n\n", sysname
);
1129 fprintf(f
, "%s.swap: swap%s.o\n", sysname
, name
);
1130 fprintf(f
, "\t@rm -f $@\n");
1131 fprintf(f
, "\t@cp swap%s.o $@\n\n", name
);
1132 fprintf(f
, "swap%s.o: %sswap%s.c ${SWAPDEPS}\n", name
, gdir
, name
);
1133 if (machine
== MACHINE_MIPSY
|| machine
== MACHINE_MIPS
) {
1134 fprintf(f
, "\t@${RM} swap%s.o\n", name
);
1135 fprintf(f
, "\t${CC} ${CCNFLAGS} %sswap%s.c\n\n", gdir
, name
);
1137 fprintf(f
, "\t${C_RULE_1A}%s${C_RULE_1B}\n", gdir
);
1138 fprintf(f
, "\t${C_RULE_2}\n");
1139 fprintf(f
, "\t${C_RULE_3}\n");
1140 fprintf(f
, "\t${C_RULE_4}\n\n");
1142 #endif /* DO_SWAPFILE */
1149 register char *cp
= str
;
1153 *str
= toupper(*str
);
1159 #define OLDSALUTATION "# DO NOT DELETE THIS LINE"
1161 #define LINESIZE 1024
1162 static char makbuf
[LINESIZE
]; /* one line buffer for makefile */
1165 copy_dependencies(FILE *makin
, FILE *makout
)
1167 register int oldlen
= (sizeof OLDSALUTATION
- 1);
1169 while (fgets(makbuf
, LINESIZE
, makin
) != NULL
) {
1170 if (! strncmp(makbuf
, OLDSALUTATION
, oldlen
))
1173 while (fgets(makbuf
, LINESIZE
, makin
) != NULL
) {
1176 if (makbuf
[0] == '\n')
1181 fputs(makbuf
, makout
);