2 # Copyright (c) 2007-2008, Intel Corporation
4 # All rights reserved. This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 # Filename: build_rule.template
17 # "*" is used to indicate that the source files will be processed at the same time.
18 # "?" is used to indicate that the source files will be processed one by one.
20 # "[" <File-Type>[.<Build-Type>][.<Arch>][, <File-Type>[.<Build-Type>][.<Arch>]] "]" <EOL>
21 # <InputFile[.<ToolChainFamily>]> <EOL>
22 # (?|*).<File-Extension> [(\n|,) (?|*).<File-Extension>]
24 # <OutputFile[.<ToolChainFamily>]> <EOL>
30 # <Command[.<ToolChainFamily>]> <EOL>
34 # <Build-Type> is the MODULE_TYPE in EDK2 or COMPONENT_TYPE in EDK.
35 # Missing <InputFile> will cause an exception and break build.
36 # Missing <Command> will cause that related build target won't be generated but
40 ## Placeholders for string substitution
42 # ${src} Source file(s) to be built (full path)
43 # ${s_path} Source file directory (absolute path)
44 # ${s_dir} Source file relative directory within a module
45 # (Note: ${s_dir} is always equals to "." if source file is given in absolute path.)
46 # ${s_name} Source file name without path
47 # ${s_base} Source file name without extension and path
48 # ${s_ext} Source file extension
50 # ${dst} Destination file(s) built from ${src} (full path)
51 # ${d_path} Destination file directory (absolute path)
52 # ${d_name} Destination file name without path
53 # ${d_base} Destination file name without extension and path
54 # ${d_ext} Destination file extension
56 # (+) Directory separator
60 # $(WORKSPACE) Workspace directory
61 # $(OUTPUT_DIR) Directory for intermediate files for building a module
62 # $(DEBUG_DIR) Directory for files used to debug a module
63 # $(BUILD_DIR) All files for building a platform will be put in this directory
64 # $(BIN_DIR) Common directory for executable files
65 # $(FV_DIR) Directory to store flash image files
66 # $(INC) Search path of current module
67 # $(INC_LIST) A file containing search pathes of current module
68 # $(LIBS) Static library files of current module
69 # $(<tool>_FLAGS) Tools flags of current module
70 # $(MODULE_NAME) Current module name
71 # $(MODULE_TYPE) Current module type
72 # $(ARCH) Architecture of current module
73 # $(TOOLCHAIN) Toolchain used to build current module
74 # $(TARGET) Target of current module (DEBUG/RELEASE)
75 # $(<tool>) Path of tool
76 # $(EDK_TOOLS_PATH) Path of build tools
77 # $(<FILE_TYPES>) File list of each file type
78 # (Note: The macro name is derived from file type name. For example,
79 # C-Code-File will have C_CODE_FILES macro.)
80 # $(<FILE_TYPES_LIST>) Macro point to a file containing list of files of a file type
82 # Note: The macro and file name are derived from file type name.
83 # For example, C-Code-File will have C_CODE_FILES_LIST macro pointing
84 # to $(OUTPUT_DIR)/c_code_files.lst. The list file and macro name
85 # will be generated only when this macro is used in command line.
86 # This is intended to get over the long command line limitation.
91 # $(RM) delete command
92 # $(MD) create dir command
93 # $(RD) remove dir command
98 # Don't change following names of file types and their associated files,
99 # which are also used in tools' code
103 # Dynamic-Library-File
104 # Static-Library-File
105 # Visual-Form-Representation-File
123 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
125 <Command.MSFT, Command.INTEL>
126 "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
129 "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src}
140 [Assembly-Code-File.COMMON.COMMON]
141 <InputFile.MSFT, InputFile.INTEL>
151 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
153 <Command.MSFT, Command.INTEL>
154 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
155 Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
156 "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
159 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
160 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
161 "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
163 [Assembly-Code-File.COMMON.IPF]
171 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
173 <Command.MSFT, Command.INTEL>
174 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
175 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
176 "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii
178 [Visual-Form-Representation-File]
188 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
191 "$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
192 Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
193 -mkdir ${d_path} > NUL 2>&1
194 "$(VFR)" $(VFR_FLAGS) --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
202 $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
204 <Command.MSFT, Command.INTEL>
205 "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} $(OBJECT_FILES)
208 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) $(OBJECT_FILES)
210 [Static-Library-File]
218 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
220 <Command.MSFT, Command.INTEL>
221 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(STATIC_LIBRARY_FILES)
224 "$(DLINK)" -o ${dst} -Map $(DEBUG_DIR)(+)$(MODULE_NAME).map $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -\) $(DLINK2_FLAGS)
226 [Static-Library-File.USER_DEFINED]
234 $(DEBUG_DIR)(+)$(MODULE_NAME)
236 <Command.MSFT, Command.INTEL>
237 "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) $(STATIC_LIBRARY_FILES)
240 "$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -\) $(DLINK2_FLAGS)
242 [Dynamic-Library-File]
247 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
250 GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
251 $(CP) ${dst} $(OUTPUT_DIR)
252 $(CP) ${dst} $(BIN_DIR)
253 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
255 [Dependency-Expression-File]
260 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
263 "$(PP)" $(CC_FLAGS) $(APP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
264 Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
265 GenDepex -t $(MODULE_TYPE) -o ${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
267 [Acpi-Source-Language-File]
272 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
277 <Command.MSFT, Command.INTEL>
278 Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i ${src}
279 "$(ASLPP)" $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
280 "$(ASL)" -p ${dst} $(ASL_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
282 [C-Code-File.AcpiTable]
287 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
292 <Command.MSFT, Command.INTEL>
293 "$(ASLCC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
294 "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
295 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
297 [Acpi-Table-Code-File]
302 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
307 <Command.MSFT, Command.INTEL>
308 "$(ASLCC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
309 "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
310 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
314 ?.asm16, ?.Asm16, ?.ASM16
320 $(OUTPUT_DIR)(+)${s_base}.com
322 <Command.MSFT, Command.INTEL>
323 cd $(OUTPUT_DIR)(+)${s_dir}
324 "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}
325 "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
329 ?.txt, ?.TXT, ?.Txt, ?.mut
332 $(OUTPUT_DIR)(+)${s_base}.mcb
335 GenFw -o ${dst} -m ${src}
337 [Microcode-Binary-File]
342 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
345 GenFw -o ${dst} -j $(MICROCODE_BINARY_FILES)
346 -$(CP) ${dst} $(BIN_DIR)
361 $(DEBUG_DIR)(+)AutoGen.c
362 $(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h