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 /* Get library name with path */
55 lib = lib + "/" + name;
56 if (java.io.File(this.packageBase + lib).exists()) {
57 print ("\tLinking with library " + this.$name + ":" + lib);
58 return lib;
59 }
61 /* Could not find any library, throw exception */
62 throw new Error("\tLibrary not found: " + this.packageBase + lib);
63 }
65 /*
66 * ======== package.close ========
67 */
68 function close()
69 {
70 if (xdc.om.$name != 'cfg') {
71 return;
72 }
73 }