summaryrefslogtreecommitdiff
path: root/Tools/Source/TianoTools/build.xml
blob: d304f0a014c93cab67a3d106252189dca21eaf0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?xml version="1.0" encoding="utf-8" ?> 
<!--
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution.  The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-->
<project default="all" basedir="." name="C_Code">
<!-- Copyright (c) 2006, Intel Corporation -->
<!-- Filename: Tools/Source/build.xml -->

  <taskdef resource="net/sf/antcontrib/antlib.xml"/>

  <property name="ReallyVerbose" value="false"/>
  <property environment="env" />

  <property name="WORKSPACE" value="${env.WORKSPACE}" />
  <property name="WORKSPACE_DIR" value="${WORKSPACE}" />
  <property name="PACKAGE" value="Tools" />
  <property name="PACKAGE_DIR" value="${WORKSPACE}/Tools/Source/TianoTools" />
  <property name="LIB_DIR" value="${PACKAGE_DIR}/Library" />
  <property name="BIN_DIR" value="${WORKSPACE}/Tools/bin" />
  <property name="BUILD_MODE" value="PACKAGE" />
  <property name="Libs" 
    value="Common/build.xml CustomizedCompress/build.xml PeCoffLoader/build.xml String/build.xml"/>

  <import file="${WORKSPACE_DIR}/Tools/Conf/BuildMacro.xml" />

  <path id="classpath">
    <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
    <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
  </path>

  <taskdef classpathref="classpath" resource="GenBuild.tasks" />
  <taskdef classpathref="classpath" resource="net/sf/antcontrib/antlib.xml" />

  <taskdef classpathref="classpath" resource="cpptasks.tasks"/>
  <typedef classpathref="classpath" resource="cpptasks.types"/>

  <target name="all" depends="init, Tools">
    <echo message="The EDK II C Tools build complete!"/>
  </target>
  
  <target name="init">
    <echo message="EDK C Code Tools, build initialization"/>
    <mkdir dir="${BIN_DIR}" />
    <mkdir dir="${LIB_DIR}" />

    <condition property="HostArch" value="X64">
      <os arch="amd64"/>
    </condition>
    <condition property="HostArch" value="Ia32">
      <or>
        <os arch="x86"/>
        <os arch="i386"/>
      </or>
    </condition>
    <condition property="HostArch" value="Ia32">
      <os arch="i386"/>
    </condition> 

    <if>
      <os family="unix" />
      <then>
        <echo message="OS Family UNIX, ${HostArch}" />
      </then>
      <elseif>
        <os family="dos" />
        <then>
          <echo message="OS Family DOS, ${HostArch}" />
        </then>
      </elseif>
      <elseif>
        <os family="mac" />
        <then>
          <echo message="OS Family OS X, ${HostArch}" />
        </then>
      </elseif>
      <else>
        <fail message="OS Family Unsupported, ${HostArch}" />
      </else>
    </if>

    <if>
      <not>
        <isset property="ToolChain" />
      </not>
      <then>
        <if>
          <isset property="env.TOOL_CHAIN" />
          <then>
            <property name="ToolChain" value="${env.TOOL_CHAIN}"/>
          </then>
          <else>
            <!-- Default Tool Chain is Microsoft Visual Studio -->
            <property name="ToolChain" value="msvc"/>
          </else>
        </if>
      </then>
    </if>

    <condition property="linux" value="true">
      <os name="Linux"/>
    </condition>
    
    <condition property="intel_win">
      <and>
        <os family="dos"/>
        <equals arg1="${ToolChain}" arg2="intel"/>
      </and>
    </condition>
    
    <condition property="intel_linux">
      <and>
        <os name="Linux"/>
        <equals arg1="${ToolChain}" arg2="intel"/>
      </and>
    </condition>
    
    <condition property="intel_mac">
      <and>
        <os family="mac"/>
        <equals arg1="${ToolChain}" arg2="intel"/>
      </and>
    </condition>
    
    <condition property="gcc">
      <and>
        <equals arg1="${ToolChain}" arg2="gcc"/>
      </and>
    </condition>

    <condition property="cygwin">
      <and>
        <os family="dos"/>
        <equals arg1="${ToolChain}" arg2="gcc"/>
      </and>
    </condition>
    
    <condition property="x86_64_linux">
      <and>
        <os name="Linux"/>
        <equals arg1="${HostArch}" arg2="x64"/>
      </and>
    </condition>
    
    <condition property="windows" value="true">
      <os family="Windows"/>
    </condition>
    
    <condition property="OSX" value="true">
      <os family="Mac"/>
    </condition>

    <condition property="cyglinux">
      <or>
        <istrue value="linux"/>
        <istrue value="${cygwin}"/>
      </or>
    </condition>

    <!-- msft is a family, used by both Microsoft and Intel Windows compiler tool chains -->
    <condition property="msft">
      <isfalse value="${gcc}"/>
    </condition>

    <if>
      <istrue value="${ReallyVerbose}"/>
      <then>
        <echo message="Test property msvc:         ${msvc}"/> 
        <echo message="Test property gcc:          ${gcc}"/> 
        <echo message="Test property intel_win:    ${intel_win}"/> 
        <echo message="Test property intel_linux:  ${intel_linux}"/> 
        <echo message="Test property intel_mac:    ${intel_mac}"/> 
        <echo message="Test property msft:         ${msft}"/> 
        <echo message="Test property cygwin:       ${cygwin}"/> 
        <echo message="Test property cyglinux:     ${cyglinux}"/> 
        <echo message="Test property windows:      ${windows}"/> 
        <echo message="Test property linux:        ${linux}"/> 
        <echo message="Test property OSX:          ${OSX}"/> 
        <echo message="Test property x86_64_linux: ${x86_64_linux}"/> 
       </then>
    </if>

    <property name="haveLibtool" value="false"/>
    <if>
      <and>
        <not>
          <isset property="env.CYGWIN_HOME"/>
        </not>
          <isset property="cygwin"/>
      </and>
      <then>
        <fail message="You must set the environment variable: CYGWIN_HOME"/>
      </then>
    </if>

    <if>
        <istrue value="${gcc}"/>
      <then>
        <property name="ext_static" value=".a"/>
        <property name="ext_dynamic" value=".so"/>
        <if>
          <istrue value="${cygwin}"/>
          <then>
            <property name="ext_exe" value=".exe"/>
          </then>
          <else>
            <property name="ext_exe" value=""/>
          </else>
        </if>
      </then>
      <else>
        <property name="ext_static" value=".lib"/>
        <property name="ext_dynamic" value=".dll"/>
        <property name="ext_exe" value=".exe"/>
      </else>
    </if>
  </target>

  <target name="Libraries" depends="init">
    <subant target="" inheritall="true">
      <fileset dir="${PACKAGE_DIR}" 
        includes="${Libs}"/>
    </subant>
  </target>

  <target name="Tools" depends="Libraries">
    <subant target="" inheritall="true">
      <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"
        excludes="${Libs}"/>
    </subant>
  </target>

  <target name="clean" depends="init">
    <subant target="clean" inheritall="true">
      <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"/>
    </subant>
  </target>

  <target name="cleanall" depends="init">
    <subant target="cleanall" inheritall="true">
      <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"/>
    </subant>
    <delete dir="${LIB_DIR}"/>
  </target>
</project>