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 # Dont'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
103 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
105 <Command.MSFT, Command.INTEL>
106 "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
109 "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src}
111 [Build.C-Header-File]
116 $(OUTPUT_DIR)(+)$(MODULE_NAME).gch
117 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
122 [Build.Assembly-Code-File]
123 <InputFile.MSFT, InputFile.INTEL>
124 Assembly-Code-File = ?.asm, ?.Asm, ?.ASM
130 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
132 <Command.MSFT, Command.INTEL>
133 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
134 Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
135 "$(ASM)" /Fo${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
138 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
139 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
140 "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
142 [Build.Iasm-Code-File]
147 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
149 <Command.MSFT, Command.INTEL>
150 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
151 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
152 "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii
154 [Build.Visual-Form-Representation-File]
161 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
164 "$(PP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
165 Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
166 -mkdir ${d_path} > NUL 2>&1
167 VfrCompile -od ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
175 $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
177 <Command.MSFT, Command.INTEL>
178 "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} ${src}
181 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src}
183 #[Build.Object-File, Build.Static-Library-File]
184 #BUILD_VERSION = 0x00010000
187 # Object-File = *.obj
188 # Static-Library-File = *.lib, *.a
191 # $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
194 # "$(SLINK)" /OUT:${dst} $(SLINK_FLAGS) ${src}
197 # "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src1} -( ${src2} -)
199 [Build.Static-Library-File]
203 $(MODULE_BUILD_DIR)\Makefile
206 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
208 <Command.MSFT, Command.INTEL>
209 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src}
212 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(LIBS) ${src} -)
214 [Build.Dynamic-Library-File]
219 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
222 GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
223 $(CP) ${dst} $(OUTPUT_DIR)
224 $(CP) ${dst} $(BIN_DIR)
225 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
227 [Build.Dependency-Expression-File]
232 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
235 # GenDepex -o ${dst} ${src}
237 [Build.Acpi-Source-Language-File]
242 $(OUTPUT_DIR)(+)${s_base}.aml
244 <Command.MSFT, Command.INTEL>
245 "$(PP)" $(APP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
246 "$(ASL)" -p ${dst} ${d_path}(+)${s_base}.i
248 [Build.Acpi-Table-Code-File]
253 $(OUTPUT_DIR)(+)${s_base}.acpi
255 <Command.MSFT, Command.INTEL>
256 "$(CC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(INC) ${src}
257 "$(DLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
258 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
260 [Build.Masm16-Code-File]
262 ?.asm16, ?.Asm16, ?.ASM16
265 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.com
267 <Command.MSFT, Command.INTEL>
269 cd $(OUTPUT_DIR)(+)${s_dir}
270 "$(ASM)" /nologo /omf ${src} /Bl"$(ASMLINK)" $(ASMLINK_FLAGS)
271 -$(CP) ${dst} $(OUTPUT_DIR) & popd
273 [Build.Microcode-File]
278 $(OUTPUT_DIR)(+)${s_base}.mcb
281 GenFw -o ${dst} -m ${src}
283 [Build.Microcode-Binary-File]
288 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
291 GenFw -o ${dst} -j ${src}
293 [Build.Unicode-Text-File]
298 $(DEBUG_DIR)(+)AutoGen.c
299 $(DEBUG_DIR)(+)AutoGen.h