2 # Copyright (c) 2007, 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 # "[" Build.<File-Type>[.<version>][, Build.<File-Type>[.<version>]] "]" <EOL>
\r
21 # <InputFile[.<ToolChainFamily>]> <EOL>
\r
22 # [File-Type =] (?|*).<File-Extension> [(\n|,|;) (?|*).<File-Extension>]
\r
24 # <OutputFile[.<ToolChainFamily>]> <EOL>
\r
27 # <Command[.<ToolChainFamily>]> <EOL>
\r
32 ## Placeholders for string substitution
\r
34 # ${src} Source file(s) to be built (full path)
\r
35 # ${s_path} Source file directory (absolute path)
\r
36 # ${s_dir} Source file relative directory within a module
\r
37 # (Note: ${s_dir} is always equals to "." if source file is given in absolute path.)
\r
38 # ${s_name} Source file name without path
\r
39 # ${s_base} Source file name without extension and path
\r
40 # ${s_ext} Source file extension
\r
42 # ${dst} Destination file(s) built from ${src} (full path)
\r
43 # ${d_path} Destination file directory (absolute path)
\r
44 # ${d_name} Destination file name without path
\r
45 # ${d_base} Destination file name without extension and path
\r
46 # ${d_ext} Destination file extension
\r
48 # (+) Directory separator
\r
52 # $(WORKSPACE) Workspace directory
\r
53 # $(OUTPUT_DIR) Directory for intermediate files for building a module
\r
54 # $(DEBUG_DIR) Directory for files used to debug a module
\r
55 # $(BUILD_DIR) All files for building a platform will be put in this directory
\r
56 # $(BIN_DIR) Common directory for executable files
\r
57 # $(FV_DIR) Directory to store flash image files
\r
58 # $(INC) Search path of current module
\r
59 # $(LIBS) Static library files of current module
\r
60 # $(<tool>_FLAGS) Tools flags of current module
\r
61 # $(MODULE_NAME) Current module name
\r
62 # $(MODULE_TYPE) Current module type
\r
63 # $(ARCH) Architecture of current module
\r
64 # $(TOOLCHAIN) Toolchain used to build current module
\r
65 # $(TARGET) Target of current module (DEBUG/RELEASE)
\r
66 # $(<tool>) Path of tool
\r
67 # $(EDK_TOOLS_PATH) Path of build tools
\r
68 # $(<FILE_TYPE_LIST>) File list of each file type
\r
69 # (Note: The macro name is derived from file type name. For example,
\r
70 # C-Code-File will have C_CODE_FILE_LIST macro.)
\r
72 # $(CP) copy command
\r
73 # $(MV) move command
\r
74 # $(RM) delete command
\r
75 # $(MD) create dir command
\r
76 # $(RD) remove dir command
\r
79 ## Reserved File-Type
\r
81 # Don't change following names of file types and their associated files,
\r
82 # which are also used in tools' code
\r
86 # Dynamic-Library-File
\r
87 # Static-Library-File
\r
88 # Visual-Form-Representation-File
\r
104 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
106 <Command.MSFT, Command.INTEL>
\r
107 "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
\r
110 "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src}
\r
112 [Build.C-Header-File]
\r
117 $(OUTPUT_DIR)(+)$(MODULE_NAME).gch
\r
118 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
123 [Build.Assembly-Code-File]
\r
124 <InputFile.MSFT, InputFile.INTEL>
\r
125 Assembly-Code-File = ?.asm, ?.Asm, ?.ASM
\r
133 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
135 <Command.MSFT, Command.INTEL>
\r
136 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
137 Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
\r
138 "$(ASM)" /Fo${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
\r
141 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
142 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
\r
143 "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
\r
145 [Build.Iasm-Code-File]
\r
151 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
153 <Command.MSFT, Command.INTEL>
\r
154 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
155 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
\r
156 "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii
\r
158 [Build.Visual-Form-Representation-File]
\r
166 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
\r
169 "$(PP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
170 Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
171 -mkdir ${d_path} > NUL 2>&1
\r
172 VfrCompile -l --no-pre-processing --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
\r
174 [Build.Object-File]
\r
180 $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
\r
182 <Command.MSFT, Command.INTEL>
\r
183 "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} ${src}
\r
186 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src}
\r
188 #[Build.Object-File, Build.Static-Library-File]
\r
189 #BUILD_VERSION = 0x00010000
\r
192 # Object-File = *.obj
\r
193 # Static-Library-File = *.lib, *.a
\r
196 # $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
\r
199 # "$(SLINK)" /OUT:${dst} $(SLINK_FLAGS) ${src}
\r
202 # "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src1} -( ${src2} -)
\r
204 [Build.Static-Library-File]
\r
205 <InputFile.MSFT, InputFile.Intel>
\r
216 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
\r
218 <Command.MSFT, Command.INTEL>
\r
219 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src}
\r
222 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(LIBS) ${src} -\)
\r
224 [Build.Dynamic-Library-File]
\r
229 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
\r
232 GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
\r
233 $(CP) ${dst} $(OUTPUT_DIR)
\r
234 $(CP) ${dst} $(BIN_DIR)
\r
235 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
\r
237 [Build.Dependency-Expression-File]
\r
239 ?.dxs, ?.Dxs, ?.DXS
\r
242 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
\r
245 "$(PP)" $(CC_FLAGS) $(APP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
246 Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
247 GenDepex -t $(MODULE_TYPE) -o ${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
\r
249 [Build.Acpi-Source-Language-File]
\r
251 ?.asl, ?.Asl, ?.ASL
\r
254 $(OUTPUT_DIR)(+)${s_base}.aml
\r
256 <Command.MSFT, Command.INTEL>
\r
257 "$(PP)" $(APP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
258 "$(ASL)" -p ${dst} $(ASL_FLAGS) ${d_path}(+)${s_base}.i
\r
260 [Build.Acpi-Table-Code-File]
\r
265 $(OUTPUT_DIR)(+)${s_base}.acpi
\r
267 <Command.MSFT, Command.INTEL>
\r
268 "$(CC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(INC) ${src}
\r
269 "$(DLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
270 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
\r
272 [Build.Masm16-Code-File]
\r
274 ?.asm16, ?.Asm16, ?.ASM16
\r
277 $(OUTPUT_DIR)(+)${s_base}.com
\r
279 <Command.MSFT, Command.INTEL>
\r
280 cd $(OUTPUT_DIR)(+)${s_dir}
\r
281 "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}
\r
282 "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
\r
284 [Build.Microcode-File]
\r
286 ?.txt, ?.TXT, ?.Txt
\r
289 $(OUTPUT_DIR)(+)${s_base}.mcb
\r
292 GenFw -o ${dst} -m ${src}
\r
294 [Build.Microcode-Binary-File]
\r
299 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
\r
302 GenFw -o ${dst} -j ${src}
\r
303 -$(CP) ${dst} $(BIN_DIR)
\r
305 [Build.Unicode-Text-File]
\r
307 *.uni, *.Uni, *.UNI
\r
310 $(DEBUG_DIR)(+)AutoGen.c
\r
311 $(DEBUG_DIR)(+)AutoGen.h
\r