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