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