]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Conf/build_rule.template
Restoring $WORKSPACE/BaseTools location, as the plan is to deprecate
[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>
201 ?.lib
202 $(LIBS)
203 $(MODULE_BUILD_DIR)\Makefile
204
205 <OutputFile>
206 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
207
208 <Command.MSFT, Command.INTEL>
209 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src}
210
211 <Command.GCC>
212 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(LIBS) ${src} -)
213
214 [Build.Dynamic-Library-File]
215 <InputFile>
216 ?.dll
217
218 <OutputFile>
219 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
220
221 <Command>
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)
226
227 [Build.Dependency-Expression-File]
228 <InputFile>
229 ?.dxs, ?.Dxs, ?.DXS
230
231 <OutputFile>
232 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
233
234 <Command>
235 # GenDepex -o ${dst} ${src}
236
237 [Build.Acpi-Source-Language-File]
238 <InputFile>
239 ?.asl, ?.Asl, ?.ASL
240
241 <OutputFile>
242 $(OUTPUT_DIR)(+)${s_base}.aml
243
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
247
248 [Build.Acpi-Table-Code-File]
249 <InputFile>
250 ?.aslc
251
252 <OutputFile>
253 $(OUTPUT_DIR)(+)${s_base}.acpi
254
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
259
260 [Build.Masm16-Code-File]
261 <InputFile>
262 ?.asm16, ?.Asm16, ?.ASM16
263
264 <OutputFile>
265 $(OUTPUT_DIR)(+)${s_base}.com
266
267 <Command.MSFT, Command.INTEL>
268 cd $(OUTPUT_DIR)(+)${s_dir}
269 "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}
270 "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
271
272 [Build.Microcode-File]
273 <InputFile>
274 ?.txt, ?.TXT, ?.Txt
275
276 <OutputFile>
277 $(OUTPUT_DIR)(+)${s_base}.mcb
278
279 <Command>
280 GenFw -o ${dst} -m ${src}
281
282 [Build.Microcode-Binary-File]
283 <InputFile>
284 *.mcb
285
286 <OutputFile>
287 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
288
289 <Command>
290 GenFw -o ${dst} -j ${src}
291
292 [Build.Unicode-Text-File]
293 <InputFile>
294 *.uni, *.Uni, *.UNI
295
296 <OutputFile>
297 $(DEBUG_DIR)(+)AutoGen.c
298 $(DEBUG_DIR)(+)AutoGen.h
299
300 <Command>
301