]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Conf/build_rule.template
update
[mirror_edk2.git] / BaseTools / Conf / build_rule.template
1 #
2 # Copyright (c) 2007-2009, Intel Corporation
3 #
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
8
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.
11 #
12 # Filename: build_rule.template
13 #
14
15 ## Syntax
16 #
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.
19 #
20 # "[" <File-Type>[.<Build-Type>][.<Arch>][, <File-Type>[.<Build-Type>][.<Arch>]] "]" <EOL>
21 # <InputFile[.<ToolChainFamily>]> <EOL>
22 # (?|*).<File-Extension> [(\n|,) (?|*).<File-Extension>]
23 #
24 # <OutputFile[.<ToolChainFamily>]> <EOL>
25 # <FileFullPath>
26 #
27 # <ExtraDependency>
28 # <FileFullPath>
29 #
30 # <Command[.<ToolChainFamily>]> <EOL>
31 # <Command1>
32 # [<Command2>]
33 #
34 # <Build-Type> is the MODULE_TYPE in EDK2 or COMPONENT_TYPE in EDK.
35 # Missing <InputFile> will cause an exception and break build.
36 # Missing <Command> will cause that related build target won't be generated but
37 # won't break build.
38 #
39
40 ## Placeholders for string substitution
41 #
42 # ${src} Source file(s) to be built (full path)
43 # ${s_path} Source file directory (absolute path)
44 # ${s_dir} Source file relative directory within a module
45 # (Note: ${s_dir} is always equals to "." if source file is given in absolute path.)
46 # ${s_name} Source file name without path
47 # ${s_base} Source file name without extension and path
48 # ${s_ext} Source file extension
49 #
50 # ${dst} Destination file(s) built from ${src} (full path)
51 # ${d_path} Destination file directory (absolute path)
52 # ${d_name} Destination file name without path
53 # ${d_base} Destination file name without extension and path
54 # ${d_ext} Destination file extension
55 #
56 # (+) Directory separator
57 #
58
59 ## Macro
60 # $(WORKSPACE) Workspace directory
61 # $(OUTPUT_DIR) Directory for intermediate files for building a module
62 # $(DEBUG_DIR) Directory for files used to debug a module
63 # $(BUILD_DIR) All files for building a platform will be put in this directory
64 # $(BIN_DIR) Common directory for executable files
65 # $(FV_DIR) Directory to store flash image files
66 # $(INC) Search path of current module
67 # $(INC_LIST) A file containing search pathes of current module
68 # $(LIBS) Static library files of current module
69 # $(<tool>_FLAGS) Tools flags of current module
70 # $(MODULE_NAME) Current module name
71 # $(MODULE_TYPE) Current module type
72 # $(ARCH) Architecture of current module
73 # $(TOOLCHAIN) Toolchain used to build current module
74 # $(TARGET) Target of current module (DEBUG/RELEASE)
75 # $(<tool>) Path of tool
76 # $(EDK_TOOLS_PATH) Path of build tools
77 # $(<FILE_TYPES>) File list of each file type
78 # (Note: The macro name is derived from file type name. For example,
79 # C-Code-File will have C_CODE_FILES macro.)
80 # $(<FILE_TYPES_LIST>) Macro point to a file containing list of files of a file type
81 # (
82 # Note: The macro and file name are derived from file type name.
83 # For example, C-Code-File will have C_CODE_FILES_LIST macro pointing
84 # to $(OUTPUT_DIR)/c_code_files.lst. The list file and macro name
85 # will be generated only when this macro is used in command line.
86 # This is intended to get over the long command line limitation.
87 # )
88 #
89 # $(CP) copy command
90 # $(MV) move command
91 # $(RM) delete command
92 # $(MD) create dir command
93 # $(RD) remove dir command
94 #
95
96 ## Reserved File-Type
97 #
98 # Don't change following names of file types and their associated files,
99 # which are also used in tools' code
100 #
101 # C-Code-File
102 # C-Header-File
103 # Dynamic-Library-File
104 # Static-Library-File
105 # Visual-Form-Representation-File
106 # Unicode-Text-File
107 #
108
109 [C-Code-File]
110 <InputFile>
111 ?.c
112 ?.C
113 ?.cc
114 ?.CC
115 ?.cpp
116 ?.Cpp
117 ?.CPP
118
119 <ExtraDependency>
120 $(MAKE_FILE)
121
122 <OutputFile>
123 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
124
125 <Command.MSFT, Command.INTEL>
126 "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
127
128 <Command.GCC>
129 "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src}
130 "$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}
131
132 [C-Header-File]
133 <InputFile>
134 *.h, *.H
135
136 <OutputFile>
137
138 <Command>
139
140
141 [Assembly-Code-File.COMMON.COMMON]
142 <InputFile.MSFT, InputFile.INTEL>
143 ?.asm, ?.Asm, ?.ASM
144
145 <InputFile.GCC>
146 ?.S, ?.s
147
148 <ExtraDependency>
149 $(MAKE_FILE)
150
151 <OutputFile>
152 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
153
154 <Command.MSFT, Command.INTEL>
155 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
156 Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
157 "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
158
159 <Command.GCC>
160 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
161 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
162 "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
163
164 [Assembly-Code-File.COMMON.IPF]
165 <InputFile>
166 ?.s
167
168 <ExtraDependency>
169 $(MAKE_FILE)
170
171 <OutputFile>
172 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
173
174 <Command.MSFT, Command.INTEL>
175 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
176 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
177 "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii
178
179 [Visual-Form-Representation-File]
180 <InputFile>
181 ?.vfr
182 ?.Vfr
183 ?.VFR
184
185 <ExtraDependency>
186 $(MAKE_FILE)
187
188 <OutputFile>
189 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
190
191 <Command>
192 -$(MD) $(OUTPUT_DIR)(+)${s_dir} > NUL 2>&1
193 "$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
194 Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
195 -$(MD) ${d_path} > NUL 2>&1
196 "$(VFR)" $(VFR_FLAGS) --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
197
198 [Object-File]
199 <InputFile>
200 *.obj
201 *.o
202
203 <OutputFile>
204 $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
205
206 <Command.MSFT, Command.INTEL>
207 "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)
208
209 <Command.GCC>
210 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
211
212 [Static-Library-File]
213 <InputFile>
214 *.lib
215
216 <ExtraDependency>
217 $(MAKE_FILE)
218
219 <OutputFile>
220 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
221
222 <Command.MSFT, Command.INTEL>
223 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
224
225 <Command.GCC>
226 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)
227 "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
228
229 [Static-Library-File.USER_DEFINED]
230 <InputFile>
231 *.lib
232
233 <ExtraDependency>
234 $(MAKE_FILE)
235
236 <OutputFile>
237 $(DEBUG_DIR)(+)$(MODULE_NAME)
238
239 <Command.MSFT, Command.INTEL>
240 "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
241
242 <Command.GCC>
243 "$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)
244
245 [Dynamic-Library-File]
246 <InputFile>
247 ?.dll
248
249 <OutputFile>
250 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
251
252 <Command>
253 GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
254 $(CP) ${dst} $(OUTPUT_DIR)
255 $(CP) ${dst} $(BIN_DIR)
256 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
257
258 [Dependency-Expression-File]
259 <InputFile>
260 ?.dxs, ?.Dxs, ?.DXS
261
262 <OutputFile>
263 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
264
265 <Command>
266 "$(PP)" $(CC_FLAGS) $(APP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
267 Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
268 GenDepex -t $(MODULE_TYPE) -o ${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
269
270 [Acpi-Source-Language-File]
271 <InputFile>
272 ?.asl, ?.Asl, ?.ASL
273
274 <OutputFile>
275 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
276
277 <ExtraDependency>
278 $(MAKE_FILE)
279
280 <Command.MSFT, Command.INTEL>
281 Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i ${src}
282 "$(ASLPP)" $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
283 "$(ASL)" $(ASL_FLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
284
285 <Command.GCC>
286 Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i ${src}
287 "$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
288 "$(ASL)" $(ASL_FLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
289
290 [C-Code-File.AcpiTable]
291 <InputFile>
292 ?.c
293
294 <OutputFile>
295 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
296
297 <ExtraDependency>
298 $(MAKE_FILE)
299
300 <Command.MSFT, Command.INTEL>
301 "$(ASLCC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
302 "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
303 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
304
305 <Command.GCC>
306 "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
307 "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
308 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
309
310 [Acpi-Table-Code-File]
311 <InputFile>
312 ?.aslc, ?.act
313
314 <OutputFile>
315 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
316
317 <ExtraDependency>
318 $(MAKE_FILE)
319
320 <Command.MSFT, Command.INTEL>
321 "$(ASLCC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
322 "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
323 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
324
325 <Command.GCC>
326 "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
327 "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
328 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
329
330 [Masm16-Code-File]
331 <InputFile>
332 ?.asm16, ?.Asm16, ?.ASM16
333
334 <ExtraDependency>
335 $(MAKE_FILE)
336
337 <OutputFile>
338 $(OUTPUT_DIR)(+)${s_base}.com
339
340 <Command.MSFT, Command.INTEL>
341 cd $(OUTPUT_DIR)(+)${s_dir}
342 "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}
343 "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
344
345 [Microcode-File]
346 <InputFile>
347 ?.txt, ?.TXT, ?.Txt, ?.mut
348
349 <OutputFile>
350 $(OUTPUT_DIR)(+)${s_base}.mcb
351
352 <Command>
353 GenFw -o ${dst} -m ${src}
354
355 [Microcode-Binary-File]
356 <InputFile>
357 *.mcb
358
359 <OutputFile>
360 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
361
362 <Command>
363 GenFw -o ${dst} -j $(MICROCODE_BINARY_FILES)
364 -$(CP) ${dst} $(BIN_DIR)
365
366 [EFI-Image-File]
367 <InputFile>
368 ?.efi, ?.Efi, ?.EFI
369
370 <OutputFile>
371
372 <Command>
373
374 [Unicode-Text-File]
375 <InputFile>
376 *.uni, *.Uni, *.UNI
377
378 <OutputFile>
379 $(DEBUG_DIR)(+)AutoGen.c
380 $(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h
381
382 <Command>