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