public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
* Conditional Compilation
@ 2005-03-22  5:13 Raghu
  2005-03-22  8:27 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Raghu @ 2005-03-22  5:13 UTC (permalink / raw)
  To: ecos

Hi, 

I want to have a macro define through which I will be
able to conditionally compile either REDBOOT or ecos
library. 

Example: 
#ifdef CYGBLD_TARGET_REDBOOT
#include <redboot.h>
#include <net/net.h>
#else
#include <pkgconf/net.h>
#endif

How should I define this in the ".cdl" file ? I tried 
cdd_option CYGBLD_TARGET_REDBOOT {
    default_value 0
}
and in redboot_rom.ecm set the user_value to "1".
But this does not define "#define
CYGBLD_TARGET_REDBOOT" and the compilation fails for
file not found.
Regards
Raghu


    




		
__________________________________ 
Do you Yahoo!? 
Make Yahoo! your home page 
http://www.yahoo.com/r/hs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Conditional Compilation
  2005-03-22  5:13 Conditional Compilation Raghu
@ 2005-03-22  8:27 ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2005-03-22  8:27 UTC (permalink / raw)
  To: Raghu; +Cc: ecos

On Mon, Mar 21, 2005 at 09:12:33PM -0800, Raghu wrote:
> Hi, 
> 
> I want to have a macro define through which I will be
> able to conditionally compile either REDBOOT or ecos
> library. 

#include <pkgconf/system.h>
#ifdef CYGPKG_REDBOOT
#include <redboot.h>
#include <net/net.h>
#else
#include <pkgconf/net.h>
#endif

        Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Conditional compilation
  2003-10-20 12:10 Conditional compilation Gary Thomas
@ 2003-10-20 13:56 ` Bart Veer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Veer @ 2003-10-20 13:56 UTC (permalink / raw)
  To: gary; +Cc: ecos-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Conditional compilation
@ 2003-10-20 12:10 Gary Thomas
  2003-10-20 13:56 ` Bart Veer
  0 siblings, 1 reply; 4+ messages in thread
From: Gary Thomas @ 2003-10-20 12:10 UTC (permalink / raw)
  To: eCos development

I have a device which can be configured one of two ways.  I need a
separate driver file (this is for MicroWindows, trying to decide
between a mouse and a touch screen).  Is there a better way to handle
this than how I've done it?

        cdl_component CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER {
            display        "Mouse selection"
            legal_values   { "pc" "ms" "logi" "ps2" "ts" }
            default_value  { "logi" }
            cdl_option CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER_MOUSE {
               description   "Use mouse on PS/2 port"
               calculated    { CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER != "ts" }
               no_define
               compile       drivers/mou_ser.c
            }
            cdl_option CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER_TOUCH {
               description   "Use touch screen for mouse"
               calculated    { CYGBLD_MICROWINDOWS_PROT732_MOUSE_DRIVER == "ts" }
               no_define
               compile       drivers/mou_prot732ts.c
            }
        }

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-22  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-22  5:13 Conditional Compilation Raghu
2005-03-22  8:27 ` Andrew Lunn
  -- strict thread matches above, loose matches on Subject: below --
2003-10-20 12:10 Conditional compilation Gary Thomas
2003-10-20 13:56 ` Bart Veer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).