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 if (this.Settings.deviceType.equals("k2l") || this.Settings.deviceType.equals("k2e"))
21 {
22 name = this.$name + "2" + ".a" + suffix;
23 }
25 /* Read LIBDIR variable */
26 var lib = java.lang.System.getenv("LIBDIR");
28 /* If NULL, default to "lib" folder */
29 if (lib == null)
30 {
31 lib = "./lib";
32 } else {
33 print ("\tSystem environment LIBDIR variable defined : " + lib);
34 }
36 /* Get target folder, if applicable */
37 if ( java.lang.String(suffix).contains('66') )
38 lib = lib + "/c66";
40 /* Get library name with path */
41 lib = lib + "/" + name;
42 if (java.io.File(this.packageBase + lib).exists()) {
43 return lib;
44 }
46 /* Could not find any library, throw exception */
47 throw new Error("\tLibrary not found: " + this.packageBase + lib);
48 }
50 /*
51 * ======== package.close ========
52 */
53 function close()
54 {
55 if (xdc.om.$name != 'cfg') {
56 return;
57 }
58 }