Subject: Re: More config changes, for ro source tree and disjoint build trees
To: der Mouse <mouse@holo.rodents.montreal.qc.ca>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 08/12/1996 16:10:43
On Mon, 12 Aug 1996 16:04:18 -0400 
 der Mouse <mouse@Holo.Rodents.Montreal.QC.CA> wrote:

 > This sounds neat, but how could this work?  config would need to know
 > about every define ever used anywhere, so that it would know to create
 > empty .h files for absent defines.  Maintaining this central list of
 > defines would be almost more of a headache than having to manually blow
 > away .o files when you change something that ends up in a -D option.
 > 
 > Or so it seems to me.  What am I missing?

The config grammar could be changed to understand an "option" keyword 
which tells it to emit an "option_<option>.h" file.  These "option" 
directives could be placed in sys/conf/files and the machine-dependent 
files.<whatever> ... for bus-specific options, files.<bus>.

The syntax could look like this:

#	$NetBSD: files,v ... $

[ . . . ]

# Machine-independent kernel options
option		compat_12	# binary compatibility with NetBSD 1.2
[ . . . ]

This would emit a file "option_compat_12.h" which would contain one of 
two things:

#define COMPAT_12	0
 - or -
#define COMPAT_12	1

...depending on whether or not COMPAT_12 is in the kernel config file..

 --- OR ---

<empty>
 - or -
#define COMPAT_12	1

...depending on whether of not COMPAT_12 is in the kernel config file..

The latter approach would require no modification of the places where 
#ifdef COMPAT_12 might exist, but since the source files are going to be 
modified anyway to pull in the header file, the former approach is 
probably best, and could be used like:

#if (COMPAT_12 > 0)
[ . do something . ]
#endif

This is how the checks for devices are done if the device is a 
"needs-flag" or "needs-count" kind of device.

Just some thoughts ... really, it shouldn't be _that_ hard to implement it.

 -- save the ancient forests - http://www.bayarea.net/~thorpej/forest/ -- 
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939