1*94d3b452SApple OSS Distributions /* 2*94d3b452SApple OSS Distributions * Copyright (c) 1999-2009 Apple Inc. All rights reserved. 3*94d3b452SApple OSS Distributions * 4*94d3b452SApple OSS Distributions * @APPLE_LICENSE_HEADER_START@ 5*94d3b452SApple OSS Distributions * 6*94d3b452SApple OSS Distributions * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights 7*94d3b452SApple OSS Distributions * Reserved. This file contains Original Code and/or Modifications of 8*94d3b452SApple OSS Distributions * Original Code as defined in and that are subject to the Apple Public 9*94d3b452SApple OSS Distributions * Source License Version 1.0 (the 'License'). You may not use this file 10*94d3b452SApple OSS Distributions * except in compliance with the License. Please obtain a copy of the 11*94d3b452SApple OSS Distributions * License at http://www.apple.com/publicsource and read it before using 12*94d3b452SApple OSS Distributions * this file. 13*94d3b452SApple OSS Distributions * 14*94d3b452SApple OSS Distributions * The Original Code and all software distributed under the License are 15*94d3b452SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16*94d3b452SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17*94d3b452SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18*94d3b452SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 19*94d3b452SApple OSS Distributions * License for the specific language governing rights and limitations 20*94d3b452SApple OSS Distributions * under the License." 21*94d3b452SApple OSS Distributions * 22*94d3b452SApple OSS Distributions * @APPLE_LICENSE_HEADER_END@ 23*94d3b452SApple OSS Distributions */ 24*94d3b452SApple OSS Distributions /* 25*94d3b452SApple OSS Distributions * Mach Operating System 26*94d3b452SApple OSS Distributions * Copyright (c) 1990 Carnegie-Mellon University 27*94d3b452SApple OSS Distributions * Copyright (c) 1989 Carnegie-Mellon University 28*94d3b452SApple OSS Distributions * Copyright (c) 1988 Carnegie-Mellon University 29*94d3b452SApple OSS Distributions * Copyright (c) 1987 Carnegie-Mellon University 30*94d3b452SApple OSS Distributions * All rights reserved. The CMU software License Agreement specifies 31*94d3b452SApple OSS Distributions * the terms and conditions for use and redistribution. 32*94d3b452SApple OSS Distributions */ 33*94d3b452SApple OSS Distributions 34*94d3b452SApple OSS Distributions /* 35*94d3b452SApple OSS Distributions * Copyright (c) 1980 Regents of the University of California. 36*94d3b452SApple OSS Distributions * All rights reserved. 37*94d3b452SApple OSS Distributions * 38*94d3b452SApple OSS Distributions * Redistribution and use in source and binary forms are permitted 39*94d3b452SApple OSS Distributions * provided that the above copyright notice and this paragraph are 40*94d3b452SApple OSS Distributions * duplicated in all such forms and that any documentation, 41*94d3b452SApple OSS Distributions * advertising materials, and other materials related to such 42*94d3b452SApple OSS Distributions * distribution and use acknowledge that the software was developed 43*94d3b452SApple OSS Distributions * by the University of California, Berkeley. The name of the 44*94d3b452SApple OSS Distributions * University may not be used to endorse or promote products derived 45*94d3b452SApple OSS Distributions * from this software without specific prior written permission. 46*94d3b452SApple OSS Distributions * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 47*94d3b452SApple OSS Distributions * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 48*94d3b452SApple OSS Distributions * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 49*94d3b452SApple OSS Distributions * 50*94d3b452SApple OSS Distributions * @(#)config.h 5.8 (Berkeley) 6/18/88 51*94d3b452SApple OSS Distributions */ 52*94d3b452SApple OSS Distributions 53*94d3b452SApple OSS Distributions /* 54*94d3b452SApple OSS Distributions * Config. 55*94d3b452SApple OSS Distributions */ 56*94d3b452SApple OSS Distributions 57*94d3b452SApple OSS Distributions #include <stdio.h> 58*94d3b452SApple OSS Distributions #include <sys/types.h> 59*94d3b452SApple OSS Distributions #include <sys/param.h> 60*94d3b452SApple OSS Distributions #include <stdlib.h> 61*94d3b452SApple OSS Distributions #include <string.h> 62*94d3b452SApple OSS Distributions 63*94d3b452SApple OSS Distributions struct file_list { 64*94d3b452SApple OSS Distributions struct file_list *f_next; 65*94d3b452SApple OSS Distributions char *f_fn; /* the name */ 66*94d3b452SApple OSS Distributions u_char f_type; /* see below */ 67*94d3b452SApple OSS Distributions u_char f_flags; /* see below */ 68*94d3b452SApple OSS Distributions short f_special; /* requires special make rule */ 69*94d3b452SApple OSS Distributions char *f_needs; 70*94d3b452SApple OSS Distributions char *f_extra; /* stuff to add to make line */ 71*94d3b452SApple OSS Distributions }; 72*94d3b452SApple OSS Distributions 73*94d3b452SApple OSS Distributions /* 74*94d3b452SApple OSS Distributions * Types. 75*94d3b452SApple OSS Distributions */ 76*94d3b452SApple OSS Distributions #define DRIVER 1 77*94d3b452SApple OSS Distributions #define NORMAL 2 78*94d3b452SApple OSS Distributions #define INVISIBLE 3 79*94d3b452SApple OSS Distributions #define PROFILING 4 80*94d3b452SApple OSS Distributions 81*94d3b452SApple OSS Distributions /* 82*94d3b452SApple OSS Distributions * Attributes (flags). 83*94d3b452SApple OSS Distributions */ 84*94d3b452SApple OSS Distributions #define CONFIGDEP 0x01 /* obsolete? */ 85*94d3b452SApple OSS Distributions #define OPTIONSDEF 0x02 /* options definition entry */ 86*94d3b452SApple OSS Distributions #define LIBRARYDEP 0x04 /* include file in library build */ 87*94d3b452SApple OSS Distributions #define BOUND_CHECKS 0x08 /* build with -fbounds-safety */ 88*94d3b452SApple OSS Distributions #define BOUND_CHECKS_SOFT 0x10 /* emit non-panicking traps for bound-checked source */ 89*94d3b452SApple OSS Distributions #define BOUND_CHECKS_DEBUG 0x20 /* emit one panicking trap per bounds check */ 90*94d3b452SApple OSS Distributions 91*94d3b452SApple OSS Distributions struct device { 92*94d3b452SApple OSS Distributions int d_type; /* CONTROLLER, DEVICE, bus adaptor */ 93*94d3b452SApple OSS Distributions const char *d_name; /* name of device (e.g. rk11) */ 94*94d3b452SApple OSS Distributions int d_slave; /* slave number */ 95*94d3b452SApple OSS Distributions #define QUES -1 /* -1 means '?' */ 96*94d3b452SApple OSS Distributions #define UNKNOWN -2 /* -2 means not set yet */ 97*94d3b452SApple OSS Distributions int d_flags; /* nlags for device init */ 98*94d3b452SApple OSS Distributions struct device *d_next; /* Next one in list */ 99*94d3b452SApple OSS Distributions char *d_init; /* pseudo device init routine name */ 100*94d3b452SApple OSS Distributions }; 101*94d3b452SApple OSS Distributions 102*94d3b452SApple OSS Distributions /* 103*94d3b452SApple OSS Distributions * Config has a global notion of which machine type is 104*94d3b452SApple OSS Distributions * being used. It uses the name of the machine in choosing 105*94d3b452SApple OSS Distributions * files and directories. Thus if the name of the machine is ``vax'', 106*94d3b452SApple OSS Distributions * it will build from ``Makefile.vax'' and use ``../vax/inline'' 107*94d3b452SApple OSS Distributions * in the makerules, etc. 108*94d3b452SApple OSS Distributions */ 109*94d3b452SApple OSS Distributions extern const char *machinename; 110*94d3b452SApple OSS Distributions 111*94d3b452SApple OSS Distributions /* 112*94d3b452SApple OSS Distributions * In order to configure and build outside the kernel source tree, 113*94d3b452SApple OSS Distributions * we may wish to specify where the source tree lives. 114*94d3b452SApple OSS Distributions */ 115*94d3b452SApple OSS Distributions extern const char *source_directory; 116*94d3b452SApple OSS Distributions extern const char *object_directory; 117*94d3b452SApple OSS Distributions extern char *config_directory; 118*94d3b452SApple OSS Distributions 119*94d3b452SApple OSS Distributions FILE *fopenp(const char *fpath, char *file, char *complete, const char *ftype); 120*94d3b452SApple OSS Distributions const char *get_VPATH(void); 121*94d3b452SApple OSS Distributions #define VPATH get_VPATH() 122*94d3b452SApple OSS Distributions 123*94d3b452SApple OSS Distributions /* 124*94d3b452SApple OSS Distributions * A set of options may also be specified which are like CPU types, 125*94d3b452SApple OSS Distributions * but which may also specify values for the options. 126*94d3b452SApple OSS Distributions * A separate set of options may be defined for make-style options. 127*94d3b452SApple OSS Distributions */ 128*94d3b452SApple OSS Distributions struct opt { 129*94d3b452SApple OSS Distributions char *op_name; 130*94d3b452SApple OSS Distributions char *op_value; 131*94d3b452SApple OSS Distributions struct opt *op_next; 132*94d3b452SApple OSS Distributions }; 133*94d3b452SApple OSS Distributions 134*94d3b452SApple OSS Distributions extern struct opt *opt, *mkopt, *opt_tail, *mkopt_tail; 135*94d3b452SApple OSS Distributions 136*94d3b452SApple OSS Distributions const char *get_word(FILE *fp); 137*94d3b452SApple OSS Distributions char *ns(const char *str); 138*94d3b452SApple OSS Distributions char *qu(int num); 139*94d3b452SApple OSS Distributions char *path(const char *file); 140*94d3b452SApple OSS Distributions 141*94d3b452SApple OSS Distributions extern int do_trace; 142*94d3b452SApple OSS Distributions 143*94d3b452SApple OSS Distributions extern struct device *dtab; 144*94d3b452SApple OSS Distributions dev_t nametodev(char *name, int defunit, char defpartition); 145*94d3b452SApple OSS Distributions char *devtoname(dev_t dev); 146*94d3b452SApple OSS Distributions 147*94d3b452SApple OSS Distributions extern char errbuf[80]; 148*94d3b452SApple OSS Distributions extern int yyline; 149*94d3b452SApple OSS Distributions 150*94d3b452SApple OSS Distributions extern struct file_list *ftab, *conf_list, **confp; 151*94d3b452SApple OSS Distributions extern char *build_directory; 152*94d3b452SApple OSS Distributions 153*94d3b452SApple OSS Distributions extern int profiling; 154*94d3b452SApple OSS Distributions 155*94d3b452SApple OSS Distributions #define eq(a, b) (!strcmp(a,b)) 156*94d3b452SApple OSS Distributions 157*94d3b452SApple OSS Distributions #define DEV_MASK 0x7 158*94d3b452SApple OSS Distributions #define DEV_SHIFT 3 159*94d3b452SApple OSS Distributions 160*94d3b452SApple OSS Distributions /* External function references */ 161*94d3b452SApple OSS Distributions char *get_rest(FILE *fp); 162*94d3b452SApple OSS Distributions 163*94d3b452SApple OSS Distributions int yyparse(void); 164*94d3b452SApple OSS Distributions void yyerror(const char *s); 165*94d3b452SApple OSS Distributions 166*94d3b452SApple OSS Distributions void mkioconf(void); 167*94d3b452SApple OSS Distributions 168*94d3b452SApple OSS Distributions void makefile(void); 169*94d3b452SApple OSS Distributions void headers(void); 170*94d3b452SApple OSS Distributions int opteq(const char *cp, const char *dp); 171*94d3b452SApple OSS Distributions 172*94d3b452SApple OSS Distributions void init_dev(struct device *dp); 173*94d3b452SApple OSS Distributions void newdev(struct device *dp); 174*94d3b452SApple OSS Distributions void dev_param(struct device *dp, const char *str, long num); 175*94d3b452SApple OSS Distributions 176*94d3b452SApple OSS Distributions int searchp(const char *spath, char *file, char *fullname, int (*func)(char *)); 177