Conditional compilation
Bart Veer
bartv@ecoscentric.com
Mon Oct 20 13:56:00 GMT 2003
>>>>> "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
More information about the Ecos-devel
mailing list