3 # Copyright (c) 2004 - 2007, Intel Corporation
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
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.
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.
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
31 [=============================================================================]
33 # These get emitted at the top of the generated master makefile.
35 [=============================================================================]
38 # From the [makefile.out] section of the DSC file
43 !INCLUDE $(BUILD_DIR)\PlatformTools.env
47 [=============================================================================]
49 # These get expanded and dumped out to each component makefile after the
50 # component INF [defines] section gets parsed.
52 [=============================================================================]
55 # From the [Makefile.Common] section of the description file.
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)
68 # Define the global dependency files
70 !IF EXIST ($(DEST_DIR)\$(BASE_NAME)StrDefs.h)
71 INC_DEPS = $(INC_DEPS) $(DEST_DIR)\$(BASE_NAME)StrDefs.h
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)
78 !IF "$(LANGUAGE)" != ""
79 LANGUAGE_FLAGS = -lang $(LANGUAGE)
82 !INCLUDE $(BUILD_DIR)\PlatformTools.env
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
87 DEPEX_TYPE = EFI_SECTION_DXE_DEPEX
91 # Command flags for MAKEDEPS tool
93 DEP_FLAGS = -target $** -o $(DEP_FILE) $(INC) -ignorenotfound -q
95 [=============================================================================]
97 # These are the commands to compile source files. One of these blocks gets
98 # emitted to the component's makefile for each source file. The section
99 # name is encoded as [Compile.$(PROCESSOR).source_filename_extension], where
100 # the source filename comes from the sources section of the component INF file.
102 # If the dependency list file already exists, then include it for this
103 # source file. If it doesn't exist, then this is a clean build and the
104 # dependency file will get created below and the source file will get
107 # Current behavior is that the first clean build will not create dep files.
108 # But the following second build has to create dep files before build source files.
109 # CREATEDEPS flag is used to judge whether current build is the second build or not.
112 [=============================================================================]
113 [Compile.Ia32.asm,Compile.x64.asm]
115 DEP_FILE = $(DEST_DIR)\$(FILE)Asm.dep
117 !IF EXIST($(DEST_DIR)\$(FILE).obj)
118 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Asm.dep
119 !IF !EXIST($(DEP_FILE))
124 !IF EXIST($(DEP_FILE))
129 # Update dep file for next round incremental build
131 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
132 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS) -asm
137 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
138 $(ASM) $(ASM_FLAGS) $(SOURCE_FILE_NAME)
140 [=============================================================================]
143 DEP_FILE = $(DEST_DIR)\$(FILE)S.dep
145 !IF EXIST($(DEST_DIR)\$(FILE).pro)
146 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)S.dep
147 !IF !EXIST($(DEP_FILE))
152 !IF EXIST($(DEP_FILE))
157 # Update dep file for next round incremental build
159 $(DEP_FILE) : $(DEST_DIR)\$(FILE).pro
160 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
165 $(DEST_DIR)\$(FILE).pro : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
166 $(CC) $(C_FLAGS_PRO) $(SOURCE_FILE_NAME) > $@
168 $(DEST_DIR)\$(FILE).obj : $(DEST_DIR)\$(FILE).pro
169 $(ASM) $(ASM_FLAGS) $(DEST_DIR)\$(FILE).pro
171 [=============================================================================]
172 [Compile.Ia32.c,Compile.Ipf.c,Compile.x64.c]
174 DEP_FILE = $(DEST_DIR)\$(FILE).dep
176 !IF EXIST($(DEST_DIR)\$(FILE).obj)
177 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE).dep
178 !IF !EXIST($(DEP_FILE))
183 !IF EXIST($(DEP_FILE))
188 # Update dep file for next round incremental build
190 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
191 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
196 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
197 $(CC) $(C_FLAGS) $(SOURCE_FILE_NAME)
199 [=============================================================================]
202 DEP_FILE = $(DEST_DIR)\$(FILE).dep
204 !IF EXIST($(DEST_DIR)\$(FILE).obj)
205 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE).dep
206 !IF !EXIST($(DEP_FILE))
211 !IF EXIST($(DEP_FILE))
216 # Update dep file for next round incremental build
218 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
219 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
224 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
225 $(EBC_CC) $(EBC_C_FLAGS) $(SOURCE_FILE_NAME)
227 [=============================================================================]
229 # Commands for compiling a ".apr" Apriori source file.
231 [=============================================================================]
232 [Compile.Ia32.Apr,Compile.Ipf.Apr,Compile.Ebc.Apr,Compile.x64.Apr]
234 # Create the raw binary file. If you get an error on the build saying it doesn't
235 # know how to create the .apr file, then you're missing (or mispelled) the
236 # "APRIORI=" on the component lines in components section in the DSC file.
238 $(DEST_DIR)\$(BASE_NAME).bin : $(SOURCE_FILE_NAME)
239 $(GENAPRIORI) -v -f $(SOURCE_FILE_NAME) -o $(DEST_DIR)\$(BASE_NAME).bin
241 $(DEST_DIR)\$(BASE_NAME).sec : $(DEST_DIR)\$(BASE_NAME).bin
242 $(GENSECTION) -I $(DEST_DIR)\$(BASE_NAME).bin -O $(DEST_DIR)\$(BASE_NAME).sec -S EFI_SECTION_RAW
244 [=============================================================================]
245 [Build.Ia32.Apriori,Build.Ipf.Apriori,Build.Ebc.Apriori,Build.x64.Apriori]
247 all : $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).FFS
250 # Run GenFfsFile on the package file and .raw file to create the firmware file
252 $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).FFS : $(DEST_DIR)\$(BASE_NAME).sec $(PACKAGE_FILENAME)
253 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
256 # Remove the generated temp and final files for this modules.
259 !IF ("$(FILE_GUID)" != "")
260 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
262 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
263 @del /q $(DEST_OUTPUT_DIRS)
265 [=============================================================================]
266 [Build.Ia32.Makefile,Build.Ipf.Makefile,Build.Ebc.Makefile,Build.x64.Makefile]
269 # Copy the makefile directly from the source directory, then make it
270 # writable so we can copy over it later if we try to.
272 $(DEST_DIR)\makefile.new : $(SOURCE_DIR)\makefile.new
273 copy $(SOURCE_DIR)\makefile.new $(DEST_DIR)\makefile.new
274 attrib -r $(DEST_DIR)\makefile.new
277 # Make the all target, set some required macros.
280 $(MAKE) -f $(DEST_DIR)\makefile.new all \
281 SOURCE_DIR=$(SOURCE_DIR) \
282 BUILD_DIR=$(BUILD_DIR) \
283 FILE_GUID=$(FILE_GUID) \
284 DEST_DIR=$(DEST_DIR) \
285 PROCESSOR=$(PROCESSOR) \
286 TOOLCHAIN=TOOLCHAIN_$(PROCESSOR) \
287 BASE_NAME=$(BASE_NAME) \
288 PACKAGE_FILENAME=$(PACKAGE_FILENAME)
290 all : $(DEST_DIR)\makefile.new call_makefile
293 # Remove the generated temp and final files for this modules.
296 @- $(MAKE) -f $(DEST_DIR)\makefile.new clean > NUL 2>&1
297 !IF ("$(FILE_GUID)" != "")
298 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
300 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
301 @del /q $(DEST_OUTPUT_DIRS)
303 [=============================================================================]
305 # Instructions for building a component that uses a custom makefile. Encoding
306 # is [build.$(PROCESSOR).$(BUILD_TYPE)].
308 # To build these components, simply call the makefile from the source
311 [=============================================================================]
312 [Build.Ia32.Custom_Makefile,Build.Ipf.Custom_Makefile,Build.Ebc.Custom_Makefile,Build.x64.Custom_Makefile]
315 # Just call the makefile from the source directory, passing in some
319 $(MAKE) -f $(SOURCE_DIR)\makefile all \
320 SOURCE_DIR=$(SOURCE_DIR) \
321 BUILD_DIR=$(BUILD_DIR) \
322 DEST_DIR=$(DEST_DIR) \
323 FILE_GUID=$(FILE_GUID) \
324 PROCESSOR=$(PROCESSOR) \
325 TOOLCHAIN=TOOLCHAIN_$(PROCESSOR) \
326 BASE_NAME=$(BASE_NAME) \
327 PLATFORM=$(PLATFORM) \
328 SOURCE_FV=$(SOURCE_FV) \
329 PACKAGE_FILENAME=$(PACKAGE_FILENAME)
332 # Remove the generated temp and final files for this modules.
335 @- $(MAKE) -f $(SOURCE_DIR)\makefile clean > NUL 2>&1
336 !IF ("$(FILE_GUID)" != "")
337 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
339 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
340 @del /q $(DEST_OUTPUT_DIRS)
342 [=============================================================================]
344 # These commands are used to build libraries
346 [=============================================================================]
347 [Build.Ia32.LIBRARY,Build.Ipf.LIBRARY,Build.x64.LIBRARY]
349 # LIB all the object files into to our target lib file. Put
350 # a dependency on the component's INF file in case it changes.
352 LIB_NAME = $(LIB_DIR)\$(BASE_NAME).lib
354 $(LIB_NAME) : $(OBJECTS) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
355 $(LIB) $(LIB_FLAGS) $(OBJECTS) $(LIBS) /OUT:$@
357 !IF "$(CREATEDEPS)"=="YES"
359 $(MAKE) -f $(MAKEFILE_NAME) all
361 all : $(LIB_NAME) $(DEP_TARGETS)
365 # Remove the generated temp and final files for this modules.
368 !IF ("$(FILE_GUID)" != "")
369 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
371 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
372 @del /q $(DEST_OUTPUT_DIRS)
374 [=============================================================================]
377 # LIB all the object files into to our target lib file. Put
378 # a dependency on the component's INF file in case it changes.
380 LIB_NAME = $(LIB_DIR)\$(BASE_NAME).lib
382 $(LIB_NAME) : $(OBJECTS) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
383 $(EBC_LIB) $(EBC_LIB_FLAGS) $(OBJECTS) $(LIBS) /OUT:$@
385 !IF "$(CREATEDEPS)"=="YES"
387 $(MAKE) -f $(MAKEFILE_NAME) all
389 all : $(LIB_NAME) $(DEP_TARGETS)
393 # Remove the generated temp and final files for this modules.
396 !IF ("$(FILE_GUID)" != "")
397 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
399 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
400 @del /q $(DEST_OUTPUT_DIRS)
402 [=============================================================================]
404 # This is the Build.$(PROCESSOR).$(COMPONENT_TYPE) section that tells how to
405 # convert a firmware volume into an FV FFS file. Simply run it through
406 # GenFfsFile with the appropriate package file. SOURCE_FV must be defined
407 # in the component INF file Defines section.
409 [=============================================================================]
410 [Build.Ia32.FvImageFile,Build.x64.FvImageFile,Build.Ipf.FvImageFile]
412 all : $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).Fvi
415 # Run GenFfsFile on the package file and FV file to create the firmware
416 # volume FFS file. This FFS file maybe contain one pad section for alignment requirement.
418 $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).Fvi : $(DEST_DIR)\$(SOURCE_FV)Fv.sec $(PACKAGE_FILENAME) $(PAD_SECTION)
419 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
422 # Remove the generated temp and final files for this modules.
425 !IF ("$(FILE_GUID)" != "")
426 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
428 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
429 @del /q $(DEST_OUTPUT_DIRS)
431 [=============================================================================]
433 # Since many of the steps are the same for the different component types, we
434 # share this section for BS_DRIVER, RT_DRIVER, .... and IFDEF the parts that
435 # differ. The entire section gets dumped to the output makefile.
437 [=============================================================================]
438 [Build.Ia32.BS_DRIVER|RT_DRIVER|SAL_RT_DRIVER|PE32_PEIM|PEI_CORE|PIC_PEIM|RELOCATABLE_PEIM|DXE_CORE|APPLICATION|COMBINED_PEIM_DRIVER, Build.Ipf.BS_DRIVER|RT_DRIVER|SAL_RT_DRIVER|PEI_CORE|PE32_PEIM|PIC_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]
440 !IF "$(LOCALIZE)" == "YES"
442 !IF "$(EFI_GENERATE_HII_EXPORT)" == "YES"
443 STRGATHER_FLAGS = $(STRGATHER_FLAGS) -hpk $(DEST_DIR)\$(BASE_NAME)Strings.hpk
446 # There will be one HII pack containing all the strings. Add that file
447 # to the list of HII pack files we'll use to create our final HII export file.
449 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(BASE_NAME)Strings.hpk
450 LOCALIZE_TARGETS = $(LOCALIZE_TARGETS) $(DEST_DIR)\$(BASE_NAME).hii
453 $(DEST_DIR)\$(BASE_NAME).sdb : $(SDB_FILES) $(SOURCE_FILES)
454 $(STRGATHER) -scan -vdbr $(STRGATHER_FLAGS) -od $(DEST_DIR)\$(BASE_NAME).sdb \
455 -skipext .uni -skipext .h $(SOURCE_FILES)
457 $(DEST_DIR)\$(BASE_NAME)Strings.c : $(DEST_DIR)\$(BASE_NAME).sdb
458 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
459 -oc $(DEST_DIR)\$(BASE_NAME)Strings.c
461 $(DEST_DIR)\$(BASE_NAME)StrDefs.h : $(DEST_DIR)\$(BASE_NAME).sdb
462 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
463 -oh $(DEST_DIR)\$(BASE_NAME)StrDefs.h
465 $(DEST_DIR)\$(BASE_NAME)Strings.hpk : $(DEST_DIR)\$(BASE_NAME).sdb
466 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
467 -hpk $(DEST_DIR)\$(BASE_NAME)Strings.hpk
469 OBJECTS = $(OBJECTS) $(DEST_DIR)\$(BASE_NAME)Strings.obj
471 $(DEST_DIR)\$(BASE_NAME)Strings.obj : $(DEST_DIR)\$(BASE_NAME)Strings.c $(INF_FILENAME) $(ALL_DEPS)
472 $(CC) $(C_FLAGS) $(DEST_DIR)\$(BASE_NAME)Strings.c
474 LOCALIZE_TARGETS = $(LOCALIZE_TARGETS) $(DEST_DIR)\$(BASE_NAME)StrDefs.h
479 # If we have any objects associated with this component, then we're
480 # going to build a local library from them.
483 !ERROR No source files to build were defined in the INF file
486 TARGET_LOCAL_LIB = $(DEST_DIR)\$(BASE_NAME)Local.lib
489 # LIB all the object files into our (local) target lib file. Put
490 # a dependency on the component's INF file in case it changes.
492 $(TARGET_LOCAL_LIB) : $(OBJECTS) $(INF_FILENAME) $(ENV_DEPS)
493 $(LIB) $(LIB_FLAGS) $(OBJECTS) /OUT:$@
496 # Defines for standard intermediate files and build targets
498 TARGET_DLL = $(BIN_DIR)\$(BASE_NAME).dll
499 TARGET_EFI = $(BIN_DIR)\$(BASE_NAME).efi
500 TARGET_DPX = $(DEST_DIR)\$(BASE_NAME).dpx
501 TARGET_UI = $(DEST_DIR)\$(BASE_NAME).ui
502 TARGET_VER = $(DEST_DIR)\$(BASE_NAME).ver
503 TARGET_MAP = $(BIN_DIR)\$(BASE_NAME).map
504 TARGET_PDB = $(BIN_DIR)\$(BASE_NAME).pdb
505 TARGET_SYM = $(BIN_DIR)\$(BASE_NAME).sym
508 # Target executable section extension depends on the component type.
509 # Only define "TARGET_DXE_DPX" if it's a combined peim driver.
511 !IF "$(COMPONENT_TYPE)" == "PIC_PEIM"
512 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pic
514 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pe32
518 # Target FFS file extension depends on the component type
519 # Also define "TARGET_DXE_DPX" if it's a combined PEIM driver.
521 SUBSYSTEM = EFI_BOOT_SERVICE_DRIVER
523 !IF "$(COMPONENT_TYPE)" == "APPLICATION"
524 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).app
525 SUBSYSTEM = EFI_APPLICATION
526 !ELSE IF "$(COMPONENT_TYPE)" == "PEI_CORE"
527 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
528 !ELSE IF "$(COMPONENT_TYPE)" == "PE32_PEIM"
529 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
530 !ELSE IF "$(COMPONENT_TYPE)" == "RELOCATABLE_PEIM"
531 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
532 !ELSE IF "$(COMPONENT_TYPE)" == "PIC_PEIM"
533 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
534 !ELSE IF "$(COMPONENT_TYPE)" == "COMBINED_PEIM_DRIVER"
535 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
536 TARGET_DXE_DPX = $(DEST_DIR)\$(BASE_NAME).dpxd
538 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).dxe
542 # Different methods to build section based on if PIC_PEIM
544 !IF "$(COMPONENT_TYPE)" == "PIC_PEIM"
546 $(TARGET_PE32) : $(TARGET_DLL)
547 $(PE2BIN) $(TARGET_DLL) $(DEST_DIR)\$(BASE_NAME).TMP
549 # BUGBUG: Build PEIM header, needs to go away with new PEI.
551 $(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
552 $(GENSECTION) -I $(TARGET_PIC_PEI).tmp -O $(TARGET_PE32) -S EFI_SECTION_PIC
553 del $(DEST_DIR)\$(BASE_NAME).TMP
557 $(TARGET_PE32) : $(TARGET_EFI)
558 $(GENSECTION) -I $(TARGET_EFI) -O $(TARGET_PE32) -S EFI_SECTION_PE32
561 # Run FWImage on the DLL to set it as an EFI image type.
563 $(TARGET_EFI) : $(TARGET_DLL) $(INF_FILENAME)
564 $(FWIMAGE) -t 0 $(COMPONENT_TYPE) $(TARGET_DLL) $(TARGET_EFI)
569 # Link all objects and libs to create the executable
571 $(TARGET_DLL) : $(TARGET_LOCAL_LIB) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
572 $(LINK) $(LINK_FLAGS_DLL) $(LIBS) /ENTRY:$(IMAGE_ENTRY_POINT) \
573 $(TARGET_LOCAL_LIB) /OUT:$(TARGET_DLL) /MAP:$(TARGET_MAP) \
575 $(SETSTAMP) $(TARGET_DLL) $(BUILD_DIR)\GenStamp.txt
576 !IF "$(EFI_GENERATE_SYM_FILE)" == "YES"
577 if exist $(TARGET_PDB) $(PE2SYM) $(TARGET_PDB) $(TARGET_SYM)
580 !IF "$(EFI_ZERO_DEBUG_DATA)" == "YES"
581 $(ZERODEBUGDATA) $(TARGET_DLL)
585 # Create the user interface section
587 $(TARGET_UI) : $(INF_FILENAME)
588 $(GENSECTION) -O $(TARGET_UI) -S EFI_SECTION_USER_INTERFACE -A "$(BASE_NAME)"
591 # Create the version section
593 !IF "$(BUILD_NUMBER)" != ""
594 !IF "$(VERSION_STRING)" != ""
595 $(TARGET_VER) : $(INF_FILENAME)
596 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER) -A "$(VERSION_STRING)"
598 $(TARGET_VER) : $(INF_FILENAME)
599 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER)
604 type $(TARGET_VER)>$(TARGET_VER)
608 # Makefile entries to create the dependency expression section.
609 # Use the DPX file from the source directory unless an override file
611 # If no DPX source file was specified, then create an empty file to
614 !IF "$(DPX_SOURCE)" != ""
615 DPX_SOURCE_FILE = $(SOURCE_DIR)\$(DPX_SOURCE)
618 !IF "$(DPX_SOURCE_OVERRIDE)" != ""
619 DPX_SOURCE_FILE = $(DPX_SOURCE_OVERRIDE)
622 !IF "$(DPX_SOURCE_FILE)" != ""
623 !IF EXIST ($(DPX_SOURCE_FILE))
625 # Add dependency check for dxs file, because dxs file depends on PPI or
626 # PROTOCOL guid defintions.
628 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs.dep
630 !IF EXIST($(TARGET_DPX))
631 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs.dep
632 !IF !EXIST($(DEP_FILE))
637 !IF EXIST($(DEP_FILE))
641 # Update dep file for next round incremental build
643 $(DEP_FILE) : $(TARGET_DPX)
644 $(MAKEDEPS) -f $(DPX_SOURCE_FILE) $(DEP_FLAGS)
646 $(TARGET_DPX) : $(DPX_SOURCE_FILE) $(INF_FILENAME)
647 $(CC) /nologo $(INC) $(VERSION_FLAGS) /EP $(DPX_SOURCE_FILE) > $*.tmp1
648 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
649 $(GENSECTION) -I $*.tmp2 -O $@ -S $(DEPEX_TYPE)
653 !ERROR Dependency expression source file "$(DPX_SOURCE_FILE)" does not exist.
657 echo. > $(TARGET_DPX)
658 type $(TARGET_DPX) > $(TARGET_DPX)
662 # Makefile entries for DXE DPX for combined PEIM drivers.
663 # If a DXE_DPX_SOURCE file was specified in the INF file, use it. Otherwise
664 # create an empty file and use it as a DPX file.
666 !IF "$(COMPONENT_TYPE)" == "COMBINED_PEIM_DRIVER"
667 !IF "$(DXE_DPX_SOURCE)" != ""
668 !IF EXIST ($(SOURCE_DIR)\$(DXE_DPX_SOURCE))
669 $(TARGET_DXE_DPX) : $(SOURCE_DIR)\$(DXE_DPX_SOURCE) $(INF_FILENAME)
670 $(CC) /nologo $(INC) $(VERSION_FLAGS) /EP $(SOURCE_DIR)\$(DXE_DPX_SOURCE) > $*.tmp1
671 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
672 $(GENSECTION) -I $*.tmp2 -O $@ -S EFI_SECTION_DXE_DEPEX
676 !ERROR Dependency expression source file "$(SOURCE_DIR)\$(DXE_DPX_SOURCE)" does not exist.
680 echo. > $(TARGET_DXE_DPX)
681 type $(TARGET_DXE_DPX) > $(TARGET_DXE_DPX)
686 # Describe how to build the HII export file from all the input HII pack files.
687 # Use the FFS file GUID for the package GUID in the export file. Only used
688 # when multiple VFR share strings.
690 $(DEST_DIR)\$(BASE_NAME).hii : $(HII_PACK_FILES)
691 $(HIIPACK) create -g $(FILE_GUID) -p $(HII_PACK_FILES) -o $(DEST_DIR)\$(BASE_NAME).hii
694 # If the build calls for creating an FFS file with the IFR included as
695 # a separate binary (not compiled into the driver), then build the binary
696 # section now. Note that the PACKAGE must be set correctly to actually get
697 # this IFR section pulled into the FFS file.
699 !IF ("$(HII_IFR_PACK_FILES)" != "")
701 $(DEST_DIR)\$(BASE_NAME)IfrBin.sec : $(HII_IFR_PACK_FILES)
702 $(HIIPACK) create -novarpacks -p $(HII_IFR_PACK_FILES) -o $(DEST_DIR)\$(BASE_NAME)IfrBin.hii
703 $(GENSECTION) -I $(DEST_DIR)\$(BASE_NAME)IfrBin.hii -O $(DEST_DIR)\$(BASE_NAME)IfrBin.sec -S EFI_SECTION_RAW
705 BIN_TARGETS = $(BIN_TARGETS) $(DEST_DIR)\$(BASE_NAME)IfrBin.sec
710 # Build a FFS file from the sections and package
712 $(TARGET_FFS_FILE) : $(TARGET_PE32) $(TARGET_DPX) $(TARGET_UI) $(TARGET_VER) $(TARGET_DXE_DPX) $(PACKAGE_FILENAME)
714 # Some of our components require padding to align code
716 !IF "$(PROCESSOR)" == "IPF"
717 !IF "$(COMPONENT_TYPE)" == "PIC_PEIM" || "$(COMPONENT_TYPE)" == "PE32_PEIM" || "$(COMPONENT_TYPE)" == "RELOCATABLE_PEIM" || "$(COMPONENT_TYPE)" == "SECURITY_CORE" || "$(COMPONENT_TYPE)" == "PEI_CORE" || "$(COMPONENT_TYPE)" == "COMBINED_PEIM_DRIVER"
718 copy $(BIN_DIR)\Blank.pad $(DEST_DIR)
721 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
723 !IF "$(CREATEDEPS)"=="YES"
725 $(MAKE) -f $(MAKEFILE_NAME) all
727 all : $(LOCALIZE_TARGETS) $(BIN_TARGETS) $(TARGET_FFS_FILE) $(DEP_TARGETS)
731 # Remove the generated temp and final files for this modules.
734 !IF ("$(FILE_GUID)" != "")
735 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
737 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
738 @del /q $(DEST_OUTPUT_DIRS)
740 [=============================================================================]
741 [Build.Ia32.TE_PEIM,Build.Ipf.TE_PEIM,Build.x64.TE_PEIM]
743 # Define the library file we'll build if we have any objects defined.
746 TARGET_LOCAL_LIB = $(DEST_DIR)\$(BASE_NAME)Local.lib
748 # LIB all the object files into our (local) target lib file. Put
749 # a dependency on the component's INF file in case it changes.
751 $(TARGET_LOCAL_LIB) : $(OBJECTS) $(INF_FILENAME) $(ENV_DEPS)
752 $(LIB) $(LIB_FLAGS) $(OBJECTS) /OUT:$@
755 !ERROR No source files to build were defined in the INF file
759 # Defines for standard intermediate files and build targets
761 TARGET_DLL = $(BIN_DIR)\$(BASE_NAME).dll
762 TARGET_EFI = $(BIN_DIR)\$(BASE_NAME).efi
763 TARGET_DPX = $(DEST_DIR)\$(BASE_NAME).dpx
764 TARGET_UI = $(DEST_DIR)\$(BASE_NAME).ui
765 TARGET_VER = $(DEST_DIR)\$(BASE_NAME).ver
766 TARGET_MAP = $(BIN_DIR)\$(BASE_NAME).map
767 TARGET_PDB = $(BIN_DIR)\$(BASE_NAME).pdb
768 TARGET_SYM = $(BIN_DIR)\$(BASE_NAME).sym
769 TARGET_TE = $(BIN_DIR)\$(BASE_NAME).te
770 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pe32
771 TARGET_TES = $(DEST_DIR)\$(BASE_NAME).tes
772 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).pei
775 # Create our TE section from our TE file
777 $(TARGET_TES) : $(TARGET_TE)
778 $(GENSECTION) -I $(TARGET_TE) -O $(TARGET_TES) -S EFI_SECTION_TE
781 # Run FWImage on the DLL to set it as an EFI image type.
783 $(TARGET_EFI) : $(TARGET_DLL) $(INF_FILENAME)
784 $(FWIMAGE) $(COMPONENT_TYPE) $(TARGET_DLL) $(TARGET_EFI)
787 # Run GenTEImage on the built .efi file to create our TE file.
789 $(TARGET_TE) : $(TARGET_EFI)
790 $(GENTEIMAGE) -o $(TARGET_TE) $(TARGET_EFI)
793 # Link all objects and libs to create the executable
795 $(TARGET_DLL) : $(TARGET_LOCAL_LIB) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
796 $(LINK) $(LINK_FLAGS_DLL) $(LIBS) /ENTRY:$(IMAGE_ENTRY_POINT) \
797 $(TARGET_LOCAL_LIB) /OUT:$(TARGET_DLL) /MAP:$(TARGET_MAP) \
799 $(SETSTAMP) $(TARGET_DLL) $(BUILD_DIR)\GenStamp.txt
800 !IF "$(EFI_GENERATE_SYM_FILE)" == "YES"
801 if exist $(TARGET_PDB) $(PE2SYM) $(TARGET_PDB) $(TARGET_SYM)
804 !IF "$(EFI_ZERO_DEBUG_DATA)" == "YES"
805 $(ZERODEBUGDATA) $(TARGET_DLL)
809 # Create the user interface section
811 $(TARGET_UI) : $(INF_FILENAME)
812 $(GENSECTION) -O $(TARGET_UI) -S EFI_SECTION_USER_INTERFACE -A "$(BASE_NAME)"
815 # Create the version section
817 !IF "$(BUILD_NUMBER)" != ""
818 !IF "$(VERSION_STRING)" != ""
819 $(TARGET_VER) : $(INF_FILENAME)
820 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER) -A "$(VERSION_STRING)"
822 $(TARGET_VER) : $(INF_FILENAME)
823 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER)
828 type $(TARGET_VER)>$(TARGET_VER)
832 # Makefile entries to create the dependency expression section.
833 # Use the DPX file from the source directory unless an override file
835 # If no DPX source file was specified, then create an empty file to
838 !IF "$(DPX_SOURCE)" != ""
839 DPX_SOURCE_FILE = $(SOURCE_DIR)\$(DPX_SOURCE)
842 !IF "$(DPX_SOURCE_OVERRIDE)" != ""
843 DPX_SOURCE_FILE = $(DPX_SOURCE_OVERRIDE)
846 !IF "$(DPX_SOURCE_FILE)" != ""
847 !IF EXIST ($(DPX_SOURCE_FILE))
849 # Add dependency check for dxs file, because dxs file depends on PPI or
850 # PROTOCOL guid defintions.
852 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs.dep
854 !IF EXIST($(TARGET_DPX))
855 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs.dep
856 !IF !EXIST($(DEP_FILE))
861 !IF EXIST($(DEP_FILE))
865 # Update dep file for next round incremental build
867 $(DEP_FILE) : $(TARGET_DPX)
868 $(MAKEDEPS) -f $(DPX_SOURCE_FILE) $(DEP_FLAGS)
870 $(TARGET_DPX) : $(DPX_SOURCE_FILE) $(INF_FILENAME)
871 $(CC) /nologo $(INC) $(VERSION_FLAGS) /EP $(DPX_SOURCE_FILE) > $*.tmp1
872 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
873 $(GENSECTION) -I $*.tmp2 -O $@ -S $(DEPEX_TYPE)
877 !ERROR Dependency expression source file "$(DPX_SOURCE_FILE)" does not exist.
881 echo. > $(TARGET_DPX)
882 type $(TARGET_DPX) > $(TARGET_DPX)
886 # Build an FFS file from the sections and package
888 $(TARGET_FFS_FILE) : $(TARGET_TES) $(TARGET_DPX) $(TARGET_UI) $(TARGET_VER) $(PACKAGE_FILENAME)
889 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
891 !IF "$(CREATEDEPS)"=="YES"
893 $(MAKE) -f $(MAKEFILE_NAME) all
895 all : $(TARGET_FFS_FILE) $(DEP_TARGETS)
899 # Remove the generated temp and final files for this modules.
902 !IF ("$(FILE_GUID)" != "")
903 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
905 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
906 @del /q $(DEST_OUTPUT_DIRS)
908 [=============================================================================]
910 # These are the commands to build EBC EFI targets
912 [=============================================================================]
913 [Build.Ebc.BS_DRIVER|RT_DRIVER|APPLICATION]
916 # Add the EBC library to our list of libs
918 LIBS = $(LIBS) $(EBC_TOOLS_PATH)\lib\EbcLib.lib
920 !IF "$(LOCALIZE)" == "YES"
922 !IF "$(EFI_GENERATE_HII_EXPORT)" == "YES"
923 STRGATHER_FLAGS = $(STRGATHER_FLAGS) -hpk $(DEST_DIR)\$(BASE_NAME)Strings.hpk
926 # There will be one HII pack containing all the strings. Add that file
927 # to the list of HII pack files we'll use to create our final HII export file.
929 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(BASE_NAME)Strings.hpk
931 LOCALIZE_TARGETS = $(LOCALIZE_TARGETS) $(DEST_DIR)\$(BASE_NAME).hii
934 $(DEST_DIR)\$(BASE_NAME).sdb : $(SDB_FILES) $(SOURCE_FILES)
935 $(STRGATHER) -scan -vdbr $(STRGATHER_FLAGS) -od $(DEST_DIR)\$(BASE_NAME).sdb \
936 -skipext .uni -skipext .h $(SOURCE_FILES)
938 $(DEST_DIR)\$(BASE_NAME)Strings.c : $(DEST_DIR)\$(BASE_NAME).sdb
939 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
940 -oc $(DEST_DIR)\$(BASE_NAME)Strings.c
942 $(DEST_DIR)\$(BASE_NAME)StrDefs.h : $(DEST_DIR)\$(BASE_NAME).sdb
943 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
944 -oh $(DEST_DIR)\$(BASE_NAME)StrDefs.h
946 $(DEST_DIR)\$(BASE_NAME)Strings.hpk : $(DEST_DIR)\$(BASE_NAME).sdb
947 $(STRGATHER) -dump $(LANGUAGE_FLAGS) -bn $(BASE_NAME)Strings -db $(DEST_DIR)\$(BASE_NAME).sdb \
948 -hpk $(DEST_DIR)\$(BASE_NAME)Strings.hpk
950 OBJECTS = $(OBJECTS) $(DEST_DIR)\$(BASE_NAME)Strings.obj
952 $(DEST_DIR)\$(BASE_NAME)Strings.obj : $(DEST_DIR)\$(BASE_NAME)Strings.c $(INF_FILENAME) $(ALL_DEPS)
953 $(EBC_CC) $(EBC_C_FLAGS) $(DEST_DIR)\$(BASE_NAME)Strings.c
955 LOCALIZE_TARGETS = $(LOCALIZE_TARGETS) $(DEST_DIR)\$(BASE_NAME)StrDefs.h
960 # If building an application, then the target is a .app, not .dxe
962 !IF "$(COMPONENT_TYPE)" == "APPLICATION"
963 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).app
964 SUBSYSTEM = EFI_APPLICATION
966 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).dxe
967 SUBSYSTEM = EFI_BOOT_SERVICE_DRIVER
971 # Defines for standard intermediate files and build targets
973 TARGET_EFI = $(BIN_DIR)\$(BASE_NAME).efi
974 TARGET_DPX = $(DEST_DIR)\$(BASE_NAME).dpx
975 TARGET_UI = $(DEST_DIR)\$(BASE_NAME).ui
976 TARGET_VER = $(DEST_DIR)\$(BASE_NAME).ver
977 TARGET_MAP = $(BIN_DIR)\$(BASE_NAME).map
978 TARGET_PDB = $(BIN_DIR)\$(BASE_NAME).pdb
979 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pe32
980 TARGET_DLL = $(BIN_DIR)\$(BASE_NAME).dll
983 # First link all the objects and libs together to make a .dll file
985 $(TARGET_DLL) : $(OBJECTS) $(LIBS) $(INF_FILENAME) $(ENV_DEPS)
986 $(EBC_LINK) $(EBC_LINK_FLAGS) /SUBSYSTEM:$(SUBSYSTEM) /ENTRY:EfiStart \
987 $(OBJECTS) $(LIBS) /OUT:$(TARGET_DLL) /MAP:$(TARGET_MAP)
988 $(SETSTAMP) $(TARGET_DLL) $(BUILD_DIR)\GenStamp.txt
989 !IF "$(EFI_ZERO_DEBUG_DATA)" == "YES"
990 $(ZERODEBUGDATA) $(TARGET_DLL)
994 # Now take the .dll file and make a .efi file
996 $(TARGET_EFI) : $(TARGET_DLL) $(INF_FILENAME)
997 $(FWIMAGE) -t 0 $(COMPONENT_TYPE) $(TARGET_DLL) $(TARGET_EFI)
1000 # Now take the .efi file and make a .pe32 section
1002 $(TARGET_PE32) : $(TARGET_EFI)
1003 $(GENSECTION) -I $(TARGET_EFI) -O $(TARGET_PE32) -S EFI_SECTION_PE32
1006 # Create the user interface section
1008 $(TARGET_UI) : $(INF_FILENAME)
1009 $(GENSECTION) -O $(TARGET_UI) -S EFI_SECTION_USER_INTERFACE -A "$(BASE_NAME)"
1012 # Create the version section
1014 !IF "$(BUILD_NUMBER)" != ""
1015 !IF "$(VERSION_STRING)" != ""
1016 $(TARGET_VER) : $(INF_FILENAME)
1017 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER) -A "$(VERSION_STRING)"
1019 $(TARGET_VER) : $(INF_FILENAME)
1020 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER)
1024 echo. > $(TARGET_VER)
1025 type $(TARGET_VER) > $(TARGET_VER)
1029 # Makefile entries to create the dependency expression section.
1030 # Use the DPX file from the source directory unless an override file
1032 # If no DPX source file was specified, then create an empty file to
1035 !IF "$(DPX_SOURCE)" != ""
1036 DPX_SOURCE_FILE = $(SOURCE_DIR)\$(DPX_SOURCE)
1039 !IF "$(DPX_SOURCE_OVERRIDE)" != ""
1040 DPX_SOURCE_FILE = $(DPX_SOURCE_OVERRIDE)
1043 !IF "$(DPX_SOURCE_FILE)" != ""
1044 !IF EXIST ($(DPX_SOURCE_FILE))
1046 # Add dependency check for dxs file, because dxs file depends on PPI or
1047 # PROTOCOL guid defintions.
1049 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs.dep
1051 !IF EXIST($(TARGET_DPX))
1052 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs.dep
1053 !IF !EXIST($(DEP_FILE))
1058 !IF EXIST($(DEP_FILE))
1059 !INCLUDE $(DEP_FILE)
1062 # Update dep file for next round incremental build
1064 $(DEP_FILE) : $(TARGET_DPX)
1065 $(MAKEDEPS) -f $(DPX_SOURCE_FILE) $(DEP_FLAGS)
1067 $(TARGET_DPX) : $(DPX_SOURCE_FILE) $(INF_FILENAME)
1068 $(CC) /nologo $(INC) $(VERSION_FLAGS) /EP $(DPX_SOURCE_FILE) > $*.tmp1
1069 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
1070 $(GENSECTION) -I $*.tmp2 -O $@ -S $(DEPEX_TYPE)
1074 !ERROR Dependency expression source file "$(DPX_SOURCE_FILE)" does not exist.
1078 echo. > $(TARGET_DPX)
1079 type $(TARGET_DPX) > $(TARGET_DPX)
1083 # Describe how to build the HII export file from all the input HII pack files.
1084 # Use the FFS file GUID for the package GUID in the export file. Only used
1085 # when multiple VFR share strings.
1087 $(DEST_DIR)\$(BASE_NAME).hii : $(HII_PACK_FILES)
1088 $(HIIPACK) create -g $(FILE_GUID) -p $(HII_PACK_FILES) -o $(DEST_DIR)\$(BASE_NAME).hii
1091 # If the build calls for creating an FFS file with the IFR included as
1092 # a separate binary (not compiled into the driver), then build the binary
1093 # section now. Note that the PACKAGE must be set correctly to actually get
1094 # this IFR section pulled into the FFS file.
1096 !IF ("$(HII_IFR_PACK_FILES)" != "")
1098 $(DEST_DIR)\$(BASE_NAME)IfrBin.sec : $(HII_IFR_PACK_FILES)
1099 $(HIIPACK) create -novarpacks -p $(HII_IFR_PACK_FILES) -o $(DEST_DIR)\$(BASE_NAME)IfrBin.hii
1100 $(GENSECTION) -I $(DEST_DIR)\$(BASE_NAME)IfrBin.hii -O $(DEST_DIR)\$(BASE_NAME)IfrBin.sec -S EFI_SECTION_RAW
1102 BIN_TARGETS = $(BIN_TARGETS) $(DEST_DIR)\$(BASE_NAME)IfrBin.sec
1107 # Build an FFS file from the sections and package
1109 $(TARGET_FFS_FILE) : $(TARGET_PE32) $(TARGET_DPX) $(TARGET_UI) $(TARGET_VER) $(PACKAGE_FILENAME)
1110 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1112 !IF "$(CREATEDEPS)"=="YES"
1113 all : $(DEP_TARGETS)
1114 $(MAKE) -f $(MAKEFILE_NAME) all
1116 all : $(LOCALIZE_TARGETS) $(BIN_TARGETS) $(TARGET_FFS_FILE) $(DEP_TARGETS)
1120 # Remove the generated temp and final files for this modules.
1123 !IF ("$(FILE_GUID)" != "")
1124 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1126 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1127 @del /q $(DEST_OUTPUT_DIRS)
1129 [=============================================================================]
1131 # These are the commands to build vendor-provided *.EFI files into an FV.
1132 # To use them, create an INF file with BUILD_TYPE=BS_DRIVER_EFI.
1133 # This section, as it now exists, only supports boot service drivers.
1135 [=============================================================================]
1136 [Build.Ia32.BS_DRIVER_EFI|RT_DRIVER_EFI|APPLICATION_EFI,Build.Ipf.BS_DRIVER_EFI|RT_DRIVER_EFI|APPLICATION_EFI,Build.Ebc.BS_DRIVER_EFI|RT_DRIVER_EFI|APPLICATION_EFI,Build.x64.BS_DRIVER_EFI|RT_DRIVER_EFI|APPLICATION_EFI]
1138 # Defines for standard intermediate files and build targets. For the source
1139 # .efi file, take the one in the source directory if it exists. If there's not
1140 # one there, look for one in the processor-specfic subdirectory.
1142 !IF EXIST ("$(SOURCE_DIR)\$(BASE_NAME).efi")
1143 TARGET_EFI = $(SOURCE_DIR)\$(BASE_NAME).efi
1144 !ELSEIF EXIST ("$(SOURCE_DIR)\$(PROCESSOR)\$(BASE_NAME).efi")
1145 TARGET_EFI = $(SOURCE_DIR)\$(PROCESSOR)\$(BASE_NAME).efi
1147 !ERROR Pre-existing $(BASE_NAME).efi file not found in $(SOURCE_DIR) nor $(SOURCE_DIR)\$(PROCESSOR)
1150 TARGET_DPX = $(DEST_DIR)\$(BASE_NAME).dpx
1151 TARGET_UI = $(DEST_DIR)\$(BASE_NAME).ui
1152 TARGET_VER = $(DEST_DIR)\$(BASE_NAME).ver
1153 TARGET_MAP = $(BIN_DIR)\$(BASE_NAME).map
1154 TARGET_PDB = $(BIN_DIR)\$(BASE_NAME).pdb
1155 TARGET_PE32 = $(DEST_DIR)\$(BASE_NAME).pe32
1156 TARGET_DLL = $(BIN_DIR)\$(BASE_NAME).dll
1159 # If building an application, then the target is a .app, not .dxe
1161 !IF "$(COMPONENT_TYPE)" == "APPLICATION"
1162 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).app
1164 TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).dxe
1168 # Take the .efi file and make a .pe32 file
1170 $(TARGET_PE32) : $(TARGET_EFI)
1171 $(GENSECTION) -I $(TARGET_EFI) -O $(TARGET_PE32) -S EFI_SECTION_PE32
1174 # Create the user interface section
1176 $(TARGET_UI) : $(INF_FILENAME)
1177 $(GENSECTION) -O $(TARGET_UI) -S EFI_SECTION_USER_INTERFACE -A "$(BASE_NAME)"
1180 # Create the version section
1182 !IF "$(BUILD_NUMBER)" != ""
1183 !IF "$(VERSION_STRING)" != ""
1184 $(TARGET_VER) : $(INF_FILENAME)
1185 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER) -A "$(VERSION_STRING)"
1187 $(TARGET_VER) : $(INF_FILENAME)
1188 $(GENSECTION) -O $(TARGET_VER) -S EFI_SECTION_VERSION -V $(BUILD_NUMBER)
1192 echo. > $(TARGET_VER)
1193 type $(TARGET_VER) > $(TARGET_VER)
1197 # Makefile entries to create the dependency expression section.
1198 # Use the DPX file from the source directory unless an override file
1200 # If no DPX source file was specified, then create an empty file to
1203 !IF "$(DPX_SOURCE)" != ""
1204 DPX_SOURCE_FILE = $(SOURCE_DIR)\$(DPX_SOURCE)
1207 !IF "$(DPX_SOURCE_OVERRIDE)" != ""
1208 DPX_SOURCE_FILE = $(DPX_SOURCE_OVERRIDE)
1211 !IF "$(DPX_SOURCE_FILE)" != ""
1212 !IF EXIST ($(DPX_SOURCE_FILE))
1214 # Add dependency check for dxs file, because dxs file depends on PPI or
1215 # PROTOCOL guid defintions.
1217 DEP_FILE = $(DEST_DIR)\$(BASE_NAME)dxs.dep
1219 !IF EXIST($(TARGET_DPX))
1220 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(BASE_NAME)dxs.dep
1221 !IF !EXIST($(DEP_FILE))
1226 !IF EXIST($(DEP_FILE))
1227 !INCLUDE $(DEP_FILE)
1230 # Update dep file for next round incremental build
1232 $(DEP_FILE) : $(TARGET_DPX)
1233 $(MAKEDEPS) -f $(DPX_SOURCE_FILE) $(DEP_FLAGS)
1235 $(TARGET_DPX) : $(DPX_SOURCE_FILE) $(INF_FILENAME)
1236 $(CC) /nologo $(INC) $(VERSION_FLAGS) /EP $(DPX_SOURCE_FILE) > $*.tmp1
1237 $(GENDEPEX) -I $*.tmp1 -O $*.tmp2
1238 $(GENSECTION) -I $*.tmp2 -O $@ -S $(DEPEX_TYPE)
1242 !ERROR Dependency expression source file "$(DPX_SOURCE_FILE)" does not exist.
1246 echo. > $(TARGET_DPX)
1247 type $(TARGET_DPX) > $(TARGET_DPX)
1251 # Build a FFS file from the sections and package
1253 $(TARGET_FFS_FILE) : $(TARGET_PE32) $(TARGET_DPX) $(TARGET_UI) $(TARGET_VER) $(PACKAGE_FILENAME)
1254 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1256 all : $(TARGET_FFS_FILE)
1259 # Remove the generated temp and final files for this modules.
1262 !IF ("$(FILE_GUID)" != "")
1263 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1265 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1266 @del /q $(DEST_OUTPUT_DIRS)
1268 [=============================================================================]
1269 [Compile.Ia32.Bin|Bmp,Compile.x64.Bin|Bmp,Compile.Ipf.Bin|Bmp]
1271 # We simply copy the binary file from the source directory to the destination directory
1273 $(DEST_DIR)\$(BASE_NAME).bin : $(SOURCE_FILE_NAME)
1276 [=============================================================================]
1277 [Build.Ia32.BINARY|Legacy16|Logo,Build.Ipf.BINARY|Legacy16|Logo,Build.x64.BINARY|Legacy16|Logo]
1279 # Use GenFfsFile to convert it to an FFS file
1281 $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs : $(DEST_DIR)\$(BASE_NAME).bin $(PACKAGE_FILENAME)
1282 $(GENSECTION) -I $(DEST_DIR)\$(BASE_NAME).bin -O $(DEST_DIR)\$(BASE_NAME).sec -S EFI_SECTION_RAW
1283 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1285 all : $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs
1288 # Remove the generated temp and final files for this modules.
1291 !IF ("$(FILE_GUID)" != "")
1292 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1294 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1295 @del /q $(DEST_OUTPUT_DIRS)
1297 [=============================================================================]
1298 [Build.Ia32.RAWFILE|CONFIG,Build.Ipf.RAWFILE|CONFIG,Build.x64.RAWFILE|CONFIG]
1300 # Use GenFfsFile to convert it to an raw FFS file
1302 $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).raw : $(DEST_DIR)\$(BASE_NAME).bin $(PACKAGE_FILENAME)
1303 $(GENFFSFILE) -B $(DEST_DIR) -P1 $(PACKAGE_FILENAME) -V
1305 all : $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).raw
1308 # Remove the generated temp and final files for this modules.
1311 !IF ("$(FILE_GUID)" != "")
1312 @if exist $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).* del $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).*
1314 @if exist $(BIN_DIR)\$(BASE_NAME).* del $(BIN_DIR)\$(BASE_NAME).*
1315 @del /q $(DEST_OUTPUT_DIRS)
1317 [=============================================================================]
1319 # These are commands to compile unicode .uni files.
1321 [=============================================================================]
1322 [Compile.Ia32.Uni,Compile.Ipf.Uni,Compile.Ebc.Uni,Compile.x64.Uni]
1324 # Emit an error message if the file's base name is the same as the
1325 # component base name. This causes build issues.
1327 !IF "$(FILE)" == "$(BASE_NAME)"
1328 !ERROR Component Unicode string file name cannot be the same as the component BASE_NAME.
1332 # Always create dep file for uni file as it can be created at the same time when
1333 # strgather is parsing uni file.
1335 DEP_FILE = $(DEST_DIR)\$(FILE)Uni.dep
1337 !IF EXIST($(DEP_FILE))
1338 !INCLUDE $(DEP_FILE)
1341 $(DEST_DIR)\$(FILE).sdb : $(SOURCE_FILE_NAME) $(INF_FILENAME)
1342 $(STRGATHER) -parse -newdb -db $(DEST_DIR)\$(FILE).sdb -dep $(DEP_FILE) $(INC) $(SOURCE_FILE_NAME)
1344 SDB_FILES = $(SDB_FILES) $(DEST_DIR)\$(FILE).sdb
1345 STRGATHER_FLAGS = $(STRGATHER_FLAGS) -db $(DEST_DIR)\$(FILE).sdb
1348 [=============================================================================]
1349 [Compile.Ia32.Vfr,Compile.Ipf.Vfr,Compile.x64.Vfr]
1351 DEP_FILE = $(DEST_DIR)\$(FILE)Vfr.dep
1353 !IF EXIST($(DEST_DIR)\$(FILE).obj)
1354 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Vfr.dep
1355 !IF !EXIST($(DEP_FILE))
1360 !IF EXIST($(DEP_FILE))
1361 !INCLUDE $(DEP_FILE)
1365 # Update dep file for next round incremental build
1367 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
1368 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
1370 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1373 # Add a dummy command for building the HII pack file. In reality, it's built
1374 # below, but the C_FLAGS macro reference the target as $@, so you can't specify
1375 # the obj and hpk files as dual targets of the same command.
1377 $(DEST_DIR)\$(FILE).hpk : $(DEST_DIR)\$(FILE).obj
1379 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
1380 $(VFRCOMPILE) $(VFRCOMPILE_FLAGS) $(INC) -ibin -od $(DEST_DIR)\$(SOURCE_RELATIVE_PATH) \
1381 -l $(VFR_FLAGS) $(SOURCE_FILE_NAME)
1382 $(CC) $(C_FLAGS) $(DEST_DIR)\$(FILE).c
1384 [=============================================================================]
1387 DEP_FILE = $(DEST_DIR)\$(FILE)Vfr.dep
1389 !IF EXIST($(DEST_DIR)\$(FILE).obj)
1390 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Vfr.dep
1391 !IF !EXIST($(DEP_FILE))
1396 !IF EXIST($(DEP_FILE))
1397 !INCLUDE $(DEP_FILE)
1401 # Update dep file for next round incremental build
1403 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
1404 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
1406 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1409 # Add a dummy command for building the HII pack file. In reality, it's built
1410 # below, but the C_FLAGS macro reference the target as $@, so you can't specify
1411 # the obj and hpk files as dual targets of the same command.
1413 $(DEST_DIR)\$(FILE).hpk : $(DEST_DIR)\$(FILE).obj
1415 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
1416 $(VFRCOMPILE) $(VFRCOMPILE_FLAGS) $(INC) -ibin -od $(DEST_DIR)\$(SOURCE_RELATIVE_PATH) \
1417 -l $(VFR_FLAGS) $(SOURCE_FILE_NAME)
1418 $(EBC_CC) $(EBC_C_FLAGS) $(DEST_DIR)\$(FILE).c
1420 [=============================================================================]
1422 # Commands for building IFR as uncompressed binary into the FFS file. To
1423 # use it, set COMPILE_SELECT=.vfr=Ifr_Bin for the component in the DSC file.
1425 [=============================================================================]
1426 [Compile.Ia32.Ifr_Bin,Compile.Ipf.Ifr_Bin,Compile.x64.Ifr_Bin]
1428 DEP_FILE = $(DEST_DIR)\$(FILE)Vfr.dep
1430 !IF EXIST($(DEST_DIR)\$(FILE).obj)
1431 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Vfr.dep
1432 !IF !EXIST($(DEP_FILE))
1437 !IF EXIST($(DEP_FILE))
1438 !INCLUDE $(DEP_FILE)
1442 # Update dep file for next round incremental build
1444 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
1445 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
1447 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1450 # Add a dummy command for building the HII pack file. In reality, it's built
1451 # below, but the C_FLAGS macro reference the target as $@, so you can't specify
1452 # the obj and hpk files as dual targets of the same command.
1454 $(DEST_DIR)\$(FILE).hpk : $(DEST_DIR)\$(FILE).obj
1456 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
1457 $(VFRCOMPILE) $(VFRCOMPILE_FLAGS) $(INC) -ibin -od $(DEST_DIR)\$(SOURCE_RELATIVE_PATH) \
1458 -l $(VFR_FLAGS) $(SOURCE_FILE_NAME)
1459 $(CC) $(C_FLAGS) $(DEST_DIR)\$(FILE).c
1462 # Add to the variable that contains the list of VFR binary files we're going
1463 # to merge together at the end of the build.
1465 HII_IFR_PACK_FILES = $(HII_IFR_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1467 [=============================================================================]
1469 # Commands for building IFR as uncompressed binary into the FFS file. To
1470 # use it, set COMPILE_SELECT=.vfr=Ifr_Bin for the component in the DSC file.
1472 [=============================================================================]
1473 [Compile.Ebc.Ifr_Bin]
1475 DEP_FILE = $(DEST_DIR)\$(FILE)Vfr.dep
1477 !IF EXIST($(DEST_DIR)\$(FILE).obj)
1478 DEP_TARGETS = $(DEP_TARGETS) $(DEST_DIR)\$(FILE)Vfr.dep
1479 !IF !EXIST($(DEP_FILE))
1484 !IF EXIST($(DEP_FILE))
1485 !INCLUDE $(DEP_FILE)
1489 # Update dep file for next round incremental build
1491 $(DEP_FILE) : $(DEST_DIR)\$(FILE).obj
1492 $(MAKEDEPS) -f $(SOURCE_FILE_NAME) $(DEP_FLAGS)
1494 HII_PACK_FILES = $(HII_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1497 # Add a dummy command for building the HII pack file. In reality, it's built
1498 # below, but the C_FLAGS macro reference the target as $@, so you can't specify
1499 # the obj and hpk files as dual targets of the same command.
1501 $(DEST_DIR)\$(FILE).hpk : $(DEST_DIR)\$(FILE).obj
1503 $(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INF_FILENAME) $(ALL_DEPS)
1504 $(VFRCOMPILE) $(VFRCOMPILE_FLAGS) $(INC) -ibin -od $(DEST_DIR)\$(SOURCE_RELATIVE_PATH) \
1505 -l $(VFR_FLAGS) $(SOURCE_FILE_NAME)
1506 $(EBC_CC) $(EBC_C_FLAGS) $(DEST_DIR)\$(FILE).c
1509 # Add to the variable that contains the list of VFR binary files we're going
1510 # to merge together at the end of the build.
1512 HII_IFR_PACK_FILES = $(HII_IFR_PACK_FILES) $(DEST_DIR)\$(FILE).hpk
1514 [=============================================================================]
1515 [Compile.Ia32.Fv,Compile.Ipf.Fv,Compile.x64.Fv]
1517 # Run GenSection on the firmware volume image.
1519 $(DEST_DIR)\$(SOURCE_FV)Fv.sec : $(SOURCE_FILE_NAME)
1520 $(GENSECTION) -I $(SOURCE_FILE_NAME) -O $(DEST_DIR)\$(SOURCE_FV)Fv.sec -S EFI_SECTION_FIRMWARE_VOLUME_IMAGE
1522 [=============================================================================]