xref: /freebsd/usr.sbin/config/config.h (revision f9218d3d4fd34f082473b3a021c6d4d109fb47cf)
1 /*
2  * Copyright (c) 1980, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *	This product includes software developed by the University of
16  *	California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *	@(#)config.h	8.1 (Berkeley) 6/6/93
34  * $FreeBSD$
35  */
36 
37 /*
38  * Config.
39  */
40 #include <sys/types.h>
41 #include <sys/queue.h>
42 #include <stdlib.h>
43 #include <string.h>
44 
45 struct file_list {
46 	STAILQ_ENTRY(file_list) f_next;
47 	char	*f_fn;			/* the name */
48 	int     f_type;                 /* type or count */
49 	u_char	f_flags;		/* see below */
50 	char	*f_compilewith;		/* special make rule if present */
51 	char	*f_depends;		/* additional dependancies */
52 	char	*f_clean;		/* File list to add to clean rule */
53 	char	*f_needs;
54 	char	*f_warn;		/* warning message */
55 };
56 
57 /*
58  * Types.
59  */
60 #define NORMAL		1
61 #define	INVISIBLE	2
62 #define	PROFILING	3
63 #define NODEPEND	4
64 #define LOCAL		5
65 #define DEVDONE		0x80000000
66 #define TYPEMASK	0x7fffffff
67 
68 /*
69  * Attributes (flags).
70  */
71 #define NO_IMPLCT_RULE	1
72 #define NO_OBJ		2
73 #define BEFORE_DEPEND	4
74 #define NEED_COUNT	8
75 #define ISDUP		16
76 #define NOWERROR	32
77 
78 struct device {
79 	int	d_done;			/* processed */
80 	char	*d_name;		/* name of device (e.g. rk11) */
81 	int	d_count;		/* device count */
82 #define	UNKNOWN -2	/* -2 means not set yet */
83 	STAILQ_ENTRY(device) d_next;	/* Next one in list */
84 };
85 
86 struct config {
87 	char	*s_sysname;
88 };
89 
90 /*
91  * Config has a global notion of which machine type is
92  * being used.  It uses the name of the machine in choosing
93  * files and directories.  Thus if the name of the machine is ``i386'',
94  * it will build from ``Makefile.i386'' and use ``../i386/inline''
95  * in the makerules, etc.
96  */
97 char	*machinename;
98 
99 /*
100  * For each machine, a set of CPU's may be specified as supported.
101  * These and the options (below) are put in the C flags in the makefile.
102  */
103 struct cputype {
104 	char	*cpu_name;
105 	SLIST_ENTRY(cputype) cpu_next;
106 };
107 
108 SLIST_HEAD(, cputype) cputype;
109 
110 /*
111  * A set of options may also be specified which are like CPU types,
112  * but which may also specify values for the options.
113  * A separate set of options may be defined for make-style options.
114  */
115 struct opt {
116 	char	*op_name;
117 	char	*op_value;
118 	int	op_ownfile;	/* true = own file, false = makefile */
119 	SLIST_ENTRY(opt) op_next;
120 };
121 
122 SLIST_HEAD(opt_head, opt) opt, mkopt;
123 
124 struct opt_list {
125 	char *o_name;
126 	char *o_file;
127 	SLIST_ENTRY(opt_list) o_next;
128 };
129 
130 SLIST_HEAD(, opt_list) otab;
131 
132 extern char	*ident;
133 extern char	*env;
134 extern char	*hints;
135 extern int	do_trace;
136 extern int	envmode;
137 extern int	hintmode;
138 
139 char	*get_word(FILE *);
140 char	*get_quoted_word(FILE *);
141 char	*path(const char *);
142 char	*raisestr(char *);
143 void	remember(const char *);
144 void	moveifchanged(const char *, const char *);
145 int	yyparse(void);
146 int	yylex(void);
147 void	options(void);
148 void	makefile(void);
149 void	headers(void);
150 
151 extern STAILQ_HEAD(device_head, device) dtab;
152 
153 extern char	errbuf[80];
154 extern int	yyline;
155 extern const	char *yyfile;
156 
157 extern STAILQ_HEAD(file_list_head, file_list) ftab;
158 
159 extern int	profiling;
160 extern int	debugging;
161 
162 extern int	maxusers;
163 
164 extern char *PREFIX;		/* Config file name - for error messages */
165 extern char srcdir[];		/* root of the kernel source tree */
166 
167 #define eq(a,b)	(!strcmp(a,b))
168 #define ns(s)	strdup(s)
169