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 {
17 var suffix = prog.build.target.suffix;
19 /* Default FM library */
20 var name = this.$name + ".a" + suffix;
21 /* Read LIBDIR variable */
22 var lib = java.lang.System.getenv("LIBDIR");
24 /* If NULL, default to "lib" folder */
25 if (lib == null)
26 {
27 lib = "./lib";
28 } else {
29 print ("\tSystem environment LIBDIR variable defined : " + lib);
30 }
32 /* Device types supported */
33 var deviceTypes = [
34 'tci6614',
35 'k2k',
36 'k2h',
37 'k2l',
38 'k2e',
39 ];
41 /* Search for the supported devices (defined in config.bld) */
42 for each(var device in deviceTypes)
43 {
44 if (this.Settings.deviceType.equals(device))
45 {
46 lib = lib + "/" + device;
47 break;
48 }
49 }
51 /* Get target folder, if applicable */
52 if ( java.lang.String(suffix).contains('66') )
53 lib = lib + "/c66";
55 /* Get library name with path */
56 lib = lib + "/" + name;
57 if (java.io.File(this.packageBase + lib).exists()) {
58 print ("\tLinking with library " + this.$name + ":" + lib);
59 return lib;
60 }
62 /* Could not find any library, throw exception */
63 throw new Error("\tLibrary not found : " + name);
64 }
66 /*
67 * ======== package.close ========
68 */
69 function close()
70 {
71 if (xdc.om.$name != 'cfg') {
72 return;
73 }
74 }