How to add a dependency on start.o to the test executables in waf?

Chris Johns chrisj at rtems.org
Fri Oct 25 01:41:58 UTC 2019


On 25/10/19 12:12 am, Sebastian Huber wrote:
> Hello,
> 
> I have a problem in the new build system, which I am not able to solve with my
> novice waf knowledge.
> 
> You can check out the prototype with these steps:
> 
> git clone git://git.rtems.org/sebh/rtems.git
> cd rtems
> git checkout --track origin/build
> ./waf bsp_defaults --rtems-bsps=sparc > bsps.ini
> ./waf configure

I uses ...

 ./waf configure --rtems-tools=/opt/work/rtems/5

:)

> ./waf

Nice, it took 6.944s to build.

> To build a test executable, we need:
> 
> 1. the test program objects,
> 
> 2. the libraries, e.g. librtemscpu.a and librtemsbsp.a
> 
> 3. the linker command file (source or configuration file, see ConfigFileItem in
> wscript)
> 
> 4. the start file start.o
> 
> The dependencies on 1. and 2. work. The 3. is basically read-only for a build.
> The problem is 4.
> 
> The start file is build with:
> 
> class StartItem(Item):
>     def __init__(self, uid, data):
>         super(StartItem, self).__init__(uid, data)
> 
>     def build(self, bld):
>         bld(
>             rule="${CC} -DASM ${CFLAGS} ${CPPFLAGS} ${DEFINES_ST:DEFINES}
> ${CPPPATH_ST:INCPATHS} -c -o ${TGT} ${SRC}",
>             source=self.data["source"],
>             target=self.data["target"],
>             name=self.uid,
>             features="asm",
>             includes=bld.env.INCLUDES,
>             before=["cstlib"],
>         )

Why the need for the rule?

> The test executables are built with:
> 
> class ExecutableItem(Item):
>     def __init__(self, uid, data):
>         super(ExecutableItem, self).__init__(uid, data)
>         executables.append(self)
> 
>     def build(self, bld):
>         if self.is_enabled(bld):
>             includes = bld.env["INCLUDES"]
>             bld.env["INCLUDES"] = (
>                 includes + bld.bsp_includes + ["testsuites/support/include"]
>             )
>             bld.use = ["rtemstest", "rtemscpu", "rtemsbsp"]
>             for p in self.links():
>                 p.build(bld)
>             bld.env["INCLUDES"] = includes
>             bld(
>                 target=self.data["target"] + ".exe",
>                 use=bld.use,
>                 features="c cprogram",
>             )
>             del bld.use

del ? If there is an active reference it will not be deleted. Python likes to share.

> How can I add a dependency on start.o to the test executables? I tried several
> variants of bld.add_manual_dependency(), but nothing worked.

I am not sure, I would need to have a close look at how the test stuff is being
put together. I cannot see where start.o in the bld statement.

Is start.o treated in a special way, maybe hidden when linking in the linker
command?

Chris


More information about the devel mailing list