Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Real-Time Software Components (RTSC) » Specifying src path in 'package.bld'
Specifying src path in 'package.bld' [message #5484] Wed, 22 July 2009 10:22 Go to next message
sgspecker is currently offline sgspeckerFriend
Messages: 8
Registered: July 2009
Junior Member
I can't figure out where I'm going wrong. I'm creating a fairly simple
'package.bld' file to build a codec library on a Windows PC. Here's a
short clip from my .bld file:

----------------------------------------------------------
var csources = ["myalg_ialg.c", "myalg_tto_ialgvt.c"];
var profiles = ["debug", "release"];

for each (var targ in Build.targets) {
for each (var prof in profiles) {
var progName = "myalg_" + prof;
Pkg.addLibrary( progName,
targ,
{profile : prof}
).addObjects( csources );
}
}
------------------------------------------------------------

What is shown seems to work fine. Also, if I change a source file to
"src/myalg_tto_ialg.c", that seems to work fine, too.

The problem begins when I try to reference a source file elsewhere in my
system. All of these following examples seem to fail:

"../myalg_tto_ialg.c"
"m:/another_directory/myalg_tto_ialg.c"
"m:\another_directory\myalg_tto_ialg.c"
"m:\\another_directory\\myalg_tto_ialg.c"

Is there a trick that I'm missing? Any suggestions?

Thanks,
Scott
Re: Specifying src path in 'package.bld' [message #5496 is a reply to message #5484] Wed, 22 July 2009 17:25 Go to previous message
Dave Russo is currently offline Dave RussoFriend
Messages: 172
Registered: July 2009
Senior Member
sgspecker wrote:
> I can't figure out where I'm going wrong. I'm creating a fairly simple
> 'package.bld' file to build a codec library on a Windows PC. Here's a
> short clip from my .bld file:
>
> ----------------------------------------------------------
> var csources = ["myalg_ialg.c", "myalg_tto_ialgvt.c"];
> var profiles = ["debug", "release"];
> for each (var targ in Build.targets) {
> for each (var prof in profiles) {
> var progName = "myalg_" + prof;
> Pkg.addLibrary( progName,
> targ,
> {profile : prof} ).addObjects(
> csources );
> }
> }
> ------------------------------------------------------------
>
> What is shown seems to work fine. Also, if I change a source file to
> "src/myalg_tto_ialg.c", that seems to work fine, too.
>
> The problem begins when I try to reference a source file elsewhere in my
> system. All of these following examples seem to fail:
>
> "../myalg_tto_ialg.c"
> "m:/another_directory/myalg_tto_ialg.c"
> "m:\another_directory\myalg_tto_ialg.c"
> "m:\\another_directory\\myalg_tto_ialg.c"
>
> Is there a trick that I'm missing? Any suggestions?
>
> Thanks,
> Scott
>
Sources are assumed to be in the package; source file names should be
relative to the package's base.

However, you _can_ build sources that are located _outside_ the package.
In fact, we do this in every target-specific rts packages (which
need to build the sources that are contained in the xdc.runtime package).

The "trick" to making this work requires that you add a bit of GNU make
magic to the generated makefile. You need to leverage GNU make's vpath
capability.

To build source in another directory you can add the following to you
package.bld:

/* set vpath for sources in another_directory */
Pkg.makePrologue = "vpath %.c m:/another_directory\n\n"

Now any time make is looking for foo.c and it does not find it, it will
look in m:/another_directory for "foo.c". If it finds it it will pass
the absolute path (m:/another_directory/foo.c) to the compiler.

For more info on vpath see see
http://www.gnu.org/software/make/manual/make.html#Selective- Search
Previous Topic:plans to extend platform model to support peripherals
Next Topic:Hungrier % in Diag?
Goto Forum:
  


Current Time: Fri Dec 19 16:03:35 GMT 2014

Powered by FUDForum. Page generated in 0.01732 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software