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