| # | |
| # 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.<File-Type>[.<version>][, Build.<File-Type>[.<version>]] "]" <EOL> | |
| # <InputFile[.<ToolChainFamily>]> <EOL> | |
| # [File-Type =] (?|*).<File-Extension> [(\n|,|;) (?|*).<File-Extension>] | |
| # | |
| # <OutputFile[.<ToolChainFamily>]> <EOL> | |
| # <FileFullPath> | |
| # | |
| # <Command[.<ToolChainFamily>]> <EOL> | |
| # <Command1> | |
| # [<Command2>] | |
| # | |
| ## 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 | |
| # $(<tool>_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) | |
| # $(<tool>) Path of tool | |
| # $(EDK_TOOLS_PATH) Path of build tools | |
| # $(<FILE_TYPE_LIST>) 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 | |
| # | |
| # Dont'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] | |
| <InputFile> | |
| ?.c | |
| ?.C | |
| ?.cc | |
| ?.CC | |
| ?.cpp | |
| ?.Cpp | |
| ?.CPP | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj | |
| <Command.MSFT, Command.INTEL> | |
| "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src} | |
| <Command.GCC> | |
| "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src} | |
| [Build.C-Header-File] | |
| <InputFile> | |
| *.h, *.H | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)$(MODULE_NAME).gch | |
| $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj | |
| <Command> | |
| [Build.Assembly-Code-File] | |
| <InputFile.MSFT, InputFile.INTEL> | |
| Assembly-Code-File = ?.asm, ?.Asm, ?.ASM | |
| <InputFile.GCC> | |
| ?.S | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj | |
| <Command.MSFT, Command.INTEL> | |
| "$(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 | |
| <Command.GCC> | |
| "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${src} | |
| [Build.Iasm-Code-File] | |
| <InputFile> | |
| ?.s | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj | |
| <Command.MSFT, Command.INTEL> | |
| "$(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] | |
| <InputFile> | |
| ?.vfr | |
| ?.Vfr | |
| ?.VFR | |
| <OutputFile> | |
| $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c | |
| <Command> | |
| "$(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] | |
| <InputFile> | |
| *.obj | |
| *.o | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)$(MODULE_NAME).lib | |
| <Command.MSFT, Command.INTEL> | |
| "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} ${src} | |
| <Command.GCC> | |
| "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src} | |
| #[Build.Object-File, Build.Static-Library-File] | |
| #BUILD_VERSION = 0x00010000 | |
| # | |
| # <InputFile> | |
| # Object-File = *.obj | |
| # Static-Library-File = *.lib, *.a | |
| # | |
| # <OutputFile> | |
| # $(OUTPUT_DIR)(+)$(MODULE_NAME).lib | |
| # | |
| # <Command.MSFT> | |
| # "$(SLINK)" /OUT:${dst} $(SLINK_FLAGS) ${src} | |
| # | |
| # <Command.GCC> | |
| # "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src1} -( ${src2} -) | |
| # | |
| [Build.Static-Library-File] | |
| <InputFile> | |
| ?.lib | |
| $(LIBS) | |
| <OutputFile> | |
| $(DEBUG_DIR)(+)$(MODULE_NAME).dll | |
| <Command.MSFT, Command.INTEL> | |
| "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src} | |
| <Command.GCC> | |
| "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(LIBS) ${src} -) | |
| [Build.Dynamic-Library-File] | |
| <InputFile> | |
| ?.dll | |
| <OutputFile> | |
| $(DEBUG_DIR)(+)$(MODULE_NAME).efi | |
| <Command> | |
| 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] | |
| <InputFile> | |
| ?.dxs, ?.Dxs, ?.DXS | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)$(MODULE_NAME).depex | |
| <Command> | |
| # GenDepex -o ${dst} ${src} | |
| [Build.Acpi-Source-Language-File] | |
| <InputFile> | |
| ?.asl, ?.Asl, ?.ASL | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)${s_base}.aml | |
| <Command.MSFT, Command.INTEL> | |
| "$(PP)" $(APP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i | |
| Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i | |
| "$(ASL)" -p ${dst} ${d_path}(+)${s_base}.iii | |
| [Build.Acpi-Table-Code-File] | |
| <InputFile> | |
| ?.aslc | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)${s_base}.acpi | |
| <Command.MSFT, Command.INTEL> | |
| "$(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] | |
| <InputFile> | |
| ?.asm16, ?.Asm16, ?.ASM16 | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.com | |
| <Command.MSFT, Command.INTEL> | |
| pushd . | |
| cd $(OUTPUT_DIR)(+)${s_dir} | |
| "$(ASM)" /nologo /omf ${src} /Bl"$(ASMLINK)" $(ASMLINK_FLAGS) | |
| -$(CP) ${dst} $(OUTPUT_DIR) & popd | |
| [Build.Microcode-File] | |
| <InputFile> | |
| ?.txt, ?.TXT, ?.Txt | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)${s_base}.mcb | |
| <Command> | |
| GenFw -o ${dst} -m ${src} | |
| [Build.Microcode-Binary-File] | |
| <InputFile> | |
| *.mcb | |
| <OutputFile> | |
| $(OUTPUT_DIR)(+)$(MODULE_NAME).bin | |
| <Command> | |
| GenFw -o ${dst} -j ${src} | |
| [Build.Unicode-Text-File] | |
| <InputFile> | |
| *.uni, *.Uni, *.UNI | |
| <OutputFile> | |
| $(DEBUG_DIR)(+)AutoGen.c | |
| $(DEBUG_DIR)(+)AutoGen.h | |
| <Command> | |