]>
git.saurik.com Git - apple/xnu.git/blob - SETUP/config/main.c
2 * Copyright (c) 1999-2009 Apple 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.
53 "@(#) Copyright (c) 1980 Regents of the University of California.\n\
54 All rights reserved.\n";
58 static char sccsid
[] __attribute__((used
)) = "@(#)main.c 5.9 (Berkeley) 6/18/88";
67 * Config builds a set of files for building a UNIX
68 * system given a description of the desired system.
71 main(int argc
, char *argv
[])
74 source_directory
= ".."; /* default */
75 object_directory
= "..";
76 config_directory
= (char *) 0;
77 while ((argc
> 1) && (argv
[1][0] == '-')) {
81 for (c
= &argv
[0][1]; *c
; c
++) {
84 build_directory
= argv
[1];
88 source_directory
= argv
[1];
92 object_directory
= argv
[1];
96 config_directory
= argv
[1];
99 if (argv
[1] == (char *) 0)
112 if (config_directory
== (char *) 0) {
114 malloc((unsigned) strlen(source_directory
) + 6);
115 (void) sprintf(config_directory
, "%s/conf", source_directory
);
119 fprintf(stderr
, "usage: config [ -bcdo dir ] [ -p ] sysname\n");
122 if (!build_directory
)
123 build_directory
= argv
[1];
124 if (freopen(argv
[1], "r", stdin
) == NULL
) {
136 vax_ioconf(); /* Print ioconf.c */
137 ubglue(); /* Create ubglue.s */
147 sun_ioconf(); /* Print ioconf.c */
148 mbglue(); /* Create mbglue.s */
210 printf("Specify machine type, e.g. ``machine vax''\n");
214 makefile(); /* build Makefile */
215 headers(); /* make a lot of .h files */
216 swapconf(); /* swap config files */
223 * returns EOF on end of file
224 * NULL on end of line
225 * pointer to the word otherwise
230 static char line
[80];
234 while ((ch
= getc(fp
)) != EOF
)
235 if (ch
!= ' ' && ch
!= '\t')
238 return ((char *)EOF
);
245 while ((ch
= getc(fp
)) != EOF
) {
252 return ((char *)EOF
);
253 (void) ungetc(ch
, fp
);
259 * returns EOF on end of file
260 * NULL on end of line
261 * pointer to the word otherwise
266 static char line
[80];
271 while ((ch
= getc(fp
)) != EOF
) {
278 return ((char *)EOF
);
283 * prepend the path to a filename
286 path(const char *file
)
290 cp
= malloc((unsigned)(strlen(build_directory
)+
292 strlen(object_directory
)+
294 (void) sprintf(cp
, "%s/%s/%s", object_directory
, build_directory
, file
);