]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Conf/build_rule.template
BaseTools/Conf/build_rule.template:
[mirror_edk2.git] / BaseTools / Conf / build_rule.template
1 #
2 # Copyright (c) 2007, 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 # "[" Build.<File-Type>[.<version>][, Build.<File-Type>[.<version>]] "]" <EOL>
21 # <InputFile[.<ToolChainFamily>]> <EOL>
22 # [File-Type =] (?|*).<File-Extension> [(\n|,|;) (?|*).<File-Extension>]
23 #
24 # <OutputFile[.<ToolChainFamily>]> <EOL>
25 # <FileFullPath>
26 #
27 # <Command[.<ToolChainFamily>]> <EOL>
28 # <Command1>
29 # [<Command2>]
30 #
31
32 ## Placeholders for string substitution
33 #
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
41 #
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
47 #
48 # (+) Directory separator
49 #
50
51 ## Macro
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.)
71 #
72 # $(CP) copy command
73 # $(MV) move command
74 # $(RM) delete command
75 # $(MD) create dir command
76 # $(RD) remove dir command
77 #
78
79 ## Reserved File-Type
80 #
81 # Dont't change following names of file types and their associated files,
82 # which are also used in tools' code
83 #
84 # C-Code-File
85 # C-Header-File
86 # Dynamic-Library-File
87 # Static-Library-File
88 # Visual-Form-Representation-File
89 # Unicode-Text-File
90 #
91
92 [Build.C-Code-File]
93 <InputFile>
94 ?.c
95 ?.C
96 ?.cc
97 ?.CC
98 ?.cpp
99 ?.Cpp
100 ?.CPP
101
102 <OutputFile>
103 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
104
105 <Command.MSFT, Command.INTEL>
106 "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
107
108 <Command.GCC>
109 "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src}
110
111 [Build.C-Header-File]
112 <InputFile>
113 *.h, *.H
114
115 <OutputFile>
116 $(OUTPUT_DIR)(+)$(MODULE_NAME).gch
117 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
118
119 <Command>
120
121
122 [Build.Assembly-Code-File]
123 <InputFile.MSFT, InputFile.INTEL>
124 Assembly-Code-File = ?.asm, ?.Asm, ?.ASM
125
126 <InputFile.GCC>
127 ?.S
128
129 <OutputFile>
130 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
131
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
136
137 <Command.GCC>
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
141
142 [Build.Iasm-Code-File]
143 <InputFile>
144 ?.s
145
146 <OutputFile>
147 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
148
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
153
154 [Build.Visual-Form-Representation-File]
155 <InputFile>
156 ?.vfr
157 ?.Vfr
158 ?.VFR
159
160 <OutputFile>
161 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
162
163 <Command>
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
168
169 [Build.Object-File]
170 <InputFile>
171 *.obj
172 *.o
173
174 <OutputFile>
175 $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
176
177 <Command.MSFT, Command.INTEL>
178 "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} ${src}
179
180 <Command.GCC>
181 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src}
182
183 #[Build.Object-File, Build.Static-Library-File]
184 #BUILD_VERSION = 0x00010000
185 #
186 # <InputFile>
187 # Object-File = *.obj
188 # Static-Library-File = *.lib, *.a
189 #
190 # <OutputFile>
191 # $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
192 #
193 # <Command.MSFT>
194 # "$(SLINK)" /OUT:${dst} $(SLINK_FLAGS) ${src}
195 #
196 # <Command.GCC>
197 # "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src1} -( ${src2} -)
198 #
199 [Build.Static-Library-File]
200 <InputFile.MSFT, InputFile.Intel>
201 ?.lib
202 $(LIBS)
203 $(MODULE_BUILD_DIR)\Makefile
204
205 <InputFile.GCC>
206 ?.lib
207 $(LIBS)
208 $(MODULE_BUILD_DIR)/GNUmakefile
209
210 <OutputFile>
211 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
212
213 <Command.MSFT, Command.INTEL>
214 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src}
215
216 <Command.GCC>
217 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(LIBS) ${src} -\)
218
219 [Build.Dynamic-Library-File]
220 <InputFile>
221 ?.dll
222
223 <OutputFile>
224 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
225
226 <Command>
227 GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
228 $(CP) ${dst} $(OUTPUT_DIR)
229 $(CP) ${dst} $(BIN_DIR)
230 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
231
232 [Build.Dependency-Expression-File]
233 <InputFile>
234 ?.dxs, ?.Dxs, ?.DXS
235
236 <OutputFile>
237 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
238
239 <Command>
240 # GenDepex -o ${dst} ${src}
241
242 [Build.Acpi-Source-Language-File]
243 <InputFile>
244 ?.asl, ?.Asl, ?.ASL
245
246 <OutputFile>
247 $(OUTPUT_DIR)(+)${s_base}.aml
248
249 <Command.MSFT, Command.INTEL>
250 "$(PP)" $(APP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
251 "$(ASL)" -p ${dst} ${d_path}(+)${s_base}.i
252
253 [Build.Acpi-Table-Code-File]
254 <InputFile>
255 ?.aslc
256
257 <OutputFile>
258 $(OUTPUT_DIR)(+)${s_base}.acpi
259
260 <Command.MSFT, Command.INTEL>
261 "$(CC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(INC) ${src}
262 "$(DLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
263 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
264
265 [Build.Masm16-Code-File]
266 <InputFile>
267 ?.asm16, ?.Asm16, ?.ASM16
268
269 <OutputFile>
270 $(OUTPUT_DIR)(+)${s_base}.com
271
272 <Command.MSFT, Command.INTEL>
273 cd $(OUTPUT_DIR)(+)${s_dir}
274 "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}
275 "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
276
277 [Build.Microcode-File]
278 <InputFile>
279 ?.txt, ?.TXT, ?.Txt
280
281 <OutputFile>
282 $(OUTPUT_DIR)(+)${s_base}.mcb
283
284 <Command>
285 GenFw -o ${dst} -m ${src}
286
287 [Build.Microcode-Binary-File]
288 <InputFile>
289 *.mcb
290
291 <OutputFile>
292 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
293
294 <Command>
295 GenFw -o ${dst} -j ${src}
296
297 [Build.Unicode-Text-File]
298 <InputFile>
299 *.uni, *.Uni, *.UNI
300
301 <OutputFile>
302 $(DEBUG_DIR)(+)AutoGen.c
303 $(DEBUG_DIR)(+)AutoGen.h
304
305 <Command>
306