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 # Dont'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
103 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
105 <Command.MSFT, Command.INTEL>
\r
106 "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
\r
109 "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src}
\r
111 [Build.C-Header-File]
\r
116 $(OUTPUT_DIR)(+)$(MODULE_NAME).gch
\r
117 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
122 [Build.Assembly-Code-File]
\r
123 <InputFile.MSFT, InputFile.INTEL>
\r
124 Assembly-Code-File = ?.asm, ?.Asm, ?.ASM
\r
130 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
132 <Command.MSFT, Command.INTEL>
\r
133 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
134 Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
\r
135 "$(ASM)" /Fo${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
\r
138 "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${src}
\r
140 [Build.Iasm-Code-File]
\r
145 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
147 <Command.MSFT, Command.INTEL>
\r
148 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
149 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
\r
150 "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii
\r
152 [Build.Visual-Form-Representation-File]
\r
159 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
\r
162 "$(PP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
163 Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
\r
164 -mkdir ${d_path} > NUL 2>&1
\r
165 VfrCompile -od ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
\r
167 [Build.Object-File]
\r
173 $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
\r
175 <Command.MSFT, Command.INTEL>
\r
176 "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} ${src}
\r
179 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src}
\r
181 #[Build.Object-File, Build.Static-Library-File]
\r
182 #BUILD_VERSION = 0x00010000
\r
185 # Object-File = *.obj
\r
186 # Static-Library-File = *.lib, *.a
\r
189 # $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
\r
192 # "$(SLINK)" /OUT:${dst} $(SLINK_FLAGS) ${src}
\r
195 # "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src1} -( ${src2} -)
\r
197 [Build.Static-Library-File]
\r
203 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
\r
205 <Command.MSFT, Command.INTEL>
\r
206 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src}
\r
209 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(LIBS) ${src} -)
\r
211 [Build.Dynamic-Library-File]
\r
212 <InputFile.MSFT, InputFile.INTEL>
\r
214 $(MODULE_BUILD_DIR)\Makefile
\r
218 $(MODULE_BUILD_DIR)\Makefile
\r
221 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
\r
224 GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
\r
225 $(CP) ${dst} $(OUTPUT_DIR)
\r
226 $(CP) ${dst} $(BIN_DIR)
\r
227 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
\r
229 [Build.Dependency-Expression-File]
\r
231 ?.dxs, ?.Dxs, ?.DXS
\r
234 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
\r
237 # GenDepex -o ${dst} ${src}
\r
239 [Build.Acpi-Source-Language-File]
\r
241 ?.asl, ?.Asl, ?.ASL
\r
244 $(OUTPUT_DIR)(+)${s_base}.aml
\r
246 <Command.MSFT, Command.INTEL>
\r
247 "$(PP)" $(APP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
\r
248 "$(ASL)" -p ${dst} ${d_path}(+)${s_base}.i
\r
250 [Build.Acpi-Table-Code-File]
\r
255 $(OUTPUT_DIR)(+)${s_base}.acpi
\r
257 <Command.MSFT, Command.INTEL>
\r
258 "$(CC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(INC) ${src}
\r
259 "$(DLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
\r
260 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
\r
262 [Build.Masm16-Code-File]
\r
264 ?.asm16, ?.Asm16, ?.ASM16
\r
267 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.com
\r
269 <Command.MSFT, Command.INTEL>
\r
271 cd $(OUTPUT_DIR)(+)${s_dir}
\r
272 "$(ASM)" /nologo /omf ${src} /Bl"$(ASMLINK)" $(ASMLINK_FLAGS)
\r
273 -$(CP) ${dst} $(OUTPUT_DIR) & popd
\r
275 [Build.Microcode-File]
\r
277 ?.txt, ?.TXT, ?.Txt
\r
280 $(OUTPUT_DIR)(+)${s_base}.mcb
\r
283 GenFw -o ${dst} -m ${src}
\r
285 [Build.Microcode-Binary-File]
\r
290 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
\r
293 GenFw -o ${dst} -j ${src}
\r
295 [Build.Unicode-Text-File]
\r
297 *.uni, *.Uni, *.UNI
\r
300 $(DEBUG_DIR)(+)AutoGen.c
\r
301 $(DEBUG_DIR)(+)AutoGen.h
\r