Added support for MAKERULEDIR
[keystone-rtos/edma3_lld.git] / packages / ti / sdo / edma3 / drv / package.bld
1 /*
2  * package.bld
3  *
4  * xdc build specification file for the EDMA DRV module.
5  *
6  * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
7  *
8  *
9  *  Redistribution and use in source and binary forms, with or without
10  *  modification, are permitted provided that the following conditions
11  *  are met:
12  *
13  *    Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  *
16  *    Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the
19  *    distribution.
20  *
21  *    Neither the name of Texas Instruments Incorporated nor the names of
22  *    its contributors may be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37 */
39 var Build = xdc.useModule('xdc.bld.BuildEnvironment');
40 var Pkg = xdc.useModule('xdc.bld.PackageContents');
42 var objList = [
43     "src/edma3_drv_init.c",
44     "src/edma3_drv_basic.c",
45     "src/edma3_drv_adv.c",
46 ];
48 /* Targets supported */
49 var targ_supported = [
50                     'C64P',
51                     'C64P_big_endian',
52                     'C674',
53                     'Arm9',
54                     'A8F',
55                     'C66',
56                     'C66_big_endian',
57                     'M3',
58                ];
60 /* Directories for each target */
61 var dir = [
62             '64p/',
63             '64p/',
64             '674/',
65             'arm9/',
66             'a8/',
67             '66/',
68             '66/',
69             'm3/',
70           ];
72 for each (var targ in Build.targets)
73 {
74     /* compile the library only for the default platform otherwise error will 
75      * will be thrown by xdc that library already exists                      */
76     var plat = targ.platform;
78     var lib = "lib/";
79     var bool = 0;
80     
81     if (targ.platforms.length == 0)
82         continue;
84     for (var i = 0; i < targ_supported.length; i++)
85     {
86         if (java.lang.String(targ.name).equals(targ_supported[i]))
87         {
88             /* Choose the selected target */
89             lib = lib + dir[i];
90             bool = 1;
91             break;
92         }
93     }
95     if (bool == 0)
96         throw new Error('Unexpected value in "target" parameter')
97                 
98     if (java.lang.String(targ.model.endian).equals("big"))  {
99         Pkg.addLibrary(lib + "debug/" + Pkg.name, targ,
100             { defs:"-DBIG_ENDIAN_MODE", profile: "debug"}
101             ).addObjects(objList);
102         Pkg.addLibrary(lib + "release/" + Pkg.name, targ,
103             { defs:"-DBIG_ENDIAN_MODE", profile: "release"}
104             ).addObjects(objList);
105         benchmark("lib/release/" + Pkg.name, targ);            
106     } else {
107         Pkg.addLibrary(lib + "debug/" + Pkg.name, targ,
108             { defs:"", profile: "debug"}
109             ).addObjects(objList);
110         Pkg.addLibrary(lib + "release/" + Pkg.name, targ,
111             { defs:"", profile: "release"}
112             ).addObjects(objList);
113         benchmark("lib/release/" + Pkg.name, targ);            
114     }
117 function benchmark(lldFullLibraryPath, target)
119     /* Create the Epilogue; which executes after all the builds are completed. 
120      * This is used to generate the benchmark information for the built library. 
121      * Also add the benchmarking information file to the package. */
122     Pkg.makeEpilogue += ".libraries: benchmarking_" + target.suffix + "\n";
123     Pkg.makeEpilogue += "benchmarking_" + target.suffix + ":";
124     Pkg.makeEpilogue += "\n\t ofd6x.exe -x " + lldFullLibraryPath + ".a" + target.suffix + " > tmp.xml";
125     Pkg.makeEpilogue += "\n\t sectti.exe tmp.xml > " + lldFullLibraryPath + ".a" + target.suffix +  "_size.txt";
126     Pkg.makeEpilogue += "\n\t $(RM) tmp.xml\n\n";
127     Pkg.otherFiles[Pkg.otherFiles.length++] = lldFullLibraryPath + ".a" + target.suffix + "_size.txt";
129     /* We need to clean after ourselves; extend the 'clean' target to take care of this. */
130     Pkg.makeEpilogue += "clean::\n\t";
131     Pkg.makeEpilogue += "$(RM) " + lldFullLibraryPath + ".a" + target.suffix + "_size.txt\n\n";    
133 Pkg.otherFiles=[
134         '.settings/org.eclipse.cdt.core.prefs',
135         'docs',
136         'lib/debug/ti.sdo.edma3.drv.a64P',
137         'lib/debug/ti.sdo.edma3.drv.a64Pe',
138         'lib/debug/ti.sdo.edma3.drv.a674',
139         'lib/release/ti.sdo.edma3.drv.a64P',
140         'lib/release/ti.sdo.edma3.drv.a64Pe',
141         'lib/release/ti.sdo.edma3.drv.a674',
142         'lib/debug/ti.sdo.edma3.drv.ae64P',
143         'lib/debug/ti.sdo.edma3.drv.ae64Pe',
144         'lib/debug/ti.sdo.edma3.drv.ae674',
145         'lib/release/ti.sdo.edma3.drv.ae64P',
146         'lib/release/ti.sdo.edma3.drv.ae64Pe',
147         'lib/release/ti.sdo.edma3.drv.ae674',
148         'lib/debug/ti.sdo.edma3.drv.ae66',
149         'lib/debug/ti.sdo.edma3.drv.ae66e',
150         'lib/release/ti.sdo.edma3.drv.ae66',
151         'lib/release/ti.sdo.edma3.drv.ae66e',
152         'lib/release/ti.sdo.edma3.drv.a64P_size.txt',
153         'lib/release/ti.sdo.edma3.drv.a64Pe_size.txt',
154         'lib/release/ti.sdo.edma3.drv.ae64P_size.txt',
155         'lib/release/ti.sdo.edma3.drv.ae64Pe_size.txt',
156         'lib/release/ti.sdo.edma3.drv.ae66_size.txt',
157         'lib/release/ti.sdo.edma3.drv.ae66e_size.txt',
158         'src',
159         '.cdtproject',
160         '.project',
161         'DRV.xdc',
162         'edma3_drv.h',
163         'package.bld',
164         'package.xs',
165 ];