]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Conf/build_rule.template
Changed the GnuMakefile to Makefile as a workaround for CYGWINGCC toolchain build
[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 "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${src}
139
140 [Build.Iasm-Code-File]
141 <InputFile>
142 ?.s
143
144 <OutputFile>
145 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
146
147 <Command.MSFT, Command.INTEL>
148 "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
149 Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
150 "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii
151
152 [Build.Visual-Form-Representation-File]
153 <InputFile>
154 ?.vfr
155 ?.Vfr
156 ?.VFR
157
158 <OutputFile>
159 $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
160
161 <Command>
162 "$(PP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
163 Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
164 -mkdir ${d_path} > NUL 2>&1
165 VfrCompile -od ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
166
167 [Build.Object-File]
168 <InputFile>
169 *.obj
170 *.o
171
172 <OutputFile>
173 $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
174
175 <Command.MSFT, Command.INTEL>
176 "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} ${src}
177
178 <Command.GCC>
179 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src}
180
181 #[Build.Object-File, Build.Static-Library-File]
182 #BUILD_VERSION = 0x00010000
183 #
184 # <InputFile>
185 # Object-File = *.obj
186 # Static-Library-File = *.lib, *.a
187 #
188 # <OutputFile>
189 # $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
190 #
191 # <Command.MSFT>
192 # "$(SLINK)" /OUT:${dst} $(SLINK_FLAGS) ${src}
193 #
194 # <Command.GCC>
195 # "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src1} -( ${src2} -)
196 #
197 [Build.Static-Library-File]
198 <InputFile>
199 ?.lib
200 $(LIBS)
201
202 <OutputFile>
203 $(DEBUG_DIR)(+)$(MODULE_NAME).dll
204
205 <Command.MSFT, Command.INTEL>
206 "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) $(LIBS) ${src}
207
208 <Command.GCC>
209 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(LIBS) ${src} -)
210
211 [Build.Dynamic-Library-File]
212 <InputFile.MSFT, InputFile.INTEL>
213 ?.dll
214 $(MODULE_BUILD_DIR)\Makefile
215
216 <InputFile.GCC>
217 ?.dll
218 $(MODULE_BUILD_DIR)\Makefile
219
220 <OutputFile>
221 $(DEBUG_DIR)(+)$(MODULE_NAME).efi
222
223 <Command>
224 GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
225 $(CP) ${dst} $(OUTPUT_DIR)
226 $(CP) ${dst} $(BIN_DIR)
227 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
228
229 [Build.Dependency-Expression-File]
230 <InputFile>
231 ?.dxs, ?.Dxs, ?.DXS
232
233 <OutputFile>
234 $(OUTPUT_DIR)(+)$(MODULE_NAME).depex
235
236 <Command>
237 # GenDepex -o ${dst} ${src}
238
239 [Build.Acpi-Source-Language-File]
240 <InputFile>
241 ?.asl, ?.Asl, ?.ASL
242
243 <OutputFile>
244 $(OUTPUT_DIR)(+)${s_base}.aml
245
246 <Command.MSFT, Command.INTEL>
247 "$(PP)" $(APP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
248 "$(ASL)" -p ${dst} ${d_path}(+)${s_base}.i
249
250 [Build.Acpi-Table-Code-File]
251 <InputFile>
252 ?.aslc
253
254 <OutputFile>
255 $(OUTPUT_DIR)(+)${s_base}.acpi
256
257 <Command.MSFT, Command.INTEL>
258 "$(CC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(INC) ${src}
259 "$(DLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
260 GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
261
262 [Build.Masm16-Code-File]
263 <InputFile>
264 ?.asm16, ?.Asm16, ?.ASM16
265
266 <OutputFile>
267 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.com
268
269 <Command.MSFT, Command.INTEL>
270 pushd .
271 cd $(OUTPUT_DIR)(+)${s_dir}
272 "$(ASM)" /nologo /omf ${src} /Bl"$(ASMLINK)" $(ASMLINK_FLAGS)
273 -$(CP) ${dst} $(OUTPUT_DIR) & popd
274
275 [Build.Microcode-File]
276 <InputFile>
277 ?.txt, ?.TXT, ?.Txt
278
279 <OutputFile>
280 $(OUTPUT_DIR)(+)${s_base}.mcb
281
282 <Command>
283 GenFw -o ${dst} -m ${src}
284
285 [Build.Microcode-Binary-File]
286 <InputFile>
287 *.mcb
288
289 <OutputFile>
290 $(OUTPUT_DIR)(+)$(MODULE_NAME).bin
291
292 <Command>
293 GenFw -o ${dst} -j ${src}
294
295 [Build.Unicode-Text-File]
296 <InputFile>
297 *.uni, *.Uni, *.UNI
298
299 <OutputFile>
300 $(DEBUG_DIR)(+)AutoGen.c
301 $(DEBUG_DIR)(+)AutoGen.h
302
303 <Command>
304