2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * @(#)config.h 8.1 (Berkeley) 6/6/93
38 #include <sys/types.h>
39 #include <sys/queue.h>
44 STAILQ_ENTRY(cfgfile) cfg_next;
47 STAILQ_HEAD(, cfgfile) cfgfiles;
50 STAILQ_ENTRY(file_list) f_next;
51 char *f_fn; /* the name */
52 int f_type; /* type */
53 u_char f_flags; /* see below */
54 char *f_compilewith; /* special make rule if present */
55 char *f_depends; /* additional dependencies */
56 char *f_clean; /* File list to add to clean rule */
57 char *f_warn; /* warning message */
58 const char *f_objprefix; /* prefix string for object name */
59 const char *f_srcprefix; /* source prefix such as $S/ */
64 STAILQ_ENTRY(files_name) f_next;
74 #define DEVDONE 0x80000000
75 #define TYPEMASK 0x7fffffff
80 #define NO_IMPLCT_RULE 1
82 #define BEFORE_DEPEND 4
86 int d_done; /* processed */
87 char *d_name; /* name of device (e.g. rk11) */
88 #define UNKNOWN -2 /* -2 means not set yet */
89 STAILQ_ENTRY(device) d_next; /* Next one in list */
97 * Config has a global notion of which machine type is
98 * being used. It uses the name of the machine in choosing
99 * files and directories. Thus if the name of the machine is ``i386'',
100 * it will build from ``Makefile.i386'' and use ``../i386/inline''
101 * in the makerules, etc. machinearch is the global notion of the
102 * MACHINE_ARCH for this MACHINE.
108 * For each machine, a set of CPU's may be specified as supported.
109 * These and the options (below) are put in the C flags in the makefile.
113 SLIST_ENTRY(cputype) cpu_next;
116 SLIST_HEAD(, cputype) cputype;
119 * A set of options may also be specified which are like CPU types,
120 * but which may also specify values for the options.
121 * A separate set of options may be defined for make-style options.
126 int op_ownfile; /* true = own file, false = makefile */
127 SLIST_ENTRY(opt) op_next;
128 SLIST_ENTRY(opt) op_append;
131 SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts;
138 SLIST_ENTRY(opt_list) o_next;
141 SLIST_HEAD(, opt_list) otab;
145 STAILQ_ENTRY(hint) hint_next;
148 STAILQ_HEAD(hint_head, hint) hints;
152 SLIST_ENTRY(includepath) path_next;
155 SLIST_HEAD(, includepath) includepath;
158 * Tag present in the kernconf.tmpl template file. It's mandatory for those
159 * two strings to be the same. Otherwise you'll get into trouble.
161 #define KERNCONFTAG "%%KERNCONFFILE%%"
164 * Faked option to note, that the configuration file has been taken from the
165 * kernel file and inclusion of DEFAULTS etc.. isn't nessesery, because we
166 * already have a list of all required devices.
168 #define OPT_AUTOGEN "CONFIG_AUTOGENERATED"
172 extern char kernconfstr[];
176 extern int incignore;
178 char *get_word(FILE *);
179 char *get_quoted_word(FILE *);
180 char *path(const char *);
181 char *raisestr(char *);
182 void remember(const char *);
183 void moveifchanged(const char *, const char *);
188 void makehints(void);
190 void cfgfile_add(const char *);
191 void cfgfile_removeall(void);
192 FILE *open_makefile_template(void);
194 extern STAILQ_HEAD(device_head, device) dtab;
196 extern char errbuf[80];
198 extern const char *yyfile;
200 extern STAILQ_HEAD(file_list_head, file_list) ftab;
202 extern STAILQ_HEAD(files_name_head, files_name) fntab;
204 extern int profiling;
205 extern int debugging;
206 extern int found_defaults;
210 extern char *PREFIX; /* Config file name - for error messages */
211 extern char srcdir[]; /* root of the kernel source tree */
213 #define eq(a,b) (!strcmp(a,b))
214 #define ns(s) strdup(s)