Add build macro to generate section type TE.
[mirror_edk2.git] / Tools / Conf / BuildMacro.xml
index 3c20e601d1765e737eaf7a033c1d24613246aeab..cbf35c94c904138f8d895b30b9e71d9dad5f82e4 100644 (file)
@@ -842,23 +842,63 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     </macrodef>\r
     -->\r
 \r
-  <!--\r
+  <!-- \r
     EFI_SECTION_TE\r
-    <macrodef name="EFI_SECTION_TE">\r
-      <attribute name="FILEPATH"/>\r
-      <attribute name="FILENAME"/>\r
-      <attribute name="FILEEXT" default=""/>\r
-  \r
-      <element name="EXTRA.INC" optional="yes"/>\r
-      <element name="EXTRA.ARG" optional="yes"/>\r
-  \r
-      <sequential>\r
-        <gensection inputfile="${BIN_DIR}/@{FILENAME}.@{FILEEXT}" \r
-                    outputfile="${BIN_DIR}/@{FILENAME}.pe32" \r
-                    sectiontype="EFI_SECTION_PE32"/>\r
-      </sequential>\r
-    </macrodef>\r
-    -->\r
+  -->\r
+  <macrodef name="EFI_SECTION_TE">\r
+    <attribute name="FILEPATH"/>\r
+    <attribute name="FILENAME"/>\r
+    <attribute name="FILEEXT" default="" />\r
+\r
+    <element name="PRE.PROCESS" optional="yes"/>\r
+    <element name="POST.PROCESS" optional="yes"/>\r
+\r
+    <sequential>\r
+      <PRE.PROCESS/>\r
+\r
+      <if>\r
+        <not>\r
+          <!-- TBD ${OBJECTS} -->\r
+          <equals arg1="${LIBS}" arg2=""/>\r
+        </not>\r
+\r
+        <then>\r
+          <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">\r
+            <LIB.ARG></LIB.ARG>\r
+            <LINK.ARG></LINK.ARG>\r
+          </GenDll>\r
+    \r
+          <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>\r
+        </then>\r
+      </if>\r
+\r
+      <OnDependency>\r
+        <sourcefiles>\r
+          <file name="${DEST_DIR_OUTPUT}\@{FILENAME}.efi"/>\r
+        </sourcefiles>\r
+        <targetfiles>\r
+          <file name="${DEST_DIR_OUTPUT}\@{FILENAME}.tes"/>\r
+        </targetfiles>\r
+\r
+        <sequential>\r
+          <copy file="${DEST_DIR_OUTPUT}\@{FILENAME}.efi" tofile="${BIN_DIR}\@{FILENAME}.efi" />\r
+          <copy file="${DEST_DIR_OUTPUT}\@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}\@{FILENAME}.efi" />\r
+          \r
+          <exec executable="${GENTEIMAGE}">\r
+            <arg line="-o ${DEST_DIR_OUTPUT}\@{FILENAME}.te ${DEST_DIR_OUTPUT}\@{FILENAME}.efi" />\r
+          </exec>\r
+          \r
+          <copy file="${DEST_DIR_OUTPUT}\@{FILENAME}.te" tofile="${BIN_DIR}\@{FILENAME}.te" />\r
+          \r
+          <gensection inputfile="${DEST_DIR_OUTPUT}\@{FILENAME}.te" \r
+                      outputfile="${DEST_DIR_OUTPUT}\@{FILENAME}.tes" \r
+                      sectiontype="EFI_SECTION_TE"/>\r
+          <POST.PROCESS/>\r
+        </sequential>\r
+      </OnDependency>\r
+    </sequential>\r
+  </macrodef>\r
+\r
 \r
   <!--\r
     EFI_SECTION_RAW\r