Specifying src path in 'package.bld' [message #5484] |
Wed, 22 July 2009 06:22  |
Eclipse User |
|
|
|
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 13:25  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03346 seconds