X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FConf%2Fbuild_rule.template;h=8808afff281283656ae797c2a85ce96f779f3a54;hp=91407f17eb5f0367bf4f7e8201e1a3930d56ee3b;hb=d78f8ac7eee82794f2663cbfa38c8911df05e3a0;hpb=a9c9a31de867c87a4823414f057bc17632e9804a diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index 91407f17eb..8808afff28 100644 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -1,164 +1,308 @@ -# file extention : file type -FileTypeMapping = { - ".c" : "C-Code", - ".C" : "C-Code", - ".cpp" : "C-Code", - ".Cpp" : "C-Code", - ".CPP" : "C-Code", - ".h" : "C-Header", - ".H" : "C-Header", - ".asm" : "Masm-Code", - ".Asm" : "Masm-Code", - ".ASM" : "Masm-Code", - ".s" : "Iasm-Code", # IPF assembly code - ".S" : "Gasm-Code", # GNU assembly code - ".uni" : "Unicode-Text", - ".Uni" : "Unicode-Text", - ".UNI" : "Unicode-Text", - ".vfr" : "Visual-Form-Representation", - ".Vfr" : "Visual-Form-Representation", - ".VFR" : "Visual-Form-Representation", - ".dxs" : "Dependency-Expression", - ".Dxs" : "Dependency-Expression", - ".DXS" : "Dependency-Expression", - ".fv" : "FirmwareVolume", - ".Fv" : "FirmwareVolume", - ".FV" : "FirmwareVolume", - ".efi" : "Efi-Image", - ".Efi" : "Efi-Image", - ".EFI" : "Efi-Image", - ".SEC" : "Firmware-File-System", - ".PEI" : "Firmware-File-System", - ".DXE" : "Firmware-File-System", - ".APP" : "Firmware-File-System", - ".FYI" : "Firmware-File-System", - ".FFS" : "Firmware-File-System", - ".bmp" : "Bmp-Image", - ".i" : "Preprocessed-Code", - ".asl" : "Acpi-Source-Language", - ".Asl" : "Acpi-Source-Language", - ".ASL" : "Acpi-Source-Language", - ".obj" : "Object", - ".o" : "Object", - ".lib" : "Static-Library", - ".a" : "Static-Library", - ".dll" : "Dynamic-Library", - ".so" : "Dynamic-Library", -} - -DefaultToolCode = ["CC", "ASM", "SLINK", "DLINK", "PCH", "PP", "ASL", "VFRC", "AUTOGEN"] - -ToolCodeMapping = { - "C-Code" : "CC", - "C-Header" : "PCH", - "Masm-Code" : "ASM", - "Iasm-Code" : "ASM", # IPF assembly code - "Gasm-Code" : "ASM", # GNU assembly code - "Unicode-Text" : "AUTOGEN", - "Visual-Form-Representation" : "VFRC", - "Preprocessed-Code" : "CC", - "Acpi-Source-Language" : "ASL", - "Object" : "SLINK", - "Static-Library" : "DLINK", - "Dependency-Expression" : "PP", -} - -ToolChainFamilyMapping = { - "C-Code" : ["MSFT", "INTEL", "GCC"], - "C-Header" : ["MSFT", "INTEL", "GCC"], - "Masm-Code" : ["MSFT", "INTEL"], - "Iasm-Code" : ["MSFT", "INTEL"], # IPF assembly code - "Gasm-Code" : ["GCC"], # GNU assembly code - "Unicode-Text" : ["MSFT", "INTEL", "GCC"], - "Visual-Form-Representation" : ["MSFT", "INTEL", "GCC"], - "Dependency-Expression" : ["MSFT", "INTEL", "GCC"], - "FirmwareVolume" : ["MSFT", "INTEL", "GCC"], - "Efi-Image" : ["MSFT", "INTEL", "GCC"], - "Firmware-File-System" : ["MSFT", "INTEL", "GCC"], - "Bmp-Image" : ["MSFT", "INTEL", "GCC"], - "Preprocessed-Code" : ["MSFT", "INTEL"], - "Acpi-Source-Language" : ["MSFT", "INTEL"], -} - -## Build rules for makefile -# Placeholders for string substitution -# ${fpath} File path relative to $(WORKSPACE) -# ${fdir} File relative directory within a module -# ${fname} File full name without path -# ${fbase} File name without extension and path -# ${fext} File extension -# ${fdep} File dependencies -# ${sep} Directory separator -# -Makefile = { -"nmake" : { -"C-Code" : '''\ -$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(COMMON_DEPS) -${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE)${sep}${fdep} -${END} "$(CC)" $(CC_FLAGS) $(INC) /Fo$@ $(WORKSPACE)${sep}${fpath} -''', - -"Masm-Code" : '''\ -$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(COMMON_DEPS) -${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE)${sep}${fdep} -${END} "$(PP)" $(PP_FLAGS) $(INC) $(WORKSPACE)${sep}${fpath} > $(@D)${sep}${fbase}.i - Trim -CONVERT $(@D)${sep}${fbase}.i - "$(ASM)" $(ASM_FLAGS) /Fo$@ $(@D)${sep}${fbase}.iii -''', - -"Iasm-Code" : '''\ -$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(COMMON_DEPS) -${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE)${sep}${fdep} -${END} "$(APP)" $(APP_FLAGS) $(INC) $(WORKSPACE)${sep}${fpath} > $(@D)${sep}${fbase}.i - "$(ASM)" $(ASM_FLAGS) /Fo$@ $(@D)${sep}${fbase}.i -''', - -"Visual-Form-Representation" : -'$(OUTPUT_DIR)\\%(fdir)s\\%(fbase)s.obj : $(MODULE_DIR)\\%(fdir)s\\%(fname)s $(DEP_FILES)\n'\ - '\t"$(PP)" $(PP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)\\%(fbase)s.i\n'\ - '\t"$(VFRC)" $(VFRC_FLAGS) $(INC) $(VFRC_OUTPUT)$(DEBUG_DIR)\\%(fdir)s\\%(fbase)s.c $(@D)\\%(fbase)s.i\n'\ - '\t"$(CC)" $(CC_FLAGS) $(INC) $(CC_OUTPUT)$@ $(DEBUG_DIR)\\%(fdir)s\\%(fbase)s.c\n', -}, - -"gmake" : { -"C-Code" : -'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES) -\t"$(CC)" $(CC_FLAGS) $(INC) $(CC_OUTPUT)$@ $<''', - -"Masm-Code" : -'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES) -\t"$(PP)" $(PP_FLAGS) $(INC) $? $(PP_OUTPUT)$(@D)/%(fbase)s.i -\tTrim -CONVERT $(@D)/%(fbase)s.i -\t"$(ASM)" $(ASM_FLAGS) $(ASM_OUTPUT)$@ $(@D)/%(fbase)s.iii''', - -"Gasm-Code" : -'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES) -\t"$(ASM)" $(ASM_FLAGS) $(INC) $(ASM_OUTPUT)$@ $<''', - -"Iasm-Code" : -'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES) -\t"$(APP)" $(APP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)/%(fbase)s.i -\t"$(ASM)" $(ASM_FLAGS) $(ASM_OUTPUT)$@ $(@D)/%(fbase)s.i''', - -"Visual-Form-Representation" : -'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES) -\t"$(PP)" $(PP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)/%(fbase)s.i -\t"$(VFRC)" $(VFRC_FLAGS) $(INC) $(VFRC_OUTPUT)$(DEBUG_DIR)/%(fdir)s/%(fbase)s.c $(@D)/%(fbase)s.i -\t"$(CC)" $(CC_FLAGS) $(INC) $(CC_OUTPUT)$@ $(DEBUG_DIR)/%(fdir)s/%(fbase)s.c''', -} -} - -# This acts like the main() function for the script, unless it is 'import'ed into another -# script. -if __name__ == '__main__': - for ext in FileTypeMapping: - print ext,":",FileTypeMapping[ext] - - for type in Makefile["nmake"]: - print "[",type,"]\n",Makefile["nmake"][type] - print - - for type in Makefile["gmake"]: - print "[",type,"]\n",Makefile["gmake"][type] - print - +# +# Copyright (c) 2007, 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. +# +# Filename: build_rule.template +# + +## Syntax +# +# "*" is used to indicate that the source files will be processed at the same time. +# "?" is used to indicate that the source files will be processed one by one. +# +# "[" Build.[.][, Build.[.]] "]" +# ]> +# [File-Type =] (?|*). [(\n|,|;) (?|*).] +# +# ]> +# +# +# ]> +# +# [] +# + +## Placeholders for string substitution +# +# ${src} Source file(s) to be built (full path) +# ${s_path} Source file directory (absolute path) +# ${s_dir} Source file relative directory within a module +# (Note: ${s_dir} is always equals to "." if source file is given in absolute path.) +# ${s_name} Source file name without path +# ${s_base} Source file name without extension and path +# ${s_ext} Source file extension +# +# ${dst} Destination file(s) built from ${src} (full path) +# ${d_path} Destination file directory (absolute path) +# ${d_name} Destination file name without path +# ${d_base} Destination file name without extension and path +# ${d_ext} Destination file extension +# +# (+) Directory separator +# + +## Macro +# $(WORKSPACE) Workspace directory +# $(OUTPUT_DIR) Directory for intermediate files for building a module +# $(DEBUG_DIR) Directory for files used to debug a module +# $(BUILD_DIR) All files for building a platform will be put in this directory +# $(BIN_DIR) Common directory for executable files +# $(FV_DIR) Directory to store flash image files +# $(INC) Search path of current module +# $(LIBS) Static library files of current module +# $(_FLAGS) Tools flags of current module +# $(MODULE_NAME) Current module name +# $(MODULE_TYPE) Current module type +# $(ARCH) Architecture of current module +# $(TOOLCHAIN) Toolchain used to build current module +# $(TARGET) Target of current module (DEBUG/RELEASE) +# $() Path of tool +# $(EDK_TOOLS_PATH) Path of build tools +# $() File list of each file type +# (Note: The macro name is derived from file type name. For example, +# C-Code-File will have C_CODE_FILE_LIST macro.) +# +# $(CP) copy command +# $(MV) move command +# $(RM) delete command +# $(MD) create dir command +# $(RD) remove dir command +# + +## Reserved File-Type +# +# Don't change following names of file types and their associated files, +# which are also used in tools' code +# +# C-Code-File +# C-Header-File +# Dynamic-Library-File +# Static-Library-File +# Visual-Form-Representation-File +# Unicode-Text-File +# + +[Build.C-Code-File] + + ?.c + ?.C + ?.cc + ?.CC + ?.cpp + ?.Cpp + ?.CPP + + + $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj + + + "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src} + + + "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src} + +[Build.C-Header-File] + + *.h, *.H + + + $(OUTPUT_DIR)(+)$(MODULE_NAME).gch + $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj + + + + +[Build.Assembly-Code-File] + + Assembly-Code-File = ?.asm, ?.Asm, ?.ASM + + + ?.S + + + $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj + + + "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i + "$(ASM)" /Fo${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii + + + "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i + "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii + +[Build.Iasm-Code-File] + + ?.s + + + $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj + + + "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i + "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii + +[Build.Visual-Form-Representation-File] + + ?.vfr + ?.Vfr + ?.VFR + + + $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c + + + "$(PP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i + Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i + -mkdir ${d_path} > NUL 2>&1 + VfrCompile -od ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii + +[Build.Object-File] + + *.obj + *.o + + + $(OUTPUT_DIR)(+)$(MODULE_NAME).lib + + + "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} ${src} + + + "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src} + +#[Build.Object-File, Build.Static-Library-File] +#BUILD_VERSION = 0x00010000 +# +# +# Object-File = *.obj +# Static-Library-File = *.lib, *.a +# +# +# $(OUTPUT_DIR)(+)$(MODULE_NAME).lib +# +# +# "$(SLINK)" /OUT:${dst} $(SLINK_FLAGS) ${src} +# +# +# "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src1} -( ${src2} -) +# +[Build.Static-Library-File] + + ?.lib + $(LIBS) + $(MAKE_FILE) + + + ?.lib + $(LIBS) + $(MAKE_FILE) + + + $(DEBUG_DIR)(+)$(MODULE_NAME).dll + + + "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src} + + + "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(LIBS) ${src} -\) + +[Build.Dynamic-Library-File] + + ?.dll + + + $(DEBUG_DIR)(+)$(MODULE_NAME).efi + + + GenFw -e $(MODULE_TYPE) -o ${dst} ${src} + $(CP) ${dst} $(OUTPUT_DIR) + $(CP) ${dst} $(BIN_DIR) + -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR) + +[Build.Dependency-Expression-File] + + ?.dxs, ?.Dxs, ?.DXS + + + $(OUTPUT_DIR)(+)$(MODULE_NAME).depex + + + "$(PP)" $(CC_FLAGS) $(APP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i + Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i + GenDepex -t $(MODULE_TYPE) -o ${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii + +[Build.Acpi-Source-Language-File] + + ?.asl, ?.Asl, ?.ASL + + + $(OUTPUT_DIR)(+)${s_base}.aml + + + "$(PP)" $(APP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + "$(ASL)" -p ${dst} ${d_path}(+)${s_base}.i + +[Build.Acpi-Table-Code-File] + + ?.aslc + + + $(OUTPUT_DIR)(+)${s_base}.acpi + + + "$(CC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(INC) ${src} + "$(DLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj + GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll + +[Build.Masm16-Code-File] + + ?.asm16, ?.Asm16, ?.ASM16 + + + $(OUTPUT_DIR)(+)${s_base}.com + + + cd $(OUTPUT_DIR)(+)${s_dir} + "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src} + "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,, + +[Build.Microcode-File] + + ?.txt, ?.TXT, ?.Txt + + + $(OUTPUT_DIR)(+)${s_base}.mcb + + + GenFw -o ${dst} -m ${src} + +[Build.Microcode-Binary-File] + + *.mcb + + + $(OUTPUT_DIR)(+)$(MODULE_NAME).bin + + + GenFw -o ${dst} -j ${src} + +[Build.Unicode-Text-File] + + *.uni, *.Uni, *.UNI + + + $(DEBUG_DIR)(+)AutoGen.c + $(DEBUG_DIR)(+)AutoGen.h + + +