Subject: More on the #define spaghetti
To: None <port-arm@netbsd.org>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm
Date: 06/08/2001 16:29:41
I've been thinking further about the current defopt mess, where every 
platform we build has to defopt several things even though it will never 
make use of them, simply because some source file it needs to build 
includes opt_<foo> for some reason.

An idea for one way to solve some of this mess is for the basic hardware 
options that an ARM platform needs to support to be defopt-ed in a single 
header file, eg opt_hwconf.h, we could then use this for footbridge, ofw 
vidc iomd etc (ie the basic hw build options for an ARM) and save the need 
to include large numbers of opt_foo files at the top of a file.  The 
defopt for each of the supported hw configurations would then just live in 
arm/conf/files.arm

Thinking further on this, we could even use this principal to enable us to 
have a single consinit() function in a single source file in the same sort 
of way that i386 has.  The code would then look something like

#include "opt_hwconfig.h"

void
consinit ()
{
	/* Glue to allow switching console at boot time */
#ifdef COM_CONSOLE
	/* com-console code */
#endif
#ifdef VIDC
	/* vidc console init code */
#endif
#ifdef FOOTBRIDGE
	/* Footbridge console init code */
#endif
...
}

Comments?

R.