]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Platform/Common.dsc
Maintainers.txt: Remove EdkCompatibilityPkg information
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Platform / Common.dsc
1 #/*++
2 #
3 # Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
4 # 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 # Module Name:
13 #
14 # Common.dsc
15 #
16 # Abstract:
17 #
18 # This is the build description file containing the platform
19 # independent build instructions. Platform specific instructions will
20 # be prepended to produce the final build DSC file.
21 #
22 #
23 # Notes:
24 #
25 # The info in this file is broken down into sections. The start of a section
26 # is designated by a "[" in the first column. So the [=====] separater ends
27 # a section.
28 #
29 #--*/
30
31 [=============================================================================]
32 #
33 # These get emitted at the top of the generated master makefile.
34 #
35 [=============================================================================]
36 [Makefile.out]
37 #
38 # From the [makefile.out] section of the DSC file
39 #
40 TOOLCHAIN =
41 MAKE = nmake -nologo
42
43 !INCLUDE $(BUILD_DIR)\PlatformTools.env
44
45 all : libraries fvs
46
47 [=============================================================================]
48 #
49 # These get expanded and dumped out to each component makefile after the
50 # component INF [defines] section gets parsed.
51 #
52 [=============================================================================]
53 [Makefile.Common]
54 #
55 # From the [Makefile.Common] section of the description file.
56 #
57 PROCESSOR = $(PROCESSOR)
58 BASE_NAME = $(BASE_NAME)
59 BUILD_NUMBER = $(BUILD_NUMBER)
60 VERSION_STRING = $(VERSION_STRING)
61 TOOLCHAIN = TOOLCHAIN_$(PROCESSOR)
62 FILE_GUID = $(FILE_GUID)
63 COMPONENT_TYPE = $(COMPONENT_TYPE)
64 FV_DIR = $(BUILD_DIR)\FV
65 PLATFORM = $(PROJECT_NAME)
66
67 #
68 # Define the global dependency files
69 #
70 !IF EXIST ($(DEST_DIR)\$(BASE_NAME)StrDefs.h)
71 INC_DEPS = $(INC_DEPS) $(DEST_DIR)\$(BASE_NAME)StrDefs.h
72 !ENDIF
73 #ENV_DEPS = $(ENV_DEPS) $(EDK_SOURCE)\Sample\CommonTools.env
74 #ENV_DEPS = $(ENV_DEPS) $(BUILD_DIR)\PlatformTools.env
75 #ENV_DEPS = $(ENV_DEPS) $(BUILD_DIR)\Config.env
76 ALL_DEPS = $(INC_DEPS) $(ENV_DEPS)
77
78 !IF "$(LANGUAGE)" != ""
79 LANGUAGE_FLAGS = -lang $(LANGUAGE)
80 !ENDIF
81
82 !INCLUDE $(BUILD_DIR)\PlatformTools.env
83
84 !IF "$(COMPONENT_TYPE)" == "PIC_PEIM" || "$(COMPONENT_TYPE)" == "PE32_PEIM" || "$(COMPONENT_TYPE)" == "RELOCATABLE_PEIM" || "$(COMPONENT_TYPE)" == "COMBINED_PEIM_DRIVER"
85 DEPEX_TYPE = EFI_SECTION_PEI_DEPEX
86 !ELSE
87 DEPEX_TYPE = EFI_SECTION_DXE_DEPEX
88 !ENDIF
89
90 !IF "$(COMPONENT_TYPE)" != "LIBRARY" && EXIST($(BUILD_DIR)\$(PROCESSOR)\CompilerStub.lib)
91 LIBS = $(LIBS) $(BUILD_DIR)\$(PROCESSOR)\CompilerStub.lib
92 !ENDIF
93
94 #
95 # Command flags for MAKEDEPS tool
96 #
97 DEP_FLAGS = -target $** -o $(DEP_FILE) $(INC) -ignorenotfound -q
98 DEP_FLAGS2 = -target $@ -o $(DEP_FILE) -cl
99
100 [=============================================================================]
101 #
102 # These are the commands to compile source files. One of these blocks gets
103 # emitted to the component's makefile for each source file. The section
104 # name is encoded as [Compile.$(PROCESSOR).source_filename_extension], where
105 # the source filename comes from the sources section of the component INF file.
106 #
107 # If the dependency list file already exists, then include it for this
108 # source file. If it doesn't exist, then this is a clean build and the
109 # dependency file will get created below and the source file will get
110 # compiled.
111 #
112 # Current behavior is that the first clean build will not create dep files.
113 # But the following second build has to create dep files before build source files.
114 # CREATEDEPS flag is used to judge whether current build is the second build or not.
115 #
116 #
117 [=============================================================================]
118 [Compile.Ia32.asm,Compile.x64.asm]
119
120 #
121 # Add build dependency check
122 #
123 DEP_FILE = $(DEST_DIR)\$(FILE)Asm.dep
124
125 !IF EXIST($(DEP_FILE))
126 !INCLUDE $(DEP_FILE)
127 !ENDIF
128
129 !IF EXIST($(DEST_DIR)\$(FILE).obj)
130 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Asm.dep
131 !IF !EXIST($(DEP_FILE))
132 CREATEDEPS = YES
133 !ENDIF
134 !ENDIF
135
136 #
137 # Update dep file for next round incremental build
138 #
139 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
140 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS) -asm
141
142 #
143 # Compile the file
144 #
145 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
146 $(ASM) $(ASM_FLAGS) $(SOURCE_FILE_NAME)
147
148 [=============================================================================]
149 [Compile.Ia32.c,Compile.x64.c]
150
151 #
152 # Add build dependency check
153 #
154 DEP_FILE = $(DEST_DIR)\$(FILE).dep
155
156 !IF EXIST($(DEP_FILE))
157 !INCLUDE $(DEP_FILE)
158 !ENDIF
159
160 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
161
162 !IF EXIST($(DEST_DIR)\$(FILE).obj)
163 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE).dep
164 !IF !EXIST($(DEP_FILE))
165 CREATEDEPS = YES
166 !ENDIF
167 !ENDIF
168
169 #
170 # Update dep file for next round incremental build
171 #
172 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
173 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
174
175 !ENDIF
176
177 #
178 # Compile the file
179 #
180 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
181 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
182 $(CC) $(C_FLAGS) $(SOURCE_FILE_NAME)
183 !ELSE
184 -$(CC) $(C_FLAGS) $(SOURCE_FILE_NAME) /showIncludes > $(DEST_DIR)\$(FILE).cl
185 @$(MAKEDEPS) -f $(DEST_DIR)\$(FILE).cl $(DEP_FLAGS2)
186 !ENDIF
187
188 [=============================================================================]
189 [Compile.Ebc.c]
190
191 #
192 # Add build dependency check
193 #
194 DEP_FILE = $(DEST_DIR)\$(FILE).dep
195
196 !IF EXIST($(DEP_FILE))
197 !INCLUDE $(DEP_FILE)
198 !ENDIF
199
200 !IF EXIST($(DEST_DIR)\$(FILE).obj)
201 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE).dep
202 !IF !EXIST($(DEP_FILE))
203 CREATEDEPS = YES
204 !ENDIF
205 !ENDIF
206
207 #
208 # Update dep file for next round incremental build
209 #
210 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
211 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
212
213 #
214 # Compile the file
215 #
216 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
217 $(EBC_CC) $(EBC_C_FLAGS) $(SOURCE_FILE_NAME)
218
219 [=============================================================================]
220 #
221 # Commands for compiling a ".apr" Apriori source file.
222 #
223 [=============================================================================]
224 [Compile.Ia32.Apr,Compile.Ebc.Apr,Compile.x64.Apr]
225 #
226 # Create the raw binary file. If you get an error on the build saying it doesn't
227 # know how to create the .apr file, then you're missing (or mispelled) the
228 # "APRIORI=" on the component lines in components section in the DSC file.
229 #
230 $(DEST_DIR)\$(BASE_NAME).bin : $(SOURCE_FILE_NAME) $(INF_FILENAME)
231 $(GENAPRIORI) -v -f $(SOURCE_FILE_NAME) -o $(DEST_DIR)\$(BASE_NAME).bin
232
233 $(DEST_DIR)\$(BASE_NAME).sec : $(DEST_DIR)\$(BASE_NAME).bin
234 $(GENSECTION) -I $(DEST_DIR)\$(BASE_NAME).bin -O $(DEST_DIR)\$(BASE_NAME).sec -S EFI_SECTION_RAW
235
236 [=============================================================================]
237 [Build.Ia32.Apriori,Build.Ebc.Apriori,Build.x64.Apriori]
238
239 all : $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).FFS
240
241 #
242 # Run GenFfsFile on the package file and .raw file to create the firmware file
243 #
244 $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).FFS : $(DEST_DIR)\$(BASE_NAME).sec $(PACKAGE_FILENAME)
245 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
246
247 #
248 # Remove the generated temp and final files for this modules.
249 #
250 clean :
251 !IF ("$(FILE_GUID)" != "")
252 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
253 !ENDIF
254 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
255 @del /q $(DEST_OUTPUT_DIRS)
256
257 [=============================================================================]
258 [Build.Ia32.Makefile,Build.Ebc.Makefile,Build.x64.Makefile]
259
260 #
261 # Set some required macros
262 #
263 MAKEFILE_MACROS = SOURCE_DIR=$(SOURCE_DIR) \
264 BUILD_DIR=$(BUILD_DIR) \
265 FILE_GUID=$(FILE_GUID) \
266 DEST_DIR=$(DEST_DIR) \
267 PROCESSOR=$(PROCESSOR) \
268 TOOLCHAIN=TOOLCHAIN_$(PROCESSOR) \
269 BASE_NAME=$(BASE_NAME) \
270 PACKAGE_FILENAME=$(PACKAGE_FILENAME)
271
272 #
273 # Just call the makefile from the source directory, passing in some
274 # useful info.
275 #
276 all :
277 $(MAKE) -f $(SOURCE_DIR)\makefile.new all $(MAKEFILE_MACROS)
278
279 #
280 # Remove the generated temp and final files for this modules.
281 #
282 clean :
283 @- $(MAKE) -f $(SOURCE_DIR)\makefile.new clean $(MAKEFILE_MACROS) > NUL 2>&1
284 !IF ("$(FILE_GUID)" != "")
285 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
286 !ENDIF
287 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
288 @del /q $(DEST_OUTPUT_DIRS)
289
290 [=============================================================================]
291 #
292 # Instructions for building a component that uses a custom makefile. Encoding
293 # is [build.$(PROCESSOR).$(BUILD_TYPE)].
294 #
295 # To build these components, simply call the makefile from the source
296 # directory.
297 #
298 [=============================================================================]
299 [Build.Ia32.Custom_Makefile,Build.Ebc.Custom_Makefile,Build.x64.Custom_Makefile]
300
301 #
302 # Set some required macros
303 #
304 MAKEFILE_MACROS = SOURCE_DIR=$(SOURCE_DIR) \
305 BUILD_DIR=$(BUILD_DIR) \
306 DEST_DIR=$(DEST_DIR) \
307 FILE_GUID=$(FILE_GUID) \
308 PROCESSOR=$(PROCESSOR) \
309 TOOLCHAIN=TOOLCHAIN_$(PROCESSOR) \
310 BASE_NAME=$(BASE_NAME) \
311 PLATFORM=$(PLATFORM) \
312 SOURCE_FV=$(SOURCE_FV) \
313 PACKAGE_FILENAME=$(PACKAGE_FILENAME)
314
315 #
316 # Just call the makefile from the source directory, passing in some
317 # useful info.
318 #
319 all :
320 $(MAKE) -f $(SOURCE_DIR)\makefile all $(MAKEFILE_MACROS)
321
322 #
323 # Remove the generated temp and final files for this modules.
324 #
325 clean :
326 @- $(MAKE) -f $(SOURCE_DIR)\makefile clean $(MAKEFILE_MACROS) > NUL 2>&1
327 !IF ("$(FILE_GUID)" != "")
328 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
329 !ENDIF
330 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
331 @del /q $(DEST_OUTPUT_DIRS)
332
333 [=============================================================================]
334 #
335 # These commands are used to build libraries
336 #
337 [=============================================================================]
338 [Build.Ia32.LIBRARY,Build.x64.LIBRARY]
339 #
340 # LIB all the object files into to our target lib file. Put
341 # a dependency on the component's INF file in case it changes.
342 #
343 LIB_NAME = $(LIB_DIR)\$(BASE_NAME).lib
344
345 #
346 # $(DEP_TARGETS) are not needed for binary build.
347 #
348 !IF ("$(BINARY)" == "TRUE") || (("$(BINARY)" == "") && ("$(EFI_BINARY_LIBRARY)" == "YES"))
349 DEP_TARGETS=
350 CREATEDEPS=
351 !ENDIF
352
353 #
354 # Module can be built from source code or binary files.
355 #
356 !IF ((("$(BINARY)" == "TRUE") || (("$(BINARY)" == "") && ("$(EFI_BINARY_LIBRARY)" == "YES"))) \
357 && EXIST($(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).lib))
358 $(LIB_NAME) : $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).lib
359 copy $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).lib $(LIB_NAME) /Y
360 if exist $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME)Obj.pdb \
361 copy $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME)Obj.pdb $(DEST_DIR)\$(BASE_NAME)Obj.pdb /Y
362 !ELSE
363 $(LIB_NAME) : $(OBJECTS) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
364 $(LIB) $(LIB_FLAGS) $(OBJECTS) $(LIBS) /OUT:$@
365 !IF ("$(EFI_BINARY_BUILD)" == "YES")
366 if not exist $(EFI_PLATFORM_BIN)\$(PROCESSOR) mkdir $(EFI_PLATFORM_BIN)\$(PROCESSOR)
367 if exist $(LIB_NAME) copy $(LIB_NAME) $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).lib /Y
368 if exist $(DEST_DIR)\$(BASE_NAME)Obj.pdb copy $(DEST_DIR)\$(BASE_NAME)Obj.pdb $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME)Obj.pdb /Y
369 !ENDIF
370 !ENDIF
371
372 !IF "$(CREATEDEPS)"=="YES"
373 all : $(DEP_TARGETS)
374 $(MAKE) -f $(MAKEFILE_NAME) all
375 !ELSE
376 all : $(LIB_NAME) $(DEP_TARGETS)
377 !ENDIF
378
379 #
380 # Remove the generated temp and final files for this modules.
381 #
382 clean :
383 !IF ("$(FILE_GUID)" != "")
384 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
385 !ENDIF
386 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
387 @del /q $(DEST_OUTPUT_DIRS)
388
389 [=============================================================================]
390 [Build.Ebc.LIBRARY]
391 #
392 # LIB all the object files into to our target lib file. Put
393 # a dependency on the component's INF file in case it changes.
394 #
395 LIB_NAME = $(LIB_DIR)\$(BASE_NAME).lib
396
397 $(LIB_NAME) : $(OBJECTS) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
398 $(EBC_LIB) $(EBC_LIB_FLAGS) $(OBJECTS) $(LIBS) /OUT:$@
399
400 !IF "$(CREATEDEPS)"=="YES"
401 all : $(DEP_TARGETS)
402 $(MAKE) -f $(MAKEFILE_NAME) all
403 !ELSE
404 all : $(LIB_NAME) $(DEP_TARGETS)
405 !ENDIF
406
407 #
408 # Remove the generated temp and final files for this modules.
409 #
410 clean :
411 !IF ("$(FILE_GUID)" != "")
412 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
413 !ENDIF
414 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
415 @del /q $(DEST_OUTPUT_DIRS)
416
417 [=============================================================================]
418 #
419 # This is the Build.$(PROCESSOR).$(COMPONENT_TYPE) section that tells how to
420 # convert a firmware volume into an FV FFS file. Simply run it through
421 # GenFfsFile with the appropriate package file. SOURCE_FV must be defined
422 # in the component INF file Defines section.
423 #
424 [=============================================================================]
425 [Build.Ia32.FvImageFile,Build.x64.FvImageFile]
426
427 all : $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).Fvi
428
429 #
430 # Run GenFfsFile on the package file and FV file to create the firmware
431 # volume FFS file. This FFS file maybe contain one pad section for alignment requirement.
432 #
433 $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).Fvi : $(DEST_DIR)\$(SOURCE_FV)Fv.sec $(PACKAGE_FILENAME) $(PAD_SECTION)
434 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
435
436 #
437 # Remove the generated temp and final files for this modules.
438 #
439 clean :
440 !IF ("$(FILE_GUID)" != "")
441 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
442 !ENDIF
443 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
444 @del /q $(DEST_OUTPUT_DIRS)
445
446 [=============================================================================]
447 #
448 # Since many of the steps are the same for the different component types, we
449 # share this section for BS_DRIVER, RT_DRIVER, .... and IFDEF the parts that
450 # differ. The entire section gets dumped to the output makefile.
451 #
452 [=============================================================================]
453 [Build.Ia32.BS_DRIVER|RT_DRIVER|SAL_RT_DRIVER|PE32_PEIM|PEI_CORE|PIC_PEIM|RELOCATABLE_PEIM|DXE_CORE|APPLICATION|COMBINED_PEIM_DRIVER, Build.x64.BS_DRIVER|RT_DRIVER|SAL_RT_DRIVER|PE32_PEIM|PEI_CORE|PIC_PEIM|RELOCATABLE_PEIM|DXE_CORE|APPLICATION|COMBINED_PEIM_DRIVER]
454
455 !IF "$(LOCALIZE)" == "YES"
456
457 !IF (("$(EFI_GENERATE_HII_RESOURCE)" == "YES") && ("$(EFI_SPECIFICATION_VERSION)" >= "0x0002000A"))
458 #
459 # This will generate HII resource section in PE/COFF image.
460 #
461 # Note: when HII package list is built into resource section, Driver no longer
462 # refer to C array generated by VfrCompiler ($(FILE_NAME)Bin) and StrGather
463 # ($(BASE_NAME)Strings); while in current build rule, those C array objects
464 # will still be linked with the Driver, so please turn on link flag "/OPT:REF"
465 # to minimize the code size.
466 #
467 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(BASE_NAME)Strings.hpk
468 LOCALIZE_TARGETS = $(LOCALIZE_TARGETS) $(DEST_DIR)\$(BASE_NAME).res
469 LINK_FLAGS_DLL = $(LINK_FLAGS_DLL) $(DEST_DIR)\$(BASE_NAME).res
470
471 $(DEST_DIR)\$(BASE_NAME).rc : $(HII_PACK_FILES)
472 $(HIIPACK) -g $(FILE_GUID) $(HII_PACK_FILES) -rc $(DEST_DIR)\$(BASE_NAME).rc -hii $(DEST_DIR)\$(BASE_NAME).hii
473
474 $(DEST_DIR)\$(BASE_NAME).res : $(DEST_DIR)\$(BASE_NAME).rc
475 $(RC) /fo $(DEST_DIR)\$(BASE_NAME).res $(DEST_DIR)\$(BASE_NAME).rc
476
477 !ENDIF
478
479 !IF (("$(EFI_GENERATE_HII_EXPORT)" == "YES") && ("$(EFI_SPECIFICATION_VERSION)" < "0x0002000A"))
480 #
481 # There will be one HII pack containing all the strings. Add that file
482 # to the list of HII pack files we'll use to create our final HII export file.
483 #
484 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(BASE_NAME)Strings.hpk
485 LOCALIZE_TARGETS = $(LOCALIZE_TARGETS) $(DEST_DIR)\$(BASE_NAME).hii
486 !ENDIF
487
488 !IF ("$(EFI_SPECIFICATION_VERSION)" >= "0x0002000A")
489 #
490 # Note: currently -ppflag option is only available for UefiStrGather
491 # Note: /GS- will cause warning for preprocess, so filter it out from STRGATHER_PPFLAG
492 #
493 STRGATHER_PPFLAG = $(C_FLAGS: /GS-=)
494 STRGATHER_FLAGS = $(STRGATHER_FLAGS) -ppflag "$(STRGATHER_PPFLAG)" -oh $(DEST_DIR)\$(BASE_NAME)StrDefs.h
495 !ENDIF
496
497 $(DEST_DIR)\$(BASE_NAME).sdb : $(SDB_FILES) $(SOURCE_FILES)
498 $(STRGATHER) -scan -vdbr $(STRGATHER_FLAGS) -od $(DEST_DIR)\$(BASE_NAME).sdb \
499 -skipext .uni -skipext .h $(SOURCE_FILES)
500
501 $(DEST_DIR)\$(BASE_NAME)Strings.c : $(DEST_DIR)\$(BASE_NAME).sdb
502 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
503 -oc $(DEST_DIR)\$(BASE_NAME)Strings.c
504
505 $(DEST_DIR)\$(BASE_NAME)StrDefs.h : $(DEST_DIR)\$(BASE_NAME).sdb
506 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
507 -oh $(DEST_DIR)\$(BASE_NAME)StrDefs.h
508
509 $(DEST_DIR)\$(BASE_NAME)Strings.hpk : $(DEST_DIR)\$(BASE_NAME).sdb
510 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
511 -hpk $(DEST_DIR)\$(BASE_NAME)Strings.hpk
512
513 OBJECTS = $(OBJECTS) $(DEST_DIR)\$(BASE_NAME)Strings.obj
514
515 $(DEST_DIR)\$(BASE_NAME)Strings.obj : $(DEST_DIR)\$(BASE_NAME)Strings.c $(INF_FILENAME) $(ALL_DEPS)
516 $(CC) $(C_FLAGS) $(DEST_DIR)\$(BASE_NAME)Strings.c
517
518 LOCALIZE_TARGETS = $(DEST_DIR)\$(BASE_NAME)StrDefs.h $(LOCALIZE_TARGETS)
519
520 !ENDIF
521
522 #
523 # If we have any objects associated with this component, then we're
524 # going to build a local library from them.
525 #
526 !IFNDEF OBJECTS
527 !ERROR No source files to build were defined in the INF file
528 !ENDIF
529
530 TARGET_LOCAL_LIB = $(DEST_DIR)\$(BASE_NAME)Local.lib
531
532 #
533 # LIB all the object files into our (local) target lib file. Put
534 # a dependency on the component's INF file in case it changes.
535 #
536 $(TARGET_LOCAL_LIB) : $(OBJECTS) $(INF_FILENAME) $(ENV_DEPS)
537 $(LIB) $(LIB_FLAGS) $(OBJECTS) /OUT:$@
538
539 #
540 # Defines for standard intermediate files and build targets
541 #
542 TARGET_DLL = $(BIN_DIR)\$(BASE_NAME).dll
543 TARGET_EFI = $(BIN_DIR)\$(BASE_NAME).efi
544 TARGET_DPX = $(DEST_DIR)\$(BASE_NAME).dpx
545 TARGET_UI = $(DEST_DIR)\$(BASE_NAME).ui
546 TARGET_VER = $(DEST_DIR)\$(BASE_NAME).ver
547 TARGET_MAP = $(BIN_DIR)\$(BASE_NAME).map
548 TARGET_PDB = $(BIN_DIR)\$(BASE_NAME).pdb
549 TARGET_SYM = $(BIN_DIR)\$(BASE_NAME).sym
550
551 #
552 # Target executable section extension depends on the component type.
553 # Only define "TARGET_DXE_DPX" if it's a combined peim driver.
554 #
555 !IF "$(COMPONENT_TYPE)" == "PIC_PEIM"
556 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pic
557 !ELSE
558 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pe32
559 !ENDIF
560
561 #
562 # Target FFS file extension depends on the component type
563 # Also define "TARGET_DXE_DPX" if it's a combined PEIM driver.
564 #
565 SUBSYSTEM = EFI_BOOT_SERVICE_DRIVER
566
567 !IF "$(COMPONENT_TYPE)" == "APPLICATION"
568 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).app
569 SUBSYSTEM = EFI_APPLICATION
570 !ELSE IF "$(COMPONENT_TYPE)" == "PEI_CORE"
571 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
572 !ELSE IF "$(COMPONENT_TYPE)" == "PE32_PEIM"
573 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
574 !ELSE IF "$(COMPONENT_TYPE)" == "RELOCATABLE_PEIM"
575 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
576 !ELSE IF "$(COMPONENT_TYPE)" == "PIC_PEIM"
577 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
578 !ELSE IF "$(COMPONENT_TYPE)" == "COMBINED_PEIM_DRIVER"
579 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
580 TARGET_DXE_DPX = $(DEST_DIR)\$(BASE_NAME).dpxd
581 !ELSE
582 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).dxe
583 !ENDIF
584
585 #
586 # Different methods to build section based on if PIC_PEIM
587 #
588 !IF "$(COMPONENT_TYPE)" == "PIC_PEIM"
589
590 $(TARGET_PE32) : $(TARGET_DLL)
591 $(PE2BIN) $(TARGET_DLL) $(DEST_DIR)\$(BASE_NAME).TMP
592 #
593 # BUGBUG: Build PEIM header, needs to go away with new PEI.
594 #
595 $(TEMPGENSECTION) -P $(SOURCE_DIR)\$(BASE_NAME).INF -I $(DEST_DIR)\$(BASE_NAME).TMP -O $(TARGET_PIC_PEI).tmp -M $(TARGET_MAP) -S EFI_SECTION_TYPE_NO_HEADER
596 $(GENSECTION) -I $(TARGET_PIC_PEI).tmp -O $(TARGET_PE32) -S EFI_SECTION_PIC
597 del $(DEST_DIR)\$(BASE_NAME).TMP
598
599 !ELSE
600
601 $(TARGET_PE32) : $(TARGET_EFI)
602 $(GENSECTION) -I $(TARGET_EFI) -O $(TARGET_PE32) -S EFI_SECTION_PE32
603
604 #
605 # $(DEP_TARGETS) are not needed for binary build.
606 #
607 !IF "$(BINARY)" == "TRUE"
608 DEP_TARGETS=
609 CREATEDEPS=
610 !ENDIF
611
612 #
613 # Build module to generate *.efi file from source code or binary file.
614 #
615 !IF (("$(BINARY)" == "TRUE") && EXIST($(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).efi))
616 LOCALIZE_TARGETS=
617 $(TARGET_EFI) : $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).efi
618 copy $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).efi $(TARGET_EFI) /Y
619 if exist $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).pdb \
620 copy $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).pdb $(TARGET_PDB) /Y
621 !ELSE
622 $(TARGET_EFI) : $(TARGET_DLL) $(INF_FILENAME)
623 $(FWIMAGE) -t 0 $(COMPONENT_TYPE) $(TARGET_DLL) $(TARGET_EFI)
624 !IF ("$(EFI_BINARY_BUILD)" == "YES")
625 if not exist $(EFI_PLATFORM_BIN)\$(PROCESSOR) mkdir $(EFI_PLATFORM_BIN)\$(PROCESSOR)
626 if exist $(TARGET_EFI) copy $(TARGET_EFI) $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).efi /Y
627 if exist $(TARGET_PDB) copy $(TARGET_PDB) $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).pdb /Y
628 !ENDIF
629 !ENDIF
630
631 !ENDIF
632
633 #
634 # Link all objects and libs to create the executable
635 #
636 $(TARGET_DLL) : $(TARGET_LOCAL_LIB) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
637 $(LINK) $(LINK_FLAGS_DLL) $(LIBS) /ENTRY:$(IMAGE_ENTRY_POINT) \
638 $(TARGET_LOCAL_LIB) /OUT:$(TARGET_DLL) /MAP:$(TARGET_MAP) \
639 /PDB:$(TARGET_PDB)
640 $(SETSTAMP) $(TARGET_DLL) $(BUILD_DIR)\GenStamp.txt
641 !IF "$(EFI_GENERATE_SYM_FILE)" == "YES"
642 if exist $(TARGET_PDB) $(PE2SYM) $(TARGET_PDB) $(TARGET_SYM)
643 !ENDIF
644
645 !IF "$(EFI_ZERO_DEBUG_DATA)" == "YES"
646 $(ZERODEBUGDATA) $(TARGET_DLL)
647 !ENDIF
648
649 #
650 # Create the user interface section
651 #
652 $(TARGET_UI) : $(INF_FILENAME)
653 $(GENSECTION) -O $(TARGET_UI) -S EFI_SECTION_USER_INTERFACE -A "$(BASE_NAME)"
654
655 #
656 # Create the version section
657 #
658 !IF "$(BUILD_NUMBER)" != ""
659 !IF "$(VERSION_STRING)" != ""
660 $(TARGET_VER) : $(INF_FILENAME)
661 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER) -A "$(VERSION_STRING)"
662 !ELSE
663 $(TARGET_VER) : $(INF_FILENAME)
664 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER)
665 !ENDIF
666 !ELSE
667 $(TARGET_VER) : $(INF_FILENAME)
668 echo.>$(TARGET_VER)
669 type $(TARGET_VER)>$(TARGET_VER)
670 !ENDIF
671
672 #
673 # Makefile entries to create the dependency expression section.
674 # Use the DPX file from the source directory unless an override file
675 # was specified.
676 # If no DPX source file was specified, then create an empty file to
677 # be used.
678 #
679 !IF "$(DPX_SOURCE)" != ""
680 DPX_SOURCE_FILE = $(SOURCE_DIR)\$(DPX_SOURCE)
681 !ENDIF
682
683 !IF "$(DPX_SOURCE_OVERRIDE)" != ""
684 DPX_SOURCE_FILE = $(DPX_SOURCE_OVERRIDE)
685 !ENDIF
686
687 !IF "$(DPX_SOURCE_FILE)" != ""
688 !IF EXIST ($(DPX_SOURCE_FILE))
689
690 #
691 # Add build dependency check
692 #
693 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs.dep
694
695 !IF EXIST($(DEP_FILE))
696 !INCLUDE $(DEP_FILE)
697 !ENDIF
698
699 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
700
701 !IF EXIST($(TARGET_DPX))
702 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs.dep
703 !IF !EXIST($(DEP_FILE))
704 CREATEDEPS = YES
705 !ENDIF
706 !ENDIF
707
708 #
709 # Update dep file for next round incremental build
710 #
711 $(DEP_FILE) : $(TARGET_DPX)
712 $(MAKEDEPS) -f $(DPX_SOURCE_FILE) $(DEP_FLAGS)
713
714 !ENDIF
715
716 $(TARGET_DPX) : $(DPX_SOURCE_FILE) $(INF_FILENAME)
717 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
718 $(CC) $(C_FLAGS_DPX) $(DPX_SOURCE_FILE) > $*.tmp1
719 !ELSE
720 -$(CC) $(C_FLAGS_DPX) $(DPX_SOURCE_FILE) /showIncludes > $*.tmp1 2> $(DEST_DIR)\$(BASE_NAME)dxs.cl
721 @$(MAKEDEPS) -f $(DEST_DIR)\$(BASE_NAME)dxs.cl $(DEP_FLAGS2)
722 !ENDIF
723 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
724 $(GENSECTION) -I $*.tmp2 -O $@ -S $(DEPEX_TYPE)
725 del $*.tmp1 > NUL
726 del $*.tmp2 > NUL
727 !ELSE
728 !ERROR Dependency expression source file "$(DPX_SOURCE_FILE)" does not exist.
729 !ENDIF
730 !ELSE
731 $(TARGET_DPX) : $(INF_FILENAME)
732 echo. > $(TARGET_DPX)
733 type $(TARGET_DPX) > $(TARGET_DPX)
734 !ENDIF
735
736 #
737 # Makefile entries for DXE DPX for combined PEIM drivers.
738 # If a DXE_DPX_SOURCE file was specified in the INF file, use it. Otherwise
739 # create an empty file and use it as a DPX file.
740 #
741 !IF "$(COMPONENT_TYPE)" == "COMBINED_PEIM_DRIVER"
742 !IF "$(DXE_DPX_SOURCE)" != ""
743 !IF EXIST ($(SOURCE_DIR)\$(DXE_DPX_SOURCE))
744
745 #
746 # Add build dependency check
747 #
748 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs2.dep
749
750 !IF EXIST($(DEP_FILE))
751 !INCLUDE $(DEP_FILE)
752 !ENDIF
753
754 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
755
756 !IF EXIST($(TARGET_DXE_DPX))
757 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs2.dep
758 !IF !EXIST($(DEP_FILE))
759 CREATEDEPS = YES
760 !ENDIF
761 !ENDIF
762
763 #
764 # Update dep file for next round incremental build
765 #
766 $(DEP_FILE) : $(TARGET_DXE_DPX)
767 $(MAKEDEPS) -f $(SOURCE_DIR)\$(DXE_DPX_SOURCE) $(DEP_FLAGS)
768
769 !ENDIF
770
771 $(TARGET_DXE_DPX) : $(SOURCE_DIR)\$(DXE_DPX_SOURCE) $(INF_FILENAME)
772 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
773 $(CC) $(C_FLAGS_DPX) $(SOURCE_DIR)\$(DXE_DPX_SOURCE) > $*.tmp1
774 !ELSE
775 -$(CC) $(C_FLAGS_DPX) $(SOURCE_DIR)\$(DXE_DPX_SOURCE) /showIncludes > $*.tmp1 2> $(DEST_DIR)\$(BASE_NAME)dxs2.cl
776 @$(MAKEDEPS) -f $(DEST_DIR)\$(BASE_NAME)dxs2.cl $(DEP_FLAGS2)
777 !ENDIF
778 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
779 $(GENSECTION) -I $*.tmp2 -O $@ -S EFI_SECTION_DXE_DEPEX
780 del $*.tmp1 > NUL
781 del $*.tmp2 > NUL
782 !ELSE
783 !ERROR Dependency expression source file "$(SOURCE_DIR)\$(DXE_DPX_SOURCE)" does not exist.
784 !ENDIF
785 !ELSE
786 $(TARGET_DXE_DPX) : $(INF_FILENAME)
787 echo. > $(TARGET_DXE_DPX)
788 type $(TARGET_DXE_DPX) > $(TARGET_DXE_DPX)
789 !ENDIF
790 !ENDIF
791
792 #
793 # Describe how to build the HII export file from all the input HII pack files.
794 # Use the FFS file GUID for the package GUID in the export file. Only used
795 # when multiple VFR share strings.
796 #
797 $(DEST_DIR)\$(BASE_NAME).hii : $(HII_PACK_FILES)
798 $(HIIPACK) create -g $(FILE_GUID) -p $(HII_PACK_FILES) -o $(DEST_DIR)\$(BASE_NAME).hii
799
800 #
801 # If the build calls for creating an FFS file with the IFR included as
802 # a separate binary (not compiled into the driver), then build the binary
803 # section now. Note that the PACKAGE must be set correctly to actually get
804 # this IFR section pulled into the FFS file.
805 #
806 !IF ("$(HII_IFR_PACK_FILES)" != "")
807
808 $(DEST_DIR)\$(BASE_NAME)IfrBin.sec : $(HII_IFR_PACK_FILES)
809 $(HIIPACK) create -novarpacks -p $(HII_IFR_PACK_FILES) -o $(DEST_DIR)\$(BASE_NAME)IfrBin.hii
810 $(GENSECTION) -I $(DEST_DIR)\$(BASE_NAME)IfrBin.hii -O $(DEST_DIR)\$(BASE_NAME)IfrBin.sec -S EFI_SECTION_RAW
811
812 BIN_TARGETS = $(BIN_TARGETS) $(DEST_DIR)\$(BASE_NAME)IfrBin.sec
813
814 !ENDIF
815
816 #
817 # Build a FFS file from the sections and package
818 #
819 $(TARGET_FFS_FILE) : $(TARGET_PE32) $(TARGET_DPX) $(TARGET_UI) $(TARGET_VER) $(TARGET_DXE_DPX) $(PACKAGE_FILENAME)
820
821 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
822
823 !IF "$(CREATEDEPS)"=="YES"
824 all : $(DEP_TARGETS)
825 $(MAKE) -f $(MAKEFILE_NAME) all
826 !ELSE
827 all : $(LOCALIZE_TARGETS) $(BIN_TARGETS) $(TARGET_FFS_FILE) $(DEP_TARGETS)
828 !ENDIF
829
830 #
831 # Remove the generated temp and final files for this modules.
832 #
833 clean :
834 !IF ("$(FILE_GUID)" != "")
835 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
836 !ENDIF
837 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
838 @del /q $(DEST_OUTPUT_DIRS)
839
840 [=============================================================================]
841 [Build.Ia32.TE_PEIM,Build.x64.TE_PEIM]
842 #
843 # Define the library file we'll build if we have any objects defined.
844 #
845 !IFDEF OBJECTS
846 TARGET_LOCAL_LIB = $(DEST_DIR)\$(BASE_NAME)Local.lib
847 #
848 # LIB all the object files into our (local) target lib file. Put
849 # a dependency on the component's INF file in case it changes.
850 #
851 $(TARGET_LOCAL_LIB) : $(OBJECTS) $(INF_FILENAME) $(ENV_DEPS)
852 $(LIB) $(LIB_FLAGS) $(OBJECTS) /OUT:$@
853
854 !ELSE
855 !ERROR No source files to build were defined in the INF file
856 !ENDIF
857
858 #
859 # Defines for standard intermediate files and build targets
860 #
861 TARGET_DLL = $(BIN_DIR)\$(BASE_NAME).dll
862 TARGET_EFI = $(BIN_DIR)\$(BASE_NAME).efi
863 TARGET_DPX = $(DEST_DIR)\$(BASE_NAME).dpx
864 TARGET_UI = $(DEST_DIR)\$(BASE_NAME).ui
865 TARGET_VER = $(DEST_DIR)\$(BASE_NAME).ver
866 TARGET_MAP = $(BIN_DIR)\$(BASE_NAME).map
867 TARGET_PDB = $(BIN_DIR)\$(BASE_NAME).pdb
868 TARGET_SYM = $(BIN_DIR)\$(BASE_NAME).sym
869 TARGET_TE = $(BIN_DIR)\$(BASE_NAME).te
870 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pe32
871 TARGET_TES = $(DEST_DIR)\$(BASE_NAME).tes
872 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
873
874 #
875 # Create our TE section from our TE file
876 #
877 $(TARGET_TES) : $(TARGET_TE)
878 $(GENSECTION) -I $(TARGET_TE) -O $(TARGET_TES) -S EFI_SECTION_TE
879
880 #
881 # $(DEP_TARGETS) are not needed for binary build.
882 #
883 !IF "$(BINARY)" == "TRUE"
884 DEP_TARGETS=
885 CREATEDEPS=
886 !ENDIF
887
888 #
889 # Build module to generate *.efi file from source code or binary file.
890 #
891 !IF (("$(BINARY)" == "TRUE") && EXIST($(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).efi))
892 $(TARGET_EFI) : $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).efi
893 copy $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).efi $(TARGET_EFI) /Y
894 if exist $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).pdb \
895 copy $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).pdb $(TARGET_PDB) /Y
896 !ELSE
897 $(TARGET_EFI) : $(TARGET_DLL) $(INF_FILENAME)
898 $(FWIMAGE) $(COMPONENT_TYPE) $(TARGET_DLL) $(TARGET_EFI)
899 !IF ("$(EFI_BINARY_BUILD)" == "YES")
900 if not exist $(EFI_PLATFORM_BIN)\$(PROCESSOR) mkdir $(EFI_PLATFORM_BIN)\$(PROCESSOR)
901 if exist $(TARGET_EFI) copy $(TARGET_EFI) $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).efi /Y
902 if exist $(TARGET_PDB) copy $(TARGET_PDB) $(EFI_PLATFORM_BIN)\$(PROCESSOR)\$(BASE_NAME).pdb /Y
903 !ENDIF
904 !ENDIF
905
906 #
907 # Run GenTEImage on the built .efi file to create our TE file.
908 #
909 $(TARGET_TE) : $(TARGET_EFI)
910 $(GENTEIMAGE) -o $(TARGET_TE) $(TARGET_EFI)
911
912 #
913 # Link all objects and libs to create the executable
914 #
915 $(TARGET_DLL) : $(TARGET_LOCAL_LIB) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
916 $(LINK) $(LINK_FLAGS_DLL) $(LIBS) /ENTRY:$(IMAGE_ENTRY_POINT) \
917 $(TARGET_LOCAL_LIB) /OUT:$(TARGET_DLL) /MAP:$(TARGET_MAP) \
918 /PDB:$(TARGET_PDB)
919 $(SETSTAMP) $(TARGET_DLL) $(BUILD_DIR)\GenStamp.txt
920 !IF "$(EFI_GENERATE_SYM_FILE)" == "YES"
921 if exist $(TARGET_PDB) $(PE2SYM) $(TARGET_PDB) $(TARGET_SYM)
922 !ENDIF
923
924 !IF "$(EFI_ZERO_DEBUG_DATA)" == "YES"
925 $(ZERODEBUGDATA) $(TARGET_DLL)
926 !ENDIF
927
928 #
929 # Create the user interface section
930 #
931 $(TARGET_UI) : $(INF_FILENAME)
932 $(GENSECTION) -O $(TARGET_UI) -S EFI_SECTION_USER_INTERFACE -A "$(BASE_NAME)"
933
934 #
935 # Create the version section
936 #
937 !IF "$(BUILD_NUMBER)" != ""
938 !IF "$(VERSION_STRING)" != ""
939 $(TARGET_VER) : $(INF_FILENAME)
940 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER) -A "$(VERSION_STRING)"
941 !ELSE
942 $(TARGET_VER) : $(INF_FILENAME)
943 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER)
944 !ENDIF
945 !ELSE
946 $(TARGET_VER) : $(INF_FILENAME)
947 echo.>$(TARGET_VER)
948 type $(TARGET_VER)>$(TARGET_VER)
949 !ENDIF
950
951 #
952 # Makefile entries to create the dependency expression section.
953 # Use the DPX file from the source directory unless an override file
954 # was specified.
955 # If no DPX source file was specified, then create an empty file to
956 # be used.
957 #
958 !IF "$(DPX_SOURCE)" != ""
959 DPX_SOURCE_FILE = $(SOURCE_DIR)\$(DPX_SOURCE)
960 !ENDIF
961
962 !IF "$(DPX_SOURCE_OVERRIDE)" != ""
963 DPX_SOURCE_FILE = $(DPX_SOURCE_OVERRIDE)
964 !ENDIF
965
966 !IF "$(DPX_SOURCE_FILE)" != ""
967 !IF EXIST ($(DPX_SOURCE_FILE))
968
969 #
970 # Add build dependency check
971 #
972 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs.dep
973
974 !IF EXIST($(DEP_FILE))
975 !INCLUDE $(DEP_FILE)
976 !ENDIF
977
978 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
979
980 !IF EXIST($(TARGET_DPX))
981 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs.dep
982 !IF !EXIST($(DEP_FILE))
983 CREATEDEPS = YES
984 !ENDIF
985 !ENDIF
986
987 #
988 # Update dep file for next round incremental build
989 #
990 $(DEP_FILE) : $(TARGET_DPX)
991 $(MAKEDEPS) -f $(DPX_SOURCE_FILE) $(DEP_FLAGS)
992
993 !ENDIF
994
995 $(TARGET_DPX) : $(DPX_SOURCE_FILE) $(INF_FILENAME)
996 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
997 $(CC) $(C_FLAGS_DPX) $(DPX_SOURCE_FILE) > $*.tmp1
998 !ELSE
999 -$(CC) $(C_FLAGS_DPX) $(DPX_SOURCE_FILE) /showIncludes > $*.tmp1 2> $(DEST_DIR)\$(BASE_NAME)dxs.cl
1000 @$(MAKEDEPS) -f $(DEST_DIR)\$(BASE_NAME)dxs.cl $(DEP_FLAGS2)
1001 !ENDIF
1002 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
1003 $(GENSECTION) -I $*.tmp2 -O $@ -S $(DEPEX_TYPE)
1004 del $*.tmp1 > NUL
1005 del $*.tmp2 > NUL
1006 !ELSE
1007 !ERROR Dependency expression source file "$(DPX_SOURCE_FILE)" does not exist.
1008 !ENDIF
1009 !ELSE
1010 $(TARGET_DPX) : $(INF_FILENAME)
1011 echo. > $(TARGET_DPX)
1012 type $(TARGET_DPX) > $(TARGET_DPX)
1013 !ENDIF
1014
1015 #
1016 # Build an FFS file from the sections and package
1017 #
1018 $(TARGET_FFS_FILE) : $(TARGET_TES) $(TARGET_DPX) $(TARGET_UI) $(TARGET_VER) $(PACKAGE_FILENAME)
1019 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1020
1021 !IF "$(CREATEDEPS)"=="YES"
1022 all : $(DEP_TARGETS)
1023 $(MAKE) -f $(MAKEFILE_NAME) all
1024 !ELSE
1025 all : $(TARGET_FFS_FILE) $(DEP_TARGETS)
1026 !ENDIF
1027
1028 #
1029 # Remove the generated temp and final files for this modules.
1030 #
1031 clean :
1032 !IF ("$(FILE_GUID)" != "")
1033 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1034 !ENDIF
1035 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1036 @del /q $(DEST_OUTPUT_DIRS)
1037
1038 [=============================================================================]
1039 #
1040 # These are the commands to build EBC EFI targets
1041 #
1042 [=============================================================================]
1043 [Build.Ebc.BS_DRIVER|RT_DRIVER|APPLICATION]
1044
1045 #
1046 # Add the EBC library to our list of libs
1047 #
1048 LIBS = $(LIBS) $(EBC_TOOLS_PATH)\lib\EbcLib.lib
1049
1050 !IF "$(LOCALIZE)" == "YES"
1051
1052 !IF (("$(EFI_GENERATE_HII_RESOURCE)" == "YES") && ("$(EFI_SPECIFICATION_VERSION)" >= "0x0002000A"))
1053 #
1054 # This will generate HII resource section in PE/COFF image.
1055 #
1056 # Note: when HII package list is built into resource section, Driver no longer
1057 # refer to C array generated by VfrCompiler ($(FILE_NAME)Bin) and StrGather
1058 # ($(BASE_NAME)Strings); while in current build rule, those C array objects
1059 # will still be linked with the Driver, so please turn on link flag "/OPT:REF"
1060 # to minimize the code size.
1061 #
1062 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(BASE_NAME)Strings.hpk
1063 LOCALIZE_TARGETS = $(LOCALIZE_TARGETS) $(DEST_DIR)\$(BASE_NAME).res
1064 OBJECTS = $(OBJECTS) $(DEST_DIR)\$(BASE_NAME).res
1065
1066 $(DEST_DIR)\$(BASE_NAME).rc : $(HII_PACK_FILES)
1067 $(HIIPACK) -g $(FILE_GUID) $(HII_PACK_FILES) -rc $(DEST_DIR)\$(BASE_NAME).rc -hii $(DEST_DIR)\$(BASE_NAME).hii
1068
1069 $(DEST_DIR)\$(BASE_NAME).res : $(DEST_DIR)\$(BASE_NAME).rc
1070 $(RC) /fo $(DEST_DIR)\$(BASE_NAME).res $(DEST_DIR)\$(BASE_NAME).rc
1071
1072 !ENDIF
1073
1074 !IF (("$(EFI_GENERATE_HII_EXPORT)" == "YES") && ("$(EFI_SPECIFICATION_VERSION)" < "0x0002000A"))
1075 #
1076 # There will be one HII pack containing all the strings. Add that file
1077 # to the list of HII pack files we'll use to create our final HII export file.
1078 #
1079 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(BASE_NAME)Strings.hpk
1080
1081 LOCALIZE_TARGETS = $(LOCALIZE_TARGETS) $(DEST_DIR)\$(BASE_NAME).hii
1082 !ENDIF
1083
1084 !IF ("$(EFI_SPECIFICATION_VERSION)" >= "0x0002000A")
1085 #
1086 # Note: currently -ppflag option is only available for UefiStrGather
1087 # Note: /GS- will cause warning for preprocess, so filter it out from STRGATHER_PPFLAG
1088 #
1089 STRGATHER_PPFLAG = $(EBC_C_FLAGS: /GS-=)
1090 STRGATHER_FLAGS = $(STRGATHER_FLAGS) -ppflag "$(STRGATHER_PPFLAG)" -oh $(DEST_DIR)\$(BASE_NAME)StrDefs.h
1091 !ENDIF
1092
1093 $(DEST_DIR)\$(BASE_NAME).sdb : $(SDB_FILES) $(SOURCE_FILES)
1094 $(STRGATHER) -scan -vdbr $(STRGATHER_FLAGS) -od $(DEST_DIR)\$(BASE_NAME).sdb \
1095 -skipext .uni -skipext .h $(SOURCE_FILES)
1096
1097 $(DEST_DIR)\$(BASE_NAME)Strings.c : $(DEST_DIR)\$(BASE_NAME).sdb
1098 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
1099 -oc $(DEST_DIR)\$(BASE_NAME)Strings.c
1100
1101 $(DEST_DIR)\$(BASE_NAME)StrDefs.h : $(DEST_DIR)\$(BASE_NAME).sdb
1102 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
1103 -oh $(DEST_DIR)\$(BASE_NAME)StrDefs.h
1104
1105 $(DEST_DIR)\$(BASE_NAME)Strings.hpk : $(DEST_DIR)\$(BASE_NAME).sdb
1106 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
1107 -hpk $(DEST_DIR)\$(BASE_NAME)Strings.hpk
1108
1109 OBJECTS = $(OBJECTS) $(DEST_DIR)\$(BASE_NAME)Strings.obj
1110
1111 $(DEST_DIR)\$(BASE_NAME)Strings.obj : $(DEST_DIR)\$(BASE_NAME)Strings.c $(INF_FILENAME) $(ALL_DEPS)
1112 $(EBC_CC) $(EBC_C_FLAGS) $(DEST_DIR)\$(BASE_NAME)Strings.c
1113
1114 LOCALIZE_TARGETS = $(DEST_DIR)\$(BASE_NAME)StrDefs.h $(LOCALIZE_TARGETS)
1115
1116 !ENDIF
1117
1118 #
1119 # If building an application, then the target is a .app, not .dxe
1120 #
1121 !IF "$(COMPONENT_TYPE)" == "APPLICATION"
1122 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).app
1123 SUBSYSTEM = EFI_APPLICATION
1124 !ELSE
1125 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).dxe
1126 SUBSYSTEM = EFI_BOOT_SERVICE_DRIVER
1127 !ENDIF
1128
1129 #
1130 # Defines for standard intermediate files and build targets
1131 #
1132 TARGET_EFI = $(BIN_DIR)\$(BASE_NAME).efi
1133 TARGET_DPX = $(DEST_DIR)\$(BASE_NAME).dpx
1134 TARGET_UI = $(DEST_DIR)\$(BASE_NAME).ui
1135 TARGET_VER = $(DEST_DIR)\$(BASE_NAME).ver
1136 TARGET_MAP = $(BIN_DIR)\$(BASE_NAME).map
1137 TARGET_PDB = $(BIN_DIR)\$(BASE_NAME).pdb
1138 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pe32
1139 TARGET_DLL = $(BIN_DIR)\$(BASE_NAME).dll
1140
1141 #
1142 # First link all the objects and libs together to make a .dll file
1143 #
1144 $(TARGET_DLL) : $(OBJECTS) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
1145 $(EBC_LINK) $(EBC_LINK_FLAGS) /SUBSYSTEM:$(SUBSYSTEM) /ENTRY:EfiStart \
1146 $(OBJECTS) $(LIBS) /OUT:$(TARGET_DLL) /MAP:$(TARGET_MAP)
1147 $(SETSTAMP) $(TARGET_DLL) $(BUILD_DIR)\GenStamp.txt
1148 !IF "$(EFI_ZERO_DEBUG_DATA)" == "YES"
1149 $(ZERODEBUGDATA) $(TARGET_DLL)
1150 !ENDIF
1151
1152 #
1153 # Now take the .dll file and make a .efi file
1154 #
1155 $(TARGET_EFI) : $(TARGET_DLL) $(INF_FILENAME)
1156 $(FWIMAGE) -t 0 $(COMPONENT_TYPE) $(TARGET_DLL) $(TARGET_EFI)
1157
1158 #
1159 # Now take the .efi file and make a .pe32 section
1160 #
1161 $(TARGET_PE32) : $(TARGET_EFI)
1162 $(GENSECTION) -I $(TARGET_EFI) -O $(TARGET_PE32) -S EFI_SECTION_PE32
1163
1164 #
1165 # Create the user interface section
1166 #
1167 $(TARGET_UI) : $(INF_FILENAME)
1168 $(GENSECTION) -O $(TARGET_UI) -S EFI_SECTION_USER_INTERFACE -A "$(BASE_NAME)"
1169
1170 #
1171 # Create the version section
1172 #
1173 !IF "$(BUILD_NUMBER)" != ""
1174 !IF "$(VERSION_STRING)" != ""
1175 $(TARGET_VER) : $(INF_FILENAME)
1176 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER) -A "$(VERSION_STRING)"
1177 !ELSE
1178 $(TARGET_VER) : $(INF_FILENAME)
1179 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER)
1180 !ENDIF
1181 !ELSE
1182 $(TARGET_VER) : $(INF_FILENAME)
1183 echo. > $(TARGET_VER)
1184 type $(TARGET_VER) > $(TARGET_VER)
1185 !ENDIF
1186
1187 #
1188 # Makefile entries to create the dependency expression section.
1189 # Use the DPX file from the source directory unless an override file
1190 # was specified.
1191 # If no DPX source file was specified, then create an empty file to
1192 # be used.
1193 #
1194 !IF "$(DPX_SOURCE)" != ""
1195 DPX_SOURCE_FILE = $(SOURCE_DIR)\$(DPX_SOURCE)
1196 !ENDIF
1197
1198 !IF "$(DPX_SOURCE_OVERRIDE)" != ""
1199 DPX_SOURCE_FILE = $(DPX_SOURCE_OVERRIDE)
1200 !ENDIF
1201
1202 !IF "$(DPX_SOURCE_FILE)" != ""
1203 !IF EXIST ($(DPX_SOURCE_FILE))
1204
1205 #
1206 # Add build dependency check
1207 #
1208 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs.dep
1209
1210 !IF EXIST($(DEP_FILE))
1211 !INCLUDE $(DEP_FILE)
1212 !ENDIF
1213
1214 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
1215
1216 !IF EXIST($(TARGET_DPX))
1217 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs.dep
1218 !IF !EXIST($(DEP_FILE))
1219 CREATEDEPS = YES
1220 !ENDIF
1221 !ENDIF
1222
1223 #
1224 # Update dep file for next round incremental build
1225 #
1226 $(DEP_FILE) : $(TARGET_DPX)
1227 $(MAKEDEPS) -f $(DPX_SOURCE_FILE) $(DEP_FLAGS)
1228
1229 !ENDIF
1230
1231 $(TARGET_DPX) : $(DPX_SOURCE_FILE) $(INF_FILENAME)
1232 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
1233 $(CC) $(C_FLAGS_DPX) $(DPX_SOURCE_FILE) > $*.tmp1
1234 !ELSE
1235 -$(CC) $(C_FLAGS_DPX) $(DPX_SOURCE_FILE) /showIncludes > $*.tmp1 2> $(DEST_DIR)\$(BASE_NAME)dxs.cl
1236 @$(MAKEDEPS) -f $(DEST_DIR)\$(BASE_NAME)dxs.cl $(DEP_FLAGS2)
1237 !ENDIF
1238 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
1239 $(GENSECTION) -I $*.tmp2 -O $@ -S $(DEPEX_TYPE)
1240 del $*.tmp1 > NUL
1241 del $*.tmp2 > NUL
1242 !ELSE
1243 !ERROR Dependency expression source file "$(DPX_SOURCE_FILE)" does not exist.
1244 !ENDIF
1245 !ELSE
1246 $(TARGET_DPX) : $(INF_FILENAME)
1247 echo. > $(TARGET_DPX)
1248 type $(TARGET_DPX) > $(TARGET_DPX)
1249 !ENDIF
1250
1251 #
1252 # Describe how to build the HII export file from all the input HII pack files.
1253 # Use the FFS file GUID for the package GUID in the export file. Only used
1254 # when multiple VFR share strings.
1255 #
1256 $(DEST_DIR)\$(BASE_NAME).hii : $(HII_PACK_FILES)
1257 $(HIIPACK) create -g $(FILE_GUID) -p $(HII_PACK_FILES) -o $(DEST_DIR)\$(BASE_NAME).hii
1258
1259 #
1260 # If the build calls for creating an FFS file with the IFR included as
1261 # a separate binary (not compiled into the driver), then build the binary
1262 # section now. Note that the PACKAGE must be set correctly to actually get
1263 # this IFR section pulled into the FFS file.
1264 #
1265 !IF ("$(HII_IFR_PACK_FILES)" != "")
1266
1267 $(DEST_DIR)\$(BASE_NAME)IfrBin.sec : $(HII_IFR_PACK_FILES)
1268 $(HIIPACK) create -novarpacks -p $(HII_IFR_PACK_FILES) -o $(DEST_DIR)\$(BASE_NAME)IfrBin.hii
1269 $(GENSECTION) -I $(DEST_DIR)\$(BASE_NAME)IfrBin.hii -O $(DEST_DIR)\$(BASE_NAME)IfrBin.sec -S EFI_SECTION_RAW
1270
1271 BIN_TARGETS = $(BIN_TARGETS) $(DEST_DIR)\$(BASE_NAME)IfrBin.sec
1272
1273 !ENDIF
1274
1275 #
1276 # Build an FFS file from the sections and package
1277 #
1278 $(TARGET_FFS_FILE) : $(TARGET_PE32) $(TARGET_DPX) $(TARGET_UI) $(TARGET_VER) $(PACKAGE_FILENAME)
1279 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1280
1281 !IF "$(CREATEDEPS)"=="YES"
1282 all : $(DEP_TARGETS)
1283 $(MAKE) -f $(MAKEFILE_NAME) all
1284 !ELSE
1285 all : $(LOCALIZE_TARGETS) $(BIN_TARGETS) $(TARGET_FFS_FILE) $(DEP_TARGETS)
1286 !ENDIF
1287
1288 #
1289 # Remove the generated temp and final files for this modules.
1290 #
1291 clean :
1292 !IF ("$(FILE_GUID)" != "")
1293 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1294 !ENDIF
1295 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1296 @del /q $(DEST_OUTPUT_DIRS)
1297
1298 [=============================================================================]
1299 #
1300 # These are the commands to build vendor-provided *.EFI files into an FV.
1301 # To use them, create an INF file with BUILD_TYPE=BS_DRIVER_EFI.
1302 # This section, as it now exists, only supports boot service drivers.
1303 #
1304 [=============================================================================]
1305 [Build.Ia32.BS_DRIVER_EFI|RT_DRIVER_EFI|APPLICATION_EFI|PE32_PEIM_EFI,Build.x64.BS_DRIVER_EFI|RT_DRIVER_EFI|APPLICATION_EFI|PE32_PEIM_EFI]
1306 #
1307 # Defines for standard intermediate files and build targets. For the source
1308 # .efi file, take the one in the source directory if it exists. If there's not
1309 # one there, look for one in the processor-specfic subdirectory.
1310 #
1311 !IF EXIST ("$(SOURCE_DIR)\$(BASE_NAME).efi")
1312 TARGET_EFI = $(SOURCE_DIR)\$(BASE_NAME).efi
1313 !ELSEIF EXIST ("$(SOURCE_DIR)\$(PROCESSOR)\$(BASE_NAME).efi")
1314 TARGET_EFI = $(SOURCE_DIR)\$(PROCESSOR)\$(BASE_NAME).efi
1315 !ELSE
1316 !ERROR Pre-existing $(BASE_NAME).efi file not found in $(SOURCE_DIR) nor $(SOURCE_DIR)\$(PROCESSOR)
1317 !ENDIF
1318
1319 TARGET_DPX = $(DEST_DIR)\$(BASE_NAME).dpx
1320 TARGET_UI = $(DEST_DIR)\$(BASE_NAME).ui
1321 TARGET_VER = $(DEST_DIR)\$(BASE_NAME).ver
1322 TARGET_MAP = $(BIN_DIR)\$(BASE_NAME).map
1323 TARGET_PDB = $(BIN_DIR)\$(BASE_NAME).pdb
1324 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pe32
1325 TARGET_DLL = $(BIN_DIR)\$(BASE_NAME).dll
1326
1327 #
1328 # If building an application, then the target is a .app, not .dxe
1329 #
1330 !IF "$(COMPONENT_TYPE)" == "APPLICATION"
1331 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).app
1332 !ELSE IF "$(COMPONENT_TYPE)" == "PE32_PEIM"
1333 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
1334 !ELSE
1335 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).dxe
1336 !ENDIF
1337
1338 #
1339 # Take the .efi file and make a .pe32 file
1340 #
1341 $(TARGET_PE32) : $(TARGET_EFI)
1342 $(GENSECTION) -I $(TARGET_EFI) -O $(TARGET_PE32) -S EFI_SECTION_PE32
1343
1344 #
1345 # Create the user interface section
1346 #
1347 $(TARGET_UI) : $(INF_FILENAME)
1348 $(GENSECTION) -O $(TARGET_UI) -S EFI_SECTION_USER_INTERFACE -A "$(BASE_NAME)"
1349
1350 #
1351 # Create the version section
1352 #
1353 !IF "$(BUILD_NUMBER)" != ""
1354 !IF "$(VERSION_STRING)" != ""
1355 $(TARGET_VER) : $(INF_FILENAME)
1356 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER) -A "$(VERSION_STRING)"
1357 !ELSE
1358 $(TARGET_VER) : $(INF_FILENAME)
1359 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER)
1360 !ENDIF
1361 !ELSE
1362 $(TARGET_VER) : $(INF_FILENAME)
1363 echo. > $(TARGET_VER)
1364 type $(TARGET_VER) > $(TARGET_VER)
1365 !ENDIF
1366
1367 #
1368 # Makefile entries to create the dependency expression section.
1369 # Use the DPX file from the source directory unless an override file
1370 # was specified.
1371 # If no DPX source file was specified, then create an empty file to
1372 # be used.
1373 #
1374 !IF "$(DPX_SOURCE)" != ""
1375 DPX_SOURCE_FILE = $(SOURCE_DIR)\$(DPX_SOURCE)
1376 !ENDIF
1377
1378 !IF "$(DPX_SOURCE_OVERRIDE)" != ""
1379 DPX_SOURCE_FILE = $(DPX_SOURCE_OVERRIDE)
1380 !ENDIF
1381
1382 !IF "$(DPX_SOURCE_FILE)" != ""
1383 !IF EXIST ($(DPX_SOURCE_FILE))
1384
1385 #
1386 # Add build dependency check
1387 #
1388 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs.dep
1389
1390 !IF EXIST($(DEP_FILE))
1391 !INCLUDE $(DEP_FILE)
1392 !ENDIF
1393
1394 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
1395
1396 !IF EXIST($(TARGET_DPX))
1397 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs.dep
1398 !IF !EXIST($(DEP_FILE))
1399 CREATEDEPS = YES
1400 !ENDIF
1401 !ENDIF
1402
1403 #
1404 # Update dep file for next round incremental build
1405 #
1406 $(DEP_FILE) : $(TARGET_DPX)
1407 $(MAKEDEPS) -f $(DPX_SOURCE_FILE) $(DEP_FLAGS)
1408
1409 !ENDIF
1410
1411 $(TARGET_DPX) : $(DPX_SOURCE_FILE) $(INF_FILENAME)
1412 !IF "$(EFI_USE_CL_FOR_DEP)" != "YES"
1413 $(CC) $(C_FLAGS_DPX) $(DPX_SOURCE_FILE) > $*.tmp1
1414 !ELSE
1415 -$(CC) $(C_FLAGS_DPX) $(DPX_SOURCE_FILE) /showIncludes > $*.tmp1 2> $(DEST_DIR)\$(BASE_NAME)dxs.cl
1416 @$(MAKEDEPS) -f $(DEST_DIR)\$(BASE_NAME)dxs.cl $(DEP_FLAGS2)
1417 !ENDIF
1418 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
1419 $(GENSECTION) -I $*.tmp2 -O $@ -S $(DEPEX_TYPE)
1420 del $*.tmp1 > NUL
1421 del $*.tmp2 > NUL
1422 !ELSE
1423 !ERROR Dependency expression source file "$(DPX_SOURCE_FILE)" does not exist.
1424 !ENDIF
1425 !ELSE
1426 $(TARGET_DPX) : $(INF_FILENAME)
1427 echo. > $(TARGET_DPX)
1428 type $(TARGET_DPX) > $(TARGET_DPX)
1429 !ENDIF
1430
1431 #
1432 # Build a FFS file from the sections and package
1433 #
1434 $(TARGET_FFS_FILE) : $(TARGET_PE32) $(TARGET_DPX) $(TARGET_UI) $(TARGET_VER) $(PACKAGE_FILENAME)
1435 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1436
1437 all : $(TARGET_FFS_FILE)
1438
1439 #
1440 # Remove the generated temp and final files for this modules.
1441 #
1442 clean :
1443 !IF ("$(FILE_GUID)" != "")
1444 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1445 !ENDIF
1446 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1447 @del /q $(DEST_OUTPUT_DIRS)
1448
1449 [=============================================================================]
1450 [Compile.Ia32.Bin|Bmp,Compile.x64.Bin|Bmp]
1451 #
1452 # We simply define the binary source file name
1453 #
1454 BINARY_SOURCE_FILE = $(SOURCE_FILE_NAME)
1455
1456 [=============================================================================]
1457 [Build.Ia32.BINARY|Legacy16|Logo,Build.x64.BINARY|Legacy16|Logo]
1458 #
1459 # Use GenFfsFile to convert it to an FFS file
1460 #
1461 $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs : $(BINARY_SOURCE_FILE) $(PACKAGE_FILENAME) $(INF_FILENAME)
1462 $(GENSECTION) -I $(BINARY_SOURCE_FILE) -O $(DEST_DIR)\$(BASE_NAME).sec -S EFI_SECTION_RAW
1463 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1464
1465 all : $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs
1466
1467 #
1468 # Remove the generated temp and final files for this modules.
1469 #
1470 clean :
1471 !IF ("$(FILE_GUID)" != "")
1472 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1473 !ENDIF
1474 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1475 @del /q $(DEST_OUTPUT_DIRS)
1476
1477 [=============================================================================]
1478 [Build.Ia32.RAWFILE|CONFIG,Build.x64.RAWFILE|CONFIG]
1479 #
1480 # Use GenFfsFile to convert it to an raw FFS file
1481 #
1482 $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).raw : $(BINARY_SOURCE_FILE) $(PACKAGE_FILENAME) $(INF_FILENAME)
1483 copy $(BINARY_SOURCE_FILE) $(DEST_DIR)\$(BASE_NAME).bin /Y
1484 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1485
1486 all : $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).raw
1487
1488 #
1489 # Remove the generated temp and final files for this modules.
1490 #
1491 clean :
1492 !IF ("$(FILE_GUID)" != "")
1493 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1494 !ENDIF
1495 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1496 @del /q $(DEST_OUTPUT_DIRS)
1497
1498 [=============================================================================]
1499 #
1500 # These are commands to compile unicode .uni files.
1501 #
1502 [=============================================================================]
1503 [Compile.Ia32.Uni,Compile.Ebc.Uni,Compile.x64.Uni]
1504 #
1505 # Emit an error message if the file's base name is the same as the
1506 # component base name. This causes build issues.
1507 #
1508 !IF "$(FILE)" == "$(BASE_NAME)"
1509 !ERROR Component Unicode string file name cannot be the same as the component BASE_NAME.
1510 !ENDIF
1511
1512 #
1513 # Always create dep file for uni file as it can be created at the same time when
1514 # strgather is parsing uni file.
1515 #
1516 DEP_FILE = $(DEST_DIR)\$(FILE)Uni.dep
1517
1518 !IF EXIST($(DEP_FILE))
1519 !INCLUDE $(DEP_FILE)
1520 !ENDIF
1521
1522 $(DEST_DIR)\$(FILE).sdb : $(SOURCE_FILE_NAME) $(INF_FILENAME)
1523 $(STRGATHER) -parse -newdb -db $(DEST_DIR)\$(FILE).sdb -dep $(DEP_FILE) $(INC) $(SOURCE_FILE_NAME)
1524
1525 SDB_FILES = $(SDB_FILES) $(DEST_DIR)\$(FILE).sdb
1526 STRGATHER_FLAGS = $(STRGATHER_FLAGS) -db $(DEST_DIR)\$(FILE).sdb
1527 LOCALIZE = YES
1528
1529 [=============================================================================]
1530 [Compile.Ia32.hfr,Compile.Ebc.hfr,Compile.x64.hfr]
1531 [=============================================================================]
1532 [Compile.Ia32.Vfr,Compile.x64.Vfr]
1533
1534 #
1535 # Add build dependency check
1536 #
1537 DEP_FILE = $(DEST_DIR)\$(FILE)Vfr.dep
1538
1539 !IF EXIST($(DEP_FILE))
1540 !INCLUDE $(DEP_FILE)
1541 !ENDIF
1542
1543 !IF EXIST($(DEST_DIR)\$(FILE).obj)
1544 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Vfr.dep
1545 !IF !EXIST($(DEP_FILE))
1546 CREATEDEPS = YES
1547 !ENDIF
1548 !ENDIF
1549
1550 #
1551 # Update dep file for next round incremental build
1552 #
1553 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
1554 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
1555
1556 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1557
1558 #
1559 # Add a dummy command for building the HII pack file. In reality, it's built
1560 # below, but the C_FLAGS macro reference the target as $@, so you can't specify
1561 # the obj and hpk files as dual targets of the same command.
1562 #
1563 $(DEST_DIR)\$(FILE).hpk : $(DEST_DIR)\$(FILE).obj
1564
1565 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
1566 $(VFRCOMPILE) $(VFRCOMPILE_FLAGS) $(INC) -ibin -od $(DEST_DIR)\$(SOURCE_RELATIVE_PATH) \
1567 -l $(VFR_FLAGS) $(SOURCE_FILE_NAME)
1568 $(CC) $(C_FLAGS) $(DEST_DIR)\$(FILE).c
1569
1570 [=============================================================================]
1571 [Compile.Ebc.Vfr]
1572
1573 DEP_FILE = $(DEST_DIR)\$(FILE)Vfr.dep
1574
1575 !IF EXIST($(DEST_DIR)\$(FILE).obj)
1576 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Vfr.dep
1577 !IF !EXIST($(DEP_FILE))
1578 CREATEDEPS = YES
1579 !ENDIF
1580 !ENDIF
1581
1582 !IF EXIST($(DEP_FILE))
1583 !INCLUDE $(DEP_FILE)
1584 !ENDIF
1585
1586 #
1587 # Update dep file for next round incremental build
1588 #
1589 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
1590 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
1591
1592 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1593
1594 #
1595 # Add a dummy command for building the HII pack file. In reality, it's built
1596 # below, but the C_FLAGS macro reference the target as $@, so you can't specify
1597 # the obj and hpk files as dual targets of the same command.
1598 #
1599 $(DEST_DIR)\$(FILE).hpk : $(DEST_DIR)\$(FILE).obj
1600
1601 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
1602 $(VFRCOMPILE) $(VFRCOMPILE_FLAGS) $(INC) -ibin -od $(DEST_DIR)\$(SOURCE_RELATIVE_PATH) \
1603 -l $(VFR_FLAGS) $(SOURCE_FILE_NAME)
1604 $(EBC_CC) $(EBC_C_FLAGS) $(DEST_DIR)\$(FILE).c
1605
1606 [=============================================================================]
1607 #
1608 # Commands for building IFR as uncompressed binary into the FFS file. To
1609 # use it, set COMPILE_SELECT=.vfr=Ifr_Bin for the component in the DSC file.
1610 #
1611 [=============================================================================]
1612 [Compile.Ia32.Ifr_Bin,Compile.x64.Ifr_Bin]
1613
1614 #
1615 # Add build dependency check
1616 #
1617 DEP_FILE = $(DEST_DIR)\$(FILE)Vfr.dep
1618
1619 !IF EXIST($(DEP_FILE))
1620 !INCLUDE $(DEP_FILE)
1621 !ENDIF
1622
1623 !IF EXIST($(DEST_DIR)\$(FILE).obj)
1624 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Vfr.dep
1625 !IF !EXIST($(DEP_FILE))
1626 CREATEDEPS = YES
1627 !ENDIF
1628 !ENDIF
1629
1630 #
1631 # Update dep file for next round incremental build
1632 #
1633 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
1634 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
1635
1636 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1637
1638 #
1639 # Add a dummy command for building the HII pack file. In reality, it's built
1640 # below, but the C_FLAGS macro reference the target as $@, so you can't specify
1641 # the obj and hpk files as dual targets of the same command.
1642 #
1643 $(DEST_DIR)\$(FILE).hpk : $(DEST_DIR)\$(FILE).obj
1644
1645 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
1646 $(VFRCOMPILE) $(VFRCOMPILE_FLAGS) $(INC) -ibin -od $(DEST_DIR)\$(SOURCE_RELATIVE_PATH) \
1647 -l $(VFR_FLAGS) $(SOURCE_FILE_NAME)
1648 $(CC) $(C_FLAGS) $(DEST_DIR)\$(FILE).c
1649
1650 #
1651 # Add to the variable that contains the list of VFR binary files we're going
1652 # to merge together at the end of the build.
1653 #
1654 HII_IFR_PACK_FILES = $(HII_IFR_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1655
1656 [=============================================================================]
1657 #
1658 # Commands for building IFR as uncompressed binary into the FFS file. To
1659 # use it, set COMPILE_SELECT=.vfr=Ifr_Bin for the component in the DSC file.
1660 #
1661 [=============================================================================]
1662 [Compile.Ebc.Ifr_Bin]
1663
1664 #
1665 # Add build dependency check
1666 #
1667 DEP_FILE = $(DEST_DIR)\$(FILE)Vfr.dep
1668
1669 !IF EXIST($(DEP_FILE))
1670 !INCLUDE $(DEP_FILE)
1671 !ENDIF
1672
1673 !IF EXIST($(DEST_DIR)\$(FILE).obj)
1674 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Vfr.dep
1675 !IF !EXIST($(DEP_FILE))
1676 CREATEDEPS = YES
1677 !ENDIF
1678 !ENDIF
1679
1680 #
1681 # Update dep file for next round incremental build
1682 #
1683 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
1684 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
1685
1686 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1687
1688 #
1689 # Add a dummy command for building the HII pack file. In reality, it's built
1690 # below, but the C_FLAGS macro reference the target as $@, so you can't specify
1691 # the obj and hpk files as dual targets of the same command.
1692 #
1693 $(DEST_DIR)\$(FILE).hpk : $(DEST_DIR)\$(FILE).obj
1694
1695 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
1696 $(VFRCOMPILE) $(VFRCOMPILE_FLAGS) $(INC) -ibin -od $(DEST_DIR)\$(SOURCE_RELATIVE_PATH) \
1697 -l $(VFR_FLAGS) $(SOURCE_FILE_NAME)
1698 $(EBC_CC) $(EBC_C_FLAGS) $(DEST_DIR)\$(FILE).c
1699
1700 #
1701 # Add to the variable that contains the list of VFR binary files we're going
1702 # to merge together at the end of the build.
1703 #
1704 HII_IFR_PACK_FILES = $(HII_IFR_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1705
1706 [=============================================================================]
1707 [Compile.Ia32.Fv,Compile.x64.Fv]
1708 #
1709 # Run GenSection on the firmware volume image.
1710 #
1711 $(DEST_DIR)\$(SOURCE_FV)Fv.sec : $(SOURCE_FILE_NAME) $(INF_FILENAME)
1712 $(GENSECTION) -I $(SOURCE_FILE_NAME) -O $(DEST_DIR)\$(SOURCE_FV)Fv.sec -S EFI_SECTION_FIRMWARE_VOLUME_IMAGE
1713
1714 [=============================================================================]