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 'c6657'\r
37 ];\r
38 \r
39 /* Search for the supported devices (defined in config.bld) */\r
40 for each(var device in deviceTypes)\r
41 {\r
42 if (this.Settings.deviceType.equals(device))\r
43 {\r
44 lib = lib + "/" + device;\r
45 break;\r
46 }\r
47 }\r
48 \r
49 /* Get target folder, if applicable */\r
50 if ( java.lang.String(suffix).contains('66') )\r
51 lib = lib + "/c66";\r
52 \r
53 /* Get library name with path */\r
54 lib = lib + "/" + name;\r
55 if (java.io.File(this.packageBase + lib).exists()) {\r
56 print ("\tLinking with library " + this.$name + ":" + lib);\r
57 return lib;\r
58 }\r
59 \r
60 /* Could not find any library, throw exception */\r
61 throw new Error("\tLibrary not found: " + this.packageBase + lib);\r
62 }\r
63 \r
64 /*\r
65 * ======== package.close ========\r
66 */\r
67 function close()\r
68 { \r
69 if (xdc.om.$name != 'cfg') {\r
70 return;\r
71 }\r
72 }\r