2 # Copyright (c) 2007-2008, Intel Corporation
\r
4 # All rights reserved. This program and the accompanying materials
\r
5 # are licensed and made available under the terms and conditions of the BSD License
\r
6 # which accompanies this distribution. The full text of the license may be found at
\r
7 # http://opensource.org/licenses/bsd-license.php
\r
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
\r
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
\r
12 # Filename: build_rule.template
\r
17 # "*" is used to indicate that the source files will be processed at the same time.
\r
18 # "?" is used to indicate that the source files will be processed one by one.
\r
20 # "[" <File-Type>[.<Build-Type>][.<Arch>][, <File-Type>[.<Build-Type>][.<Arch>]] "]" <EOL>
\r
21 # <InputFile[.<ToolChainFamily>]> <EOL>
\r
22 # (?|*).<File-Extension> [(\n|,) (?|*).<File-Extension>]
\r
24 # <OutputFile[.<ToolChainFamily>]> <EOL>
\r
30 # <Command[.<ToolChainFamily>]> <EOL>
\r
34 # <Build-Type> is the MODULE_TYPE in EDK2 or COMPONENT_TYPE in EDK.
\r
35 # Missing <InputFile> will cause an exception and break build.
\r
36 # Missing <Command> will cause that related build target won't be generated but
\r
37 # won't break build.
\r
40 ## Placeholders for string substitution
\r
42 # ${src} Source file(s) to be built (full path)
\r
43 # ${s_path} Source file directory (absolute path)
\r
44 # ${s_dir} Source file relative directory within a module
\r
45 # (Note: ${s_dir} is always equals to "." if source file is given in absolute path.)
\r
46 # ${s_name} Source file name without path
\r
47 # ${s_base} Source file name without extension and path
\r
48 # ${s_ext} Source file extension
\r
50 # ${dst} Destination file(s) built from ${src} (full path)
\r
51 # ${d_path} Destination file directory (absolute path)
\r
52 # ${d_name} Destination file name without path
\r
53 # ${d_base} Destination file name without extension and path
\r
54 # ${d_ext} Destination file extension
\r
56 # (+) Directory separator
\r
60 # $(WORKSPACE) Workspace directory
\r
61 # $(OUTPUT_DIR) Directory for intermediate files for building a module
\r
62 # $(DEBUG_DIR) Directory for files used to debug a module
\r
63 # $(BUILD_DIR) All files for building a platform will be put in this directory
\r
64 # $(BIN_DIR) Common directory for executable files
\r
65 # $(FV_DIR) Directory to store flash image files
\r
66 # $(INC) Search path of current module
\r
67 # $(LIBS) Static library files of current module
\r
68 # $(<tool>_FLAGS) Tools flags of current module
\r
69 # $(MODULE_NAME) Current module name
\r
70 # $(MODULE_TYPE) Current module type
\r
71 # $(ARCH) Architecture of current module
\r
72 # $(TOOLCHAIN) Toolchain used to build current module
\r
73 # $(TARGET) Target of current module (DEBUG/RELEASE)
\r
74 # $(<tool>) Path of tool
\r
75 # $(EDK_TOOLS_PATH) Path of build tools
\r
76 # $(<FILE_TYPE_LIST>) File list of each file type
\r
77 # (Note: The macro name is derived from file type name. For example,
\r
78 # C-Code-File will have C_CODE_FILE_LIST macro.)
\r
80 # $(CP) copy command
\r
81 # $(MV) move command
\r
82 # $(RM) delete command
\r
83 # $(MD) create dir command
\r
84 # $(RD) remove dir command
\r
87 ## Reserved File-Type
\r
89 # Don't change following names of file types and their associated files,
\r
90 # which are also used in tools' code
\r
94 # Dynamic-Library-File
\r
95 # Static-Library-File
\r
96 # Visual-Form-Representation-File
\r
114 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
116 <Command.MSFT, Command.INTEL>
\r
117 "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
\r
120 "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src}
\r
131 [Assembly-Code-File.COMMON.COMMON]
\r
132 <InputFile.MSFT, InputFile.INTEL>
\r
133 ?.asm, ?.Asm, ?.ASM
\r
142 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
144 <Command.MSFT, Command.INTEL>
\r
145 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
146 Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
\r
147 "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
\r
150 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
151 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
\r
152 "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
\r
154 [Assembly-Code-File.COMMON.IPF]
\r
162 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
164 <Command.MSFT, Command.INTEL>
\r
165 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
166 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
\r
167 "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii
\r
169 [Visual-Form-Representation-File]
\r
179 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
\r
182 "$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
183 Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
184 -mkdir ${d_path} > NUL 2>&1
\r
185 "$(VFR)" $(VFR_FLAGS) --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
\r
193 $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
\r
195 <Command.MSFT, Command.INTEL>
\r
196 "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} ${src}
\r
199 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src}
\r
201 [Static-Library-File]
\r
210 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
\r
212 <Command.MSFT, Command.INTEL>
\r
213 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src}
\r
216 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(LIBS) ${src} -\) $(DLINK2_FLAGS)
\r
218 [Dynamic-Library-File]
\r
223 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
\r
226 GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
\r
227 $(CP) ${dst} $(OUTPUT_DIR)
\r
228 $(CP) ${dst} $(BIN_DIR)
\r
229 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
\r
231 [Dependency-Expression-File]
\r
233 ?.dxs, ?.Dxs, ?.DXS
\r
236 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
\r
239 "$(PP)" $(CC_FLAGS) $(APP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
240 Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
241 GenDepex -t $(MODULE_TYPE) -o ${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
\r
243 [Acpi-Source-Language-File]
\r
245 ?.asl, ?.Asl, ?.ASL
\r
248 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
\r
253 <Command.MSFT, Command.INTEL>
\r
254 Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i ${src}
\r
255 "$(ASLPP)" $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
\r
256 "$(ASL)" -p ${dst} $(ASL_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
\r
258 [C-Code-File.AcpiTable]
\r
263 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
\r
268 <Command.MSFT, Command.INTEL>
\r
269 "$(ASLCC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
\r
270 "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
271 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
\r
273 [Acpi-Table-Code-File]
\r
278 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
\r
283 <Command.MSFT, Command.INTEL>
\r
284 "$(ASLCC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
\r
285 "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
286 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
\r
290 ?.asm16, ?.Asm16, ?.ASM16
\r
296 $(OUTPUT_DIR)(+)${s_base}.com
\r
298 <Command.MSFT, Command.INTEL>
\r
299 cd $(OUTPUT_DIR)(+)${s_dir}
\r
300 "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}
\r
301 "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
\r
305 ?.txt, ?.TXT, ?.Txt, ?.mut
\r
308 $(OUTPUT_DIR)(+)${s_base}.mcb
\r
311 GenFw -o ${dst} -m ${src}
\r
313 [Microcode-Binary-File]
\r
318 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
\r
321 GenFw -o ${dst} -j ${src}
\r
322 -$(CP) ${dst} $(BIN_DIR)
\r
324 [Unicode-Text-File]
\r
326 *.uni, *.Uni, *.UNI
\r
329 $(DEBUG_DIR)(+)AutoGen.c
\r
330 $(DEBUG_DIR)(+)AutoGen.h
\r
336 ?.efi, ?.Efi, ?.EFI
\r