This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: changing compile source in cdl based on platform
On Mon, Dec 01, 2008 at 06:58:35PM +0000, Bart Veer wrote:
> >>>>> "Tyler" == Tyler Wilson <TWilson@ugobe.com> writes:
>
> Tyler> FYI, I looked through the CDL guide, but could not find an
> Tyler> answer. I apologize if it is in there, but I think I did
> Tyler> try.
>
> Tyler> I have a component I am adding to our eCos repository, via
> Tyler> the CDL. One of the modules has assembly language versions
> Tyler> for different platforms - x86, ARM, etc. I would like to
> Tyler> know how to specify this in the CDL properly. Something
> Tyler> like
>
> Tyler> cdl_option CYG_USE_ASM {
> Tyler> compile {
> Tyler> if is_defined(HAL_ARM) {
> Tyler> arm_version.S
> Tyler> }
> Tyler> if is_defined(HAL_X86) {
> Tyler> x86_version.S
> Tyler> }
> Tyler> }
> Tyler> }
>
> Tyler> I know these are really just Tcl scripts, but I am not
> Tyler> familiar enough with Tcl to know the proper syntax, and I
> Tyler> thought it would be easier for somebody on this list to
> Tyler> give me an example.
>
> Right now there is no easy way of doing this. The syntax should be
> something like:
>
> cdl_option CYG_USE_ASM {
> when { CYGPKG_HAL_ARM } {
> compile arm_version.S
> }
> when { CYGPKG_HAL_I386 } {
> compile x86_version.S
> }
> }
>
> But as with many other parts of the CDL language, the "when" property
> is not currently implemented it. There are two work-arounds:
>
> 1) create some dummy calculated options and put the compile properties
> in there.
>
> cdl_component CYG_USE_ARM {
> ...
> cdl_option CYG_USE_ASM_ARM {
> calculated CYGPKG_HAL_ARM
> compile arm_version.S
> }
> cdl_option CYG_USE_ASM_I386 {
> calculated CYGPKG_HAL_I386
> compile x86_version.S
> }
> }
>
> The disadvantage is that you end up with yet more "options" which
> serve no real purpose, i.e. which clutter up the display in the
> configtool but cannot be changed by the user.
>
> 2) just build all of them, but put #ifdef's in each module, e.g. in
> arm_version.S:
>
> #include <pkgconf/system.h>
> #ifdef CYGPKG_HAL_ARM
> <main body of file>
> #endif
>
> The disadvantage is that you end up compiling more files than
> needed, but compiling a file that ends up all #ifdef'd out adds
> very little to the system build time.
>
> On the whole I would prefer option (2).
Nice tutorial! I would prefer option (2) too. I wonder will it work
cdl_option CYGBLD_BUILD_FOO_ARM {
requires { is_substr(CYGBLD_GLOBAL_COMMAND_PREFIX, "arm" }
compile arm_version.S
}
cdl_option CYGBLD_BUILD_FOO_I386 {
requires { is_substr(CYGBLD_GLOBAL_COMMAND_PREFIX, "i386" }
compile x86_version.S
}
Thank you,
Sergei
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss