summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael D Kinney <michael.d.kinney@intel.com>2024-12-28 02:34:11 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-01-21 08:02:38 +0300
commit8d0e23d998e6181b3ba032bfc7e3217f8c396c69 (patch)
treeec68d1a35811ac2788b2badee504afa927368dda
parentca4e19ccc2dae7d2874fcba6bc1d78e9076d5fcc (diff)
downloadedk2-8d0e23d998e6181b3ba032bfc7e3217f8c396c69.tar.xz
BaseTools/Conf: Simplify VS20xx HOST_APPLICATION builds
Add Empty_C_File_Host_Application_Build.c to BaseTools/Conf that is a C source file with only comments that is used to compile into an OBJ file using CC_FLAGS for a HOST_APPLICATION module and the OBJ is passed into the VS20xx DLINK action to provide the context required to select the correct default windows application libraries. Update build_rule.template to compile the empty C file and generate OBJ in the OUTPUT_DIR of the HOST_APPLICATION component and use the OBJ in the DLINK action. This simplifies CC_FLAGS and DLINK_FLAGS for all modules of type HOST_APPLICATION. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
-rw-r--r--BaseTools/Conf/Empty_C_File_Host_Application_Build.c7
-rwxr-xr-xBaseTools/Conf/build_rule.template26
2 files changed, 32 insertions, 1 deletions
diff --git a/BaseTools/Conf/Empty_C_File_Host_Application_Build.c b/BaseTools/Conf/Empty_C_File_Host_Application_Build.c
new file mode 100644
index 0000000000..3a7380f88c
--- /dev/null
+++ b/BaseTools/Conf/Empty_C_File_Host_Application_Build.c
@@ -0,0 +1,7 @@
+/** @file
+ This is an empty C source file used in VS20xx HOST_APPLICATION
+ builds.
+
+ Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index 370cf50107..0f32cc398e 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -322,7 +322,7 @@
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
-[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
+[Static-Library-File.USER_DEFINED]
<InputFile>
*.lib
@@ -340,6 +340,30 @@
<Command.XCODE>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
+
+[Static-Library-File.HOST_APPLICATION]
+ <InputFile>
+ *.lib
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(DEBUG_DIR)(+)$(MODULE_NAME)
+
+ <Command.MSFT, Command.INTEL>
+ "$(CC)" /Fo$(OUTPUT_DIR)/Empty_C_File_Host_Application_Build.obj $(CC_FLAGS) $(INC) $(EDK_TOOLS_PATH)/Conf/Empty_C_File_Host_Application_Build.c
+ "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) $(OUTPUT_DIR)/Empty_C_File_Host_Application_Build.obj @$(STATIC_LIBRARY_FILES_LIST)
+
+ <Command.CLANGPDB>
+ "$(CC)" -o $(OUTPUT_DIR)/Empty_C_File_Host_Application_Build.obj $(CC_FLAGS) $(INC) $(EDK_TOOLS_PATH)/Conf/Empty_C_File_Host_Application_Build.c
+ "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) $(OUTPUT_DIR)/Empty_C_File_Host_Application_Build.obj @$(STATIC_LIBRARY_FILES_LIST)
+
+ <Command.GCC>
+ "$(DLINK)" $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)
+
+ <Command.XCODE>
+ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
[Dynamic-Library-File]