8dd787bd2f0181174496fe3eabeea401c416b9c0
1 /*
2 * Copyright (c) 2012-2013, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
33 /*
34 * ======== package.xs ========
35 */
37 /*
38 * ======== package.close ========
39 */
40 function close()
41 {
42 if (xdc.om.$name != 'cfg') {
43 return;
44 }
46 /* Force the Build module to get used if any module
47 * in this package is used.
48 */
49 for (var mod in this.$modules) {
50 if (this.$modules[mod].$used == true) {
51 xdc.useModule('ti.sdo.ipc.Build');
52 break;
53 }
54 }
55 }
57 /*
58 * ======== Package.getLibs ========
59 * This function is called when a program's configuration files are
60 * being generated and it returns the name of a library appropriate
61 * for the program's configuration.
62 */
63 function getLibs(prog)
64 {
65 var BIOS = xdc.module('ti.sysbios.BIOS');
66 var lib;
67 var libPath;
68 var suffix;
70 var Build = xdc.module('ti.sdo.ipc.Build');
72 switch (Build.libType) {
73 case Build.LibType_Instrumented:
74 case Build.LibType_NonInstrumented:
75 case Build.LibType_Custom:
76 case Build.LibType_Debug:
77 if (Build.$used == false) return (null);
78 lib = Build.$private.outputDir + Build.$private.libraryName;
79 return ("!" + String(java.io.File(lib).getCanonicalPath()));
81 case Build.LibType_PkgLib:
82 /* lib path defined in Build.buildLibs() */
83 libPath = (BIOS.smpEnabled ? "lib/smpipc/debug" : "lib/ipc/debug");
85 /* find a compatible suffix */
86 if ("findSuffix" in prog.build.target) {
87 suffix = prog.build.target.findSuffix(this);
88 }
89 else {
90 suffix = prog.build.target.suffix;
91 }
92 return (libPath + "/" + this.$name + ".a" + suffix);
94 default:
95 throw new Error("unknown Build.libType: " + Build.libType);
96 }
97 }
99 /*
100 * ======== Package.getSects ========
101 */
102 function getSects()
103 {
104 return "ti/sdo/ipc/linkcmd.xdt";
105 }