]>
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
, "export IDENT=-D%s -D%s", machinename
, allCaps(ident
));
243 fprintf(ofp
, "export IDENT=-D%s", allCaps(ident
));
245 fprintf(ofp
, " -DGPROF");
247 printf("cpu type must be specified\n");
250 do_build("cputypes.h", build_cputypes
);
251 do_build("platforms.h", build_cputypes
);
253 for (op
= opt
; op
; op
= op
->op_next
)
255 fprintf(ofp
, " -D%s=\"%s\"", op
->op_name
, op
->op_value
);
257 fprintf(ofp
, " -D%s", op
->op_name
);
259 if ((unsigned)machine
> NUSERS
) {
260 printf("maxusers config info isn't present, using vax\n");
261 up
= &users
[MACHINE_VAX
-1];
263 up
= &users
[machine
-1];
264 if (maxusers
< up
->u_min
) {
265 maxusers
= up
->u_min
;
266 } else if (maxusers
> up
->u_max
)
267 printf("warning: maxusers > %d (%d)\n", up
->u_max
, maxusers
);
269 do_build("confdep.h", build_confdep
);
271 for (op
= mkopt
; op
; op
= op
->op_next
)
273 fprintf(ofp
, "%s=%s\n", op
->op_name
, op
->op_value
);
275 fprintf(ofp
, "%s\n", op
->op_name
);
277 while (fgets(line
, BUFSIZ
, ifp
) != 0) {
280 if (profiling
&& strncmp(line
, "COPTS=", 6) == 0) {
282 if (machine
!= MACHINE_MMAX
)
284 "GPROF.EX=$(SOURCE_DIR)/machdep/%s/gmon.ex\n", machinename
);
285 cp
= index(line
, '\n');
289 while (*cp
&& (*cp
== ' ' || *cp
== '\t'))
291 COPTS
= malloc((unsigned)(strlen(cp
) + 1));
293 printf("config: out of memory\n");
297 if (machine
== MACHINE_MIPSY
|| machine
== MACHINE_MIPS
) {
298 fprintf(ofp
, "%s ${CCPROFOPT}\n", line
);
299 fprintf(ofp
, "PCOPTS=%s\n", cp
);
300 } else if (machine
== MACHINE_MMAX
)
301 fprintf(ofp
, "%s -p\n",line
);
303 fprintf(ofp
, "%s -pg\n", line
);
306 fprintf(ofp
, "%s", line
);
309 if (eq(line
, "%OBJS\n")) {
310 do_objs(ofp
, "OBJS=", -1);
311 } else if (eq(line
, "%CFILES\n")) {
312 do_files(ofp
, "CFILES=", 'c');
313 do_objs(ofp
, "COBJS=", 'c');
314 } else if (eq(line
, "%SFILES\n")) {
315 do_files(ofp
, "SFILES=", 's');
316 do_objs(ofp
, "SOBJS=", 's');
317 } else if (eq(line
, "%MACHDEP\n")) {
319 * Move do_machdep() after the mkopt stuff.
321 for (op
= mkopt
; op
; op
= op
->op_next
)
322 fprintf(ofp
, "%s=%s\n", op
->op_name
, op
->op_value
);
324 } else if (eq(line
, "%RULES\n"))
326 else if (eq(line
, "%LOAD\n"))
330 "Unknown %% construct in generic makefile: %s",
335 copy_dependencies(dfp
, ofp
);
343 * Read in the information about files used in making the system.
344 * Store it in the ftab linked list.
350 register struct file_list
*tp
, *pf
;
351 register struct device
*dp
;
352 register struct opt
*op
;
355 const char *devorprof
;
362 char *rest
= (char *) 0;
364 int nreqs
, first
= 1, isdup
;
367 (void) sprintf(fname
, "%s/files", config_directory
);
369 fp
= fopenp(VPATH
, fname
, pname
, "r");
378 * filename [ standard | optional ]
379 * [ dev* | profiling-routine ] [ device-driver]
384 * filename [ standard | optional ]
385 * [ ordered | sedit ]
386 * [ dev* | profiling-routine ] [ device-driver]
389 if (wd
== (char *)EOF
) {
392 (void) sprintf(fname
, "%s/files.%s", config_directory
, machinename
);
397 (void) sprintf(fname
, "files.%s", allCaps(ident
));
399 fp
= fopenp(VPATH
, fname
, pname
, "r");
408 * Allow comment lines beginning witha '#' character.
412 while ((wd
=get_word(fp
)) && wd
!= (char *)EOF
)
420 printf("%s: No type for %s.\n",
424 if ((pf
= fl_lookup(this)) && (pf
->f_type
!= INVISIBLE
|| pf
->f_flags
))
429 if (first
== 3 && (tp
= fltail_lookup(this)) != 0)
430 printf("%s: Local file %s overrides %s.\n",
431 fname
, this, tp
->f_fn
);
435 sedit
= 1; /* SQT: assume sedit for now */
437 if (eq(wd
, "standard"))
439 if (!eq(wd
, "optional")) {
440 printf("%s: %s must be optional or standard\n", fname
, this);
443 if (strncmp(this, "OPTIONS/", 8) == 0)
450 if (eq(wd
, "ordered")) {
454 if (machine
== MACHINE_SQT
&& eq(wd
, "sedit")) {
459 not_option
= !not_option
;
463 if (eq(wd
, "device-driver") || eq(wd
, "profiling-routine")) {
468 if (needs
== 0 && nreqs
== 1)
478 * Allocate a pseudo-device entry which we will insert into
479 * the device list below. The flags field is set non-zero to
480 * indicate an internal entry rather than one generated from
481 * the configuration file. The slave field is set to define
482 * the corresponding symbol as 0 should we fail to find the
483 * option in the option list.
486 tdev
.d_name
= ns(wd
);
487 tdev
.d_type
= PSEUDO_DEVICE
;
491 for (op
=opt
; op
; lop
=op
, op
=op
->op_next
)
493 char *od
= allCaps(ns(wd
));
496 * Found an option which matches the current device
497 * dependency identifier. Set the slave field to
498 * define the option in the header file.
500 if (strcmp(op
->op_name
, od
) == 0)
506 lop
->op_next
= op
->op_next
;
516 for (dp
= dtab
; dp
!= 0; dp
= dp
->d_next
) {
517 if (eq(dp
->d_name
, wd
) && (dp
->d_type
!= PSEUDO_DEVICE
|| dp
->d_slave
)) {
519 goto invis
; /* dont want file if option present */
525 goto nextopt
; /* want file if option missing */
527 for (op
= opt
; op
!= 0; op
= op
->op_next
)
528 if (op
->op_value
== 0 && opteq(op
->op_name
, wd
)) {
536 for (cp
= cputype
; cp
; cp
= cp
->cpu_next
)
537 if (opteq(cp
->cpu_name
, wd
)) {
546 while ((wd
= get_word(fp
)) != 0)
551 tp
->f_type
= INVISIBLE
;
558 printf("%s: what is %s optional on?\n",
569 if (eq(wd
, "ordered")) {
573 if (machine
== MACHINE_SQT
&& eq(wd
, "sedit")) {
586 rest
= ns(get_rest(fp
));
588 printf("%s: syntax error describing %s\n",
593 if (eq(devorprof
, "profiling-routine") && profiling
== 0)
600 tp
->f_type
= INVISIBLE
;
602 if (eq(devorprof
, "device-driver"))
604 else if (eq(devorprof
, "profiling-routine"))
605 tp
->f_type
= PROFILING
;
610 tp
->f_flags
|= ORDERED
;
612 tp
->f_flags
|= SEDIT
;
614 if (pf
&& pf
->f_type
== INVISIBLE
)
615 pf
->f_flags
= 1; /* mark as duplicate */
620 opteq(const char *cp
, const char *dp
)
624 for (; ; cp
++, dp
++) {
626 c
= isupper(*cp
) ? tolower(*cp
) : *cp
;
627 d
= isupper(*dp
) ? tolower(*dp
) : *dp
;
637 put_source_file_name(FILE *fp
, struct file_list
*tp
)
639 if ((tp
->f_fn
[0] == '.') && (tp
->f_fn
[1] == '/'))
640 fprintf(fp
, "%s ", tp
->f_fn
);
642 fprintf(fp
, "$(SOURCE_DIR)/%s ", tp
->f_fn
);
646 do_objs(FILE *fp
, const char *msg
, int ext
)
648 register struct file_list
*tp
;
649 register int lpos
, len
;
654 register struct file_list
*fl
;
656 #endif /* DO_SWAPFILE */
658 fprintf(fp
, "%s", msg
);
660 for (tp
= ftab
; tp
!= 0; tp
= tp
->f_next
) {
661 if (tp
->f_type
== INVISIBLE
)
665 * Check for '.o' file in list
667 cp
= tp
->f_fn
+ (len
= strlen(tp
->f_fn
)) - 1;
668 if ((ext
== -1 && tp
->f_flags
& ORDERED
) || /* not in objs */
669 (ext
!= -1 && *cp
!= ext
))
671 else if (*cp
== 'o') {
672 if (len
+ lpos
> 72) {
674 fprintf(fp
, "\\\n\t");
676 put_source_file_name(fp
, tp
);
683 for (fl
= conf_list
; fl
; fl
= fl
->f_next
) {
684 if (fl
->f_type
!= SWAPSPEC
)
686 (void) sprintf(swapname
, "swap%s.c", fl
->f_fn
);
687 if (eq(sp
, swapname
))
690 #endif /* DO_SWAPFILE */
691 cp
= (char *)sp
+ (len
= strlen(sp
)) - 1;
694 if (len
+ lpos
> 72) {
696 fprintf(fp
, "\\\n\t");
698 fprintf(fp
, "%s ", sp
);
704 #endif /* DO_SWAPFILE */
710 /* not presently used and probably broken, use ORDERED instead */
714 register struct file_list
*tp
;
715 register int lpos
, len
;
720 fprintf(fp
, "ORDERED=");
722 for (tp
= ftab
; tp
!= 0; tp
= tp
->f_next
) {
723 if ((tp
->f_flags
& ORDERED
) != ORDERED
)
726 cp
= (char *)sp
+ (len
= strlen(sp
)) - 1;
729 if (len
+ lpos
> 72) {
731 fprintf(fp
, "\\\n\t");
733 fprintf(fp
, "%s ", sp
);
742 do_files(FILE *fp
, const char *msg
, char ext
)
744 register struct file_list
*tp
;
745 register int lpos
, len
=0; /* dvw: init to 0 */
747 fprintf(fp
, "%s", msg
);
749 for (tp
= ftab
; tp
!= 0; tp
= tp
->f_next
) {
750 if (tp
->f_type
== INVISIBLE
)
752 if (tp
->f_fn
[strlen(tp
->f_fn
)-1] != ext
)
755 * Always generate a newline.
756 * Our Makefile's aren't readable anyway.
760 fprintf(fp
, "\\\n\t");
761 put_source_file_name(fp
, tp
);
769 * Include machine dependent makefile in output
773 do_machdep(FILE *ofp
)
779 (void) sprintf(line
, "%s/Makefile.%s", config_directory
, machinename
);
780 ifp
= fopenp(VPATH
, line
, pname
, "r");
785 while (fgets(line
, BUFSIZ
, ifp
) != 0) {
786 if (profiling
&& (strncmp(line
, "LIBS=", 5) == 0))
787 fprintf(ofp
,"LIBS=${LIBS_P}\n");
796 * Format configuration dependent parameter file.
800 build_confdep(FILE *fp
)
802 fprintf(fp
, "#define MAXUSERS %d\n", maxusers
);
806 * Format cpu types file.
810 build_cputypes(FILE *fp
)
814 for (cp
= cputype
; cp
; cp
= cp
->cpu_next
)
815 fprintf(fp
, "#define\t%s\t1\n", cp
->cpu_name
);
821 * Build a define parameter file. Create it first in a temporary location and
822 * determine if this new contents differs from the old before actually
823 * replacing the original (so as not to introduce avoidable extraneous
828 do_build(const char *name
, void (*format
)(FILE *))
830 static char temp
[]="#config.tmp";
835 tfp
= fopen(path(temp
), "w+");
842 ofp
= fopen(path(name
), "r");
846 while ((c
= fgetc(tfp
)) != EOF
)
849 if (fgetc(ofp
) == EOF
)
857 ofp
= fopen(path(name
), "w");
863 while ((c
= fgetc(tfp
)) != EOF
)
873 register const char *cp
;
875 cp
= rindex(fn
, '/');
882 * Create the makerules for each file
883 * which is part of the system.
884 * Devices are processed with the special c2 option -i
885 * which avoids any problem areas with i/o addressing
886 * (e.g. for the VAX); assembler files are processed by as.
894 register struct file_list
*ftp
;
895 const char *extras
= ""; /* dvw: init to "" */
900 for (ftp
= ftab
; ftp
!= 0; ftp
= ftp
->f_next
) {
901 if (ftp
->f_type
== INVISIBLE
)
903 cp
= (np
= ftp
->f_fn
) + strlen(ftp
->f_fn
) - 1;
906 * Don't compile '.o' files
911 * Determine where sources should come from
913 if ((np
[0] == '.') && (np
[1] == '/')) {
917 source_dir
= "$(SOURCE_DIR)/";
919 tp
= tail(np
); /* dvw: init tp before 'if' */
920 fprintf(f
, "-include %sd\n", tp
);
921 fprintf(f
, "%so: %s%s%c\n", tp
, source_dir
, np
, och
);
928 fprintf(f
, "\t${S_RULE_0}\n");
929 fprintf(f
, "\t${S_RULE_1A}%s%.*s${S_RULE_1B}%s\n",
930 source_dir
, (int)(tp
-np
), np
, nl
);
931 fprintf(f
, "\t${S_RULE_2}%s\n", nl
);
937 switch (ftp
->f_type
) {
955 fprintf(f
, "\t@${RM} %so\n", tp
);
956 fprintf(f
, "\t${CC} ${CCDFLAGS}%s %s%s%sc\n\n",
957 (ftp
->f_extra
?ftp
->f_extra
:""), extras
, source_dir
, np
);
970 "config: COPTS undefined in generic makefile");
976 fprintf(f
, "\t@${RM} %so\n", tp
);
977 fprintf(f
, "\t${CC} ${CCPFLAGS}%s %s../%sc\n\n",
978 (ftp
->f_extra
?ftp
->f_extra
:""), extras
, np
);
997 "config: don't know how to profile kernel on this cpu\n");
1002 och_upper
= och
+ 'A' - 'a';
1003 fprintf(f
, "\t${%c_RULE_0%s}\n", och_upper
, extras
);
1004 fprintf(f
, "\t${%c_RULE_1A%s}", och_upper
, extras
);
1006 fprintf(f
, "%s", ftp
->f_extra
);
1007 fprintf(f
, "%s%.*s${%c_RULE_1B%s}%s\n",
1008 source_dir
, (int)(tp
-np
), np
, och_upper
, extras
, nl
);
1010 /* While we are still using CTF, any build that normally does not support CTF will
1011 * a "standard" compile done as well that we can harvest CTF information from; do
1014 fprintf(f
, "\t${%c_CTFRULE_1A%s}", och_upper
, extras
);
1016 fprintf(f
, "%s", ftp
->f_extra
);
1017 fprintf(f
, "%s%.*s${%c_CTFRULE_1B%s}%s\n",
1018 source_dir
, (int)(tp
-np
), np
, och_upper
, extras
, nl
);
1020 fprintf(f
, "\t${%c_RULE_2%s}%s\n", och_upper
, extras
, nl
);
1021 fprintf(f
, "\t${%c_CTFRULE_2%s}%s\n", och_upper
, extras
, nl
);
1025 printf("Don't know rules for %s\n", np
);
1033 * Create the load strings
1038 register struct file_list
*fl
;
1043 if (fl
->f_type
!= SYSTEMSPEC
) {
1047 fl
= do_systemspec(f
, fl
, first
);
1051 fprintf(f
, "LOAD =");
1052 for (fl
= conf_list
; fl
!= 0; fl
= fl
->f_next
)
1053 if (fl
->f_type
== SYSTEMSPEC
)
1054 fprintf(f
, " %s", fl
->f_needs
);
1056 fprintf(f
, "\n\nall .ORDER: includelinks ${LOAD}\n");
1057 #else /* multimax */
1058 fprintf(f
, "\n\nall: includelinks ${LOAD}\n");
1059 #endif /* multimax */
1064 do_systemspec(FILE *f
, struct file_list
*fl
, __unused
int first
)
1067 * Variable for kernel name.
1069 fprintf(f
, "KERNEL_NAME=%s\n", fl
->f_needs
);
1071 fprintf(f
, "%s .ORDER: %s.sys ${SYSDEPS}\n",
1072 fl
->f_needs
, fl
->f_needs
);
1073 fprintf(f
, "\t${SYS_RULE_1}\n");
1074 fprintf(f
, "\t${SYS_RULE_2}\n");
1075 fprintf(f
, "\t${SYS_RULE_3}\n");
1076 fprintf(f
, "\t${SYS_RULE_4}\n\n");
1077 do_swapspec(f
, fl
->f_fn
, fl
->f_needs
);
1078 for (fl
= fl
->f_next
; fl
!= NULL
&& fl
->f_type
== SWAPSPEC
; fl
= fl
->f_next
)
1084 do_swapspec(__unused
FILE *f
, __unused
const char *name
, __unused
char *sysname
)
1088 char *gdir
= eq(name
, "generic")?"$(MACHINEDIR)/":"";
1090 fprintf(f
, "%s.sys:${P} ${PRELDDEPS} ${LDOBJS} ${LDDEPS}\n\n", sysname
);
1091 fprintf(f
, "%s.swap: swap%s.o\n", sysname
, name
);
1092 fprintf(f
, "\t@rm -f $@\n");
1093 fprintf(f
, "\t@cp swap%s.o $@\n\n", name
);
1094 fprintf(f
, "swap%s.o: %sswap%s.c ${SWAPDEPS}\n", name
, gdir
, name
);
1095 if (machine
== MACHINE_MIPSY
|| machine
== MACHINE_MIPS
) {
1096 fprintf(f
, "\t@${RM} swap%s.o\n", name
);
1097 fprintf(f
, "\t${CC} ${CCNFLAGS} %sswap%s.c\n\n", gdir
, name
);
1099 fprintf(f
, "\t${C_RULE_1A}%s${C_RULE_1B}\n", gdir
);
1100 fprintf(f
, "\t${C_RULE_2}\n");
1101 fprintf(f
, "\t${C_RULE_3}\n");
1102 fprintf(f
, "\t${C_RULE_4}\n\n");
1104 #endif /* DO_SWAPFILE */
1111 register char *cp
= str
;
1115 *str
= toupper(*str
);
1121 #define OLDSALUTATION "# DO NOT DELETE THIS LINE"
1123 #define LINESIZE 1024
1124 static char makbuf
[LINESIZE
]; /* one line buffer for makefile */
1127 copy_dependencies(FILE *makin
, FILE *makout
)
1129 register int oldlen
= (sizeof OLDSALUTATION
- 1);
1131 while (fgets(makbuf
, LINESIZE
, makin
) != NULL
) {
1132 if (! strncmp(makbuf
, OLDSALUTATION
, oldlen
))
1135 while (fgets(makbuf
, LINESIZE
, makin
) != NULL
) {
1138 if (makbuf
[0] == '\n')
1143 fputs(makbuf
, makout
);