This is the mail archive of the
ecos-devel@sources.redhat.com
mailing list for the eCos project.
Re: Conditional compilation
- From: Bart Veer <bartv at ecoscentric dot com>
- To: gary at mlbassoc dot com
- Cc: ecos-devel at ecos dot sourceware dot org
- Date: Mon, 20 Oct 2003 14:55:57 +0100 (BST)
- Subject: Re: Conditional compilation
- References: <1066651807.29481.21.camel@hermes>
>>>>> "Gary" == Gary Thomas <gary@mlbassoc.com> writes:
Gary> I have a device which can be configured one of two ways. I
Gary> need a separate driver file (this is for MicroWindows,
Gary> trying to decide between a mouse and a touch screen). Is
Gary> there a better way to handle this than how I've done it?
Gary> cdl_component CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER {
Gary> display "Mouse selection"
Gary> legal_values { "pc" "ms" "logi" "ps2" "ts" }
Gary> default_value { "logi" }
Gary> cdl_option CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER_MOUSE {
Gary> description "Use mouse on PS/2 port"
Gary> calculated { CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER != "ts" }
Gary> no_define
Gary> compile drivers/mou_ser.c
Gary> }
Gary> cdl_option CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER_TOUCH {
Gary> description "Use touch screen for mouse"
Gary> calculated { CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER == "ts" }
Gary> no_define
Gary> compile drivers/mou_prot732ts.c
Gary> }
Gary> }
That approach is fine. The alternative is to always compile both files
and have #ifdef's around the bulk of the code. Anything more advanced
would probably require a new CDL property "compile_if <expr> <sources>"
Bart