1 /*
2 * ======== package.xs ========
3 *
4 */
7 /*
8 * ======== Package.getLibs ========
9 * This function is called when a program's configuration files are
10 * being generated and it returns the name of a library appropriate
11 * for the program's configuration.
12 */
14 function getLibs(prog)
15 {
16 var suffix = prog.build.target.suffix;
18 var name = this.$name + ".a" + suffix;
20 /* Read LIBDIR variable */
21 var lib = java.lang.System.getenv("LIBDIR");
23 /* If NULL, default to "lib" folder */
24 if (lib == null)
25 {
26 lib = "./lib";
27 } else {
28 print ("\tSystem environment LIBDIR variable defined : " + lib);
29 }
31 /* Device types supported */
32 var deviceTypes = [
33 'k2g',
34 'omapl138',
35 'c6657'
36 ];
38 /* Search for the supported devices (defined in config.bld) */
39 for each(var device in deviceTypes)
40 {
41 if (this.Settings.deviceType.equals(device))
42 {
43 lib = lib + "/" + device;
44 break;
45 }
46 }
48 /* Get target folder, if applicable */
49 if ( java.lang.String(suffix).contains('66') )
50 lib = lib + "/c66";
51 else if ( java.lang.String(suffix).contains('674') )
52 lib = lib + "/c674";
54 var libProfiles = ["debug", "release"];
55 for each(var profile in libProfiles)
56 {
57 if (this.Settings.libProfile.equals(profile))
58 {
59 lib = lib + "/" + profile;
60 break;
61 }
62 }
65 /* Get library name with path */
66 lib = lib + "/" + name;
67 if (java.io.File(this.packageBase + lib).exists()) {
68 print ("\tLinking with library " + this.$name + ":" + lib);
69 return lib;
70 }
72 /* Could not find any library, throw exception */
73 throw new Error("\tLibrary not found: " + this.packageBase + lib);
74 }
76 /*
77 * ======== package.close ========
78 */
79 function close()
80 {
81 if (xdc.om.$name != 'cfg') {
82 return;
83 }
84 }