This is the mail archive of the ecos-devel@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Conditional compilation


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]