summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Sample/CommonTools.env
blob: 567e746c83bdabb538999f84d8be5b37bec79c9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
#/*++
#  
#  Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
#  This program and the accompanying materials                          
#  are licensed and made available under the terms and conditions of the BSD License         
#  which accompanies this distribution.  The full text of the license may be found at        
#  http://opensource.org/licenses/bsd-license.php                                            
#                                                                                            
#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
#  
#  Module Name:
#  
#    CommonTools.env 
#  
#  Abstract:
#  
#    This file should not need to be customized. Customizations should
#    be done in LocalTools.env if at all possible.
#
#    This file can be included by other makefiles. 
#   
#    It defines variables used by the different toolchains. It first includes
#    the user-customized LocalTools.env, and then uses those defines to 
#    define other variables.
#
#    It basically has sections for different toolchains which define variables
#    used to build.
#   
#--*/

#
# Everything depends on EDK_SOURCE. Make sure it's defined
#
!IFNDEF EDK_SOURCE
!ERROR EDK_SOURCE environmental variable not set 
!ENDIF

#
# Tools depend on BUILD_DIR. Make sure it's defined
#
!IFNDEF BUILD_DIR
!ERROR BUILD_DIR environmental variable not set.  Should be set in PlatformTools.env
!ENDIF

#
# This include file gets customized by the developer. Get the customizations.
#
!INCLUDE $(EDK_SOURCE)\Sample\LocalTools.env

################################################################################
#
# Define paths for EFI build tools
#
################################################################################
!IFNDEF EDK_TOOLS_PATH
EDK_TOOLS_BIN     = $(EDK_SOURCE)\Tools\Bin
!ELSE
EDK_TOOLS_BIN     = $(EDK_TOOLS_PATH)\Bin
!ENDIF
EDK_TOOLS_DIR     = $(EDK_SOURCE)\Sample\Tools
EDK_TOOLS_SOURCE  = $(EDK_TOOLS_DIR)\Source
EDK_TOOLS_COMMON  = $(EDK_TOOLS_DIR)\Source\Common
EDK_TOOLS_OUTPUT  = $(BUILD_DIR)\Tools
PCCTS_DIR         = $(EDK_SOURCE)\Other\Maintained\Tools\Pccts

#
# This include file gets some version info.
#
!INCLUDE $(EDK_SOURCE)\Sample\Version.env

#
# Macros to define the build tools
#
ANTLR           = $(PCCTS_DIR)\bin\antlr
DLG             = $(PCCTS_DIR)\bin\dlg
EXE2BIN         = $(EDK_TOOLS_OUTPUT)\Strip
FWIMAGE         = $(EDK_TOOLS_OUTPUT)\FwImage
GENDEPEX        = $(EDK_TOOLS_OUTPUT)\GenDepex
GENFDIMAGE      = $(EDK_TOOLS_OUTPUT)\GenFdImage
GENFFSFILE      = $(EDK_TOOLS_OUTPUT)\GenFfsFile
GENFVIMAGE      = $(EDK_TOOLS_OUTPUT)\GenFvImage
GENSECTION      = $(EDK_TOOLS_OUTPUT)\GenSection
GENTEIMAGE      = $(EDK_TOOLS_OUTPUT)\GenTEImage
GUIDCHK         = $(EDK_TOOLS_OUTPUT)\GuidChk
HIIPACK         = $(EDK_TOOLS_OUTPUT)\HiiPack
MAKEDEPS        = $(EDK_TOOLS_OUTPUT)\MakeDeps
PROCESSDSC      = $(EDK_TOOLS_OUTPUT)\ProcessDsc
STRGATHER       = $(EDK_TOOLS_OUTPUT)\StrGather
SETSTAMP        = $(EDK_TOOLS_OUTPUT)\SetStamp
VFRCOMPILE      = $(EDK_TOOLS_OUTPUT)\VfrCompile
GENAPRIORI      = $(EDK_TOOLS_OUTPUT)\GenAprioriFile
MODIFYINF       = $(EDK_TOOLS_OUTPUT)\ModifyInf

MAKE            = nmake -nologo

#
# Everything else requires that TOOLCHAIN be defined. This should be defined
# by the calling makefile. 
#
!IFNDEF TOOLCHAIN
!ERROR TOOLCHAIN not defined for $(EDK_SOURCE)\Sample\CommonTools.env
!ENDIF

###############################################################################
#
# Specify the path and macros for ASL tools
#
###############################################################################
!IF "$(EFI_ASL_LOCAL)" == "YES"
ASL               = $(ASLPATH)\Iasl
!ELSE
ASL               = $(EDK_TOOLS_BIN)\Iasl
!ENDIF

ASL_FLAGS         =
C_FLAGS_ASL       = /nologo /EP /C

###############################################################################
#
# Specify the path and macros for IA32 tools
#
###############################################################################

!IF "$(TOOLCHAIN)" == "TOOLCHAIN_IA32"

#
# Globally relevant flags. Options not appropriate for all builds may be 
# appropriate in the processor architecture specific macros (xxx_ARCH_FLAGS) or
# in the platform specific macros (xxx_PROJ_FLAGS)
#
C_STD_INCLUDE       = /X

!IF "$(EFI_GENERATE_INTERMEDIATE_FILE)" == "YES"

!IF "$(USE_VC8)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHs-c- /GR- /Gy /GS- /D USE_VC8 /c /Fa$* /FAsc /Fo$@ /FR$(@R).SBR $(INC)
!ELSE
C_STD_FLAGS         = /nologo /W4 /WX /GX- /GR- /Gy /c /Fa$* /FAsc /Fo$@ /FR$(@R).SBR $(INC)
!ENDIF
ASM_STD_FLAGS       = /nologo /Fl$*.lst $(INC)

!ELSE

!IF "$(USE_VC8)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHs-c- /GR- /Gy /GS- /D USE_VC8 /c /Fo$@ $(INC)
!ELSE
C_STD_FLAGS         = /nologo /W4 /WX /GX- /GR- /Gy /c /Fo$@ $(INC)
!ENDIF
ASM_STD_FLAGS       = /nologo $(INC) 

!ENDIF

LINK_STD_FLAGS      = /nologo /SUBSYSTEM:CONSOLE /NODEFAULTLIB /MAP /OPT:REF /BASE:0 /IGNORE:4001,4078,4086,4096,4108 $(BUILD_DIR)\IA32\CompilerStub.lib
LIB_STD_FLAGS       = /nologo 

#
# Build type specific flags.  Globally relevant flags belong in the standard 
# macros, xxx_STD_FLAGS defined above.  Platform specific macros belong in the
# PlatformTools.env file in macros named xxx_PROJ_FLAGS.
#
C_ARCH_FLAGS          = /D EFI32
ASM_ARCH_FLAGS        = /W3 /WX /c /coff /Fo$@ /DEFI32
LINK_ARCH_FLAGS       = /MACHINE:I386
LIB_ARCH_FLAGS        =

ASM16_FLAGS           = /nologo /c /omf /Fo$@
ASMLINK16_FLAGS       =

#
# Build tools
#
CC                = cl
LINK              = link
LIB               = lib
#
# When using VS ml to compile 16bit code, please add /omf compiler option 
#
ASM               = ml

!IF "$(EFI_ASSEMBLER_NAME)" == ""
ASM16             = $(MASMPATH)\bin\ml
ASMLINK16         = $(MASMPATH)\binr\link
ASMLINK           = $(MASMPATH)\binr\link
!ELSE
ASM16             = $(EDK_TOOLS_BIN)\Ia32\$(EFI_ASSEMBLER_NAME)\bin\ml
ASMLINK16         = $(EDK_TOOLS_BIN)\Ia32\$(EFI_ASSEMBLER_NAME)\binr\link
ASMLINK           = $(EDK_TOOLS_BIN)\Ia32\$(EFI_ASSEMBLER_NAME)\binr\link
!ENDIF

BSCMAKE           = bscmake
RC                = rc

!IF "$(EFI_SYMBOLIC_DEBUG)" == "YES"
ASM_ARCH_FLAGS      = $(ASM_ARCH_FLAGS) /Zi /DDEBUG
C_STD_FLAGS         = $(C_STD_FLAGS) /Zi /Gm /Fd$(DEST_DIR)\$(BASE_NAME)Obj
LINK_STD_FLAGS      = $(LINK_STD_FLAGS) /DEBUG
!ENDIF

# END OF TOOLCHAIN_IA32
###############################################################################

###############################################################################
#
# Specify the path and macros for the X64 (also called x86-64, EM64T, AMD64) tools
#
###############################################################################

!ELSEIF "$(TOOLCHAIN)" == "TOOLCHAIN_X64"

#
# Globally relevant flags. Options not appropriate for all builds may be 
# appropriate in the processor architecture specific macros (xxx_ARCH_FLAGS) or
# in the platform specific macros (xxx_PROJ_FLAGS)
#
C_STD_INCLUDE       = /X
!IF "$(EFI_GENERATE_INTERMEDIATE_FILE)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHs-c- /GR- /Gy /c /GS- /Fa$* /FAsc /Fo$@ /FR$(@R).SBR $(INC) 
ASM_STD_FLAGS       = /nologo /Fl$*.lst $(INC)
!ELSE
C_STD_FLAGS         = /nologo /W4 /WX /EHs-c- /GR- /Gy /c /GS- /Fo$@ $(INC) 
ASM_STD_FLAGS       = /nologo $(INC)
!ENDIF
LINK_STD_FLAGS      = /nologo /SUBSYSTEM:CONSOLE /NODEFAULTLIB /MAP /OPT:REF /BASE:0 /IGNORE:4001,4078,4086,4096,4108 $(BUILD_DIR)\X64\CompilerStub.lib
LIB_STD_FLAGS       = /nologo 

#
# Build type specific flags.  Globally relevant flags belong in the standard 
# macros, xxx_STD_FLAGS defined above.  Platform specific macros belong in the
# PlatformTools.env file in macros named xxx_PROJ_FLAGS.
#
C_ARCH_FLAGS          = /D EFIX64
ASM_ARCH_FLAGS        = /W3 /WX /c /Fo$@ /DEFIX64
LINK_ARCH_FLAGS       = /Machine:AMD64
LIB_ARCH_FLAGS        =

ASM16_FLAGS           = /nologo /c /omf /Fo$@
ASMLINK16_FLAGS       =

#
# Build tools
#
!IF "$(EFI_COMPILER_X64_NAME)" == ""
!IF "$(USE_VC8_X64)" == "YES"
#
# Use VC8 as X64 compiler
#
CC                = "$(VC8_X64_PATH)\cl"
LINK              = "$(VC8_X64_PATH)\link"
LIB               = "$(VC8_X64_PATH)\lib"
ASM               = "$(VC8_X64_PATH)\ml64"
!ELSE
#
# Use DDK as X64 compiler
#
CC                = $(WIN_DDK_X64_PATH)\cl
LINK              = $(WIN_DDK_X64_PATH)\link
LIB               = $(WIN_DDK_X64_PATH)\lib
ASM               = $(WIN_DDK_X64_PATH)\ml64
!ENDIF
!ELSE
CC                = $(EDK_TOOLS_BIN)\X64\$(EFI_COMPILER_X64_NAME)\cl
LINK              = $(EDK_TOOLS_BIN)\X64\$(EFI_COMPILER_X64_NAME)\link
LIB               = $(EDK_TOOLS_BIN)\X64\$(EFI_COMPILER_X64_NAME)\lib
ASM               = $(EDK_TOOLS_BIN)\X64\$(EFI_COMPILER_X64_NAME)\ml64
!ENDIF

!IF "$(EFI_ASSEMBLER_NAME)" == ""
ASM16             = $(MASMPATH)\bin\ml
ASMLINK16         = $(MASMPATH)\binr\link
ASMLINK           = $(MASMPATH)\binr\link
!ELSE
ASM16             = $(EDK_TOOLS_BIN)\Ia32\$(EFI_ASSEMBLER_NAME)\bin\ml
ASMLINK16         = $(EDK_TOOLS_BIN)\Ia32\$(EFI_ASSEMBLER_NAME)\binr\link
ASMLINK           = $(EDK_TOOLS_BIN)\Ia32\$(EFI_ASSEMBLER_NAME)\binr\link
!ENDIF

BSCMAKE           = bscmake
RC                = rc

!IF "$(EFI_SYMBOLIC_DEBUG)" == "YES"
ASM_ARCH_FLAGS      = $(ASM_ARCH_FLAGS) /Zi /DDEBUG
C_STD_FLAGS         = $(C_STD_FLAGS) /Zi /Gm /Fd$(DEST_DIR)\$(BASE_NAME)Obj
LINK_STD_FLAGS      = $(LINK_STD_FLAGS) /DEBUG
!ENDIF

# END OF TOOLCHAIN_X64
###############################################################################

###############################################################################
#
# Specify the path and macros for the IPF tools
#
###############################################################################

!ELSEIF "$(TOOLCHAIN)" == "TOOLCHAIN_IPF"

#
# Globally relevant flags. Options not appropriate for all builds may be 
# appropriate in the processor architecture specific macros (xxx_ARCH_FLAGS) or
# in the platform specific macros (xxx_PROJ_FLAGS)
#
C_STD_INCLUDE       = /X

!IF "$(EFI_GENERATE_INTERMEDIATE_FILE)" == "YES"

!IF "$(USE_VC8_IPF)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHs-c- /GR- /Gy /GS- /c /Fa$* /FAsc /Fo$@ /FR$(@R).SBR $(INC)
!ELSE
!IF "$(USE_NEWDDK)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHs-c- /GR- /Gy /GS- /c /Fa$* /FAsc /Fo$@ /FR$(@R).SBR $(INC)
!ELSE
C_STD_FLAGS         = /nologo /W4 /WX /GX- /GR- /Gy /c /Fa$* /FAsc /Fo$@ /FR$(@R).SBR $(INC)
!ENDIF
!ENDIF

!ELSE

!IF "$(USE_VC8_IPF)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHs-c- /GR- /Gy /GS- /c /Fo$@ $(INC)
!ELSE
!IF "$(USE_NEWDDK)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHs-c- /GR- /Gy /GS- /c /Fo$@ $(INC)
!ELSE
C_STD_FLAGS         = /nologo /W4 /WX /GX- /GR- /Gy /c /Fo$@ $(INC)
!ENDIF
!ENDIF

!ENDIF

ASM_STD_FLAGS       = $(INC) 
LINK_STD_FLAGS      = /nologo /SUBSYSTEM:CONSOLE /NODEFAULTLIB /MAP /OPT:REF /BASE:0 /IGNORE:4001,4078,4086,4096,4108
LIB_STD_FLAGS       = /nologo 

#
# Build type specific flags.  Globally relevant flags belong in the standard 
# macros, xxx_STD_FLAGS defined above.  Platform specific macros belong in the
# PlatformTools.env file in macros named xxx_PROJ_FLAGS.
#
C_ARCH_FLAGS          = /D EFI64
ASM_ARCH_FLAGS        = -N us -X explicit -M ilp64 -N so -W4 -o $@
LINK_ARCH_FLAGS       = /MACHINE:IA64
LIB_ARCH_FLAGS        =

#
# This is used for preprocessing IPF Assembly files
#
C_FLAGS_PRO       = /nologo /EP /C $(C_STD_FLAGS) $(C_ARCH_FLAGS) $(C_PROJ_FLAGS) $(C_STD_INCLUDE)

!IF "$(EFI_DEBUG)" == "YES"
ASM_ARCH_FLAGS   = $(ASM_ARCH_FLAGS) -d debug
!ENDIF

#
# Build tools
#
!IF "$(EFI_COMPILER_NAME)" == ""
!IF "$(USE_VC8_IPF)" == "YES"
CC                = "$(VC8_IPF_PATH)\cl"
LINK              = "$(VC8_IPF_PATH)\link"
LIB               = "$(VC8_IPF_PATH)\lib"
!ELSE
CC                = $(EFI_IA64TOOLPATH)\cl
LINK              = $(EFI_IA64TOOLPATH)\link
LIB               = $(EFI_IA64TOOLPATH)\lib
!ENDIF
!ELSE
CC                = $(EDK_TOOLS_BIN)\Ipf\$(EFI_COMPILER_NAME)\cl
LINK              = $(EDK_TOOLS_BIN)\Ipf\$(EFI_COMPILER_NAME)\link
LIB               = $(EDK_TOOLS_BIN)\Ipf\$(EFI_COMPILER_NAME)\lib
!ENDIF

!IF "$(EFI_ASSEMBLER_NAME)" == ""
!IF "$(USE_VC8_IPF)" == "YES"
ASM               = "$(VC8_IPF_PATH)\ias"
ASMLINK           = "$(VC8_IPF_PATH)\link"
!ELSE
ASM               = $(EFI_IA64ASMPATH)\ias
ASMLINK           = $(EFI_IA64ASMPATH)\link
!ENDIF
!ELSE
ASM               = $(EDK_TOOLS_BIN)\Ipf\$(EFI_ASSEMBLER_NAME)\ias
ASMLINK           = $(EDK_TOOLS_BIN)\Ipf\$(EFI_ASSEMBLER_NAME)\link
!ENDIF

BSCMAKE           = bscmake
RC                = rc

!IF "$(EFI_SYMBOLIC_DEBUG)" == "YES"
C_STD_FLAGS         = $(C_STD_FLAGS) /Zi /Gm /Fd$(DEST_DIR)\$(BASE_NAME)Obj
LINK_STD_FLAGS      = $(LINK_STD_FLAGS) /DEBUG
!ENDIF

# END TOOLCHAIN_IPF
###############################################################################

###############################################################################
#
# Define toolchain for building the EFI tools on an IA32 system.
#
###############################################################################

!ELSEIF "$(TOOLCHAIN)" == "TOOLCHAIN_MSVC"

#
# Globally relevant flags. Options not appropriate for all builds may be 
# appropriate in the processor architecture specific macros (xxx_ARCH_FLAGS) or
# in the platform specific macros (xxx_PROJ_FLAGS)
#
!IF "$(EFI_GENERATE_INTERMEDIATE_FILE)" == "YES"

!IF "$(USE_VC8)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHsc /Gy /D _CRT_SECURE_NO_DEPRECATE /D USE_VC8 /c /Fa$* /FAsc /Fo$@ /FR$(@R).SBR $(INC)
!ELSE
C_STD_FLAGS         = /nologo /W4 /WX /GX /Gy /c /Fa$* /FAsc /Fo$@ /FR$(@R).SBR $(INC)
!ENDIF
ASM_STD_FLAGS       = /nologo /Fl$*.lst $(INC)

!ELSE

!IF "$(USE_VC8)" == "YES"
C_STD_FLAGS         = /nologo /W4 /WX /EHsc /Gy /D _CRT_SECURE_NO_DEPRECATE /D USE_VC8 /c /Fo$@ $(INC)
!ELSE
C_STD_FLAGS         = /nologo /W4 /WX /GX /Gy /c /Fo$@ $(INC)
!ENDIF
ASM_STD_FLAGS       = /nologo $(INC)

!ENDIF

LINK_STD_FLAGS      = /nologo /SUBSYSTEM:CONSOLE /NODEFAULTLIB /MAP /OPT:REF
LIB_STD_FLAGS       = /nologo 

MSVS_LINK_LIBPATHS = 

#
# Build type specific flags.  Globally relevant flags belong in the standard 
# macros, xxx_STD_FLAGS defined above.  Platform specific macros belong in the
# PlatformTools.env file in macros named xxx_PROJ_FLAGS.
#

#
# Add a define to skip inclusion of Microsoft include file rpcasync.h, which
# results in a compile warning at W4.
#
C_ARCH_FLAGS          = /Od /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D __RPCASYNC_H__ 
ASM_ARCH_FLAGS        =
LINK_ARCH_FLAGS       = /MACHINE:i386
LIB_ARCH_FLAGS        =

#
# Always turn on debug for the build tools so that we can debug problems 
# quickly.
# NOTE: Ideally all the tools makefiles should be updated to use LINK_FLAGS_EXE
#       instead of L_FLAGS for linking. When this happens we can get rid of
#       the L_FLAGS definition here.
#

#!IF "$(EFI_SYMBOLIC_DEBUG)" == "YES"
C_STD_FLAGS       = $(C_STD_FLAGS) /Zi /Gm /Fd$(EDK_TOOLS_OUTPUT)\$(TARGET_NAME)Obj
LINK_ARCH_FLAGS   = $(LINK_ARCH_FLAGS) /DEBUG
L_FLAGS           = $(L_FLAGS) /DEBUG
#!ENDIF

#
# Clear any project flags when building tools
#
C_PROJ_FLAGS          =
ASM_PROJ_FLAGS        =
LINK_PROJ_FLAGS       =
LIB_PROJ_FLAGS        =
EBC_C_PROJ_FLAGS      =
EBC_LINK_PROJ_FLAGS   =
EBC_LIB_PROJ_FLAGS    =

#
# Build tools
#
CC                = cl
LINK              = link
BSCMAKE           = bscmake
ASM               = ml
ASMLINK           = link
#
# Use a different macro name for tools build to avoid conflict with environment
# variable LIB
#
LIB_EXE           = lib

INC = -I $(EDK_SOURCE)\Foundation                          \
      -I $(EDK_SOURCE)\Foundation\Efi                      \
      -I $(EDK_SOURCE)\Foundation\Framework                \
      -I $(EDK_SOURCE)\Sample\Platform\Nt32                \
      -I $(EDK_SOURCE)\Foundation\Core\Dxe                 \
      -I $(EDK_SOURCE)\Foundation\Include                  \
      -I $(EDK_SOURCE)\Foundation\Efi\Include              \
      -I $(EDK_SOURCE)\Foundation\Framework\Include        \
      -I $(EDK_SOURCE)\Foundation\Include\IndustryStandard \
      -I $(EDK_SOURCE)\Foundation\Include\Ia32             \
      -I $(EDK_SOURCE)\Foundation\Include\Pei              \
      -I $(EDK_SOURCE)\Foundation\Library\Pei\Include      \
      -I $(EDK_SOURCE)\Sample\Include                      \
      -I "$(EDK_TOOLS_COMMON)"

# END TOOLCHAIN_MSVC
###############################################################################

###############################################################################
#
# Specify the path and macros for the EBC tools
#
###############################################################################

!ELSEIF "$(TOOLCHAIN)" == "TOOLCHAIN_EBC"

!IF "$(EFI_GENERATE_INTERMEDIATE_FILE)" == "YES"
EBC_C_STD_FLAGS     = /nologo /W3 /WX /c /Fa$* /FAsc /Fo$@ $(INC) /X
!ELSE
EBC_C_STD_FLAGS     = /nologo /W3 /WX /c /Fo$@ $(INC) /X
!ENDIF

#
# All EBC entry point functions must be called EfiMain. Redefine it.
#
!IF "$(IMAGE_ENTRY_POINT)" == ""
IMAGE_ENTRY_POINT   = EfiMain
!ENDIF
EBC_C_STD_FLAGS     = $(EBC_C_STD_FLAGS) /D $(IMAGE_ENTRY_POINT)=EfiMain
EBC_LINK_STD_FLAGS  = /nologo /MACHINE:EBC /BASE:0 /OPT:REF /NODEFAULTLIB
EBC_LIB_STD_FLAGS   = /nologo /MACHINE:EBC 

#
# EBC tools path should be defined in LocalTools.env.
#
EBC_CC            = $(EBC_TOOLS_PATH)\Bin\Iec
EBC_LINK          = $(EBC_TOOLS_PATH)\Bin\Link
EBC_LIB           = $(EBC_TOOLS_PATH)\Bin\Link /lib

RC                = rc

!IF "$(EFI_SYMBOLIC_DEBUG)" == "YES"
EBC_C_STD_FLAGS     = $(EBC_C_STD_FLAGS) /Zi
EBC_LINK_STD_FLAGS  = $(EBC_LINK_STD_FLAGS) /DEBUG
!ENDIF

#  END TOOLCHAIN_EBC

###############################################################################
#
# Let the caller define a NULL toolchain if they don't care. This way you can
# pick up at least some defines.
#
###############################################################################

!ELSEIF "$(TOOLCHAIN)" == ""

###############################################################################
#
# You get this if the calling makefile did not define TOOLCHAIN_xxx before
# including this file.
#
###############################################################################

!ELSE
!ERROR Unknown toolchain $(TOOLCHAIN) defined for $(EDK_SOURCE)\Sample\CommonTools.env use
!ENDIF


###############################################################################
#
# These are standard settings for all tool chains
#
###############################################################################

#
# These are standard build options
#
VERSION_FLAGS       = /D EFI_SPECIFICATION_VERSION=$(EFI_SPECIFICATION_VERSION) \
                      /D PI_SPECIFICATION_VERSION=$(PI_SPECIFICATION_VERSION) \
                      /D TIANO_RELEASE_VERSION=$(TIANO_RELEASE_VERSION)
C_STD_FLAGS         = $(C_STD_FLAGS) $(VERSION_FLAGS)
EBC_C_STD_FLAGS     = $(EBC_C_STD_FLAGS) $(VERSION_FLAGS)
C_FLAGS_ASL         = $(C_FLAGS_ASL) $(VERSION_FLAGS)
VFRCOMPILE_FLAGS    = $(VFRCOMPILE_FLAGS) -ppflag "$(VERSION_FLAGS)"
!IF "$(TOOLCHAIN)" != "TOOLCHAIN_IPF"
ASM_STD_FLAGS       = $(ASM_STD_FLAGS) $(VERSION_FLAGS)
!ENDIF

!IF "$(TOOLCHAIN)" != "TOOLCHAIN_MSVC"
BUILD_STRING_FLAGS       = /D EFI_BUILD_VERSION="L\"$(EDK_BUILD_VERSION)\"" /D EFI_FIRMWARE_VENDOR="L\"TianoCore.org\""
!ELSE
BUILD_STRING_FLAGS       = /D UTILITY_BUILD="\"$(EDK_BUILD_VERSION)\"" /D UTILITY_VENDOR="\"TianoCore.org\""
!ENDIF

C_STD_FLAGS         = $(C_STD_FLAGS) $(BUILD_STRING_FLAGS)
EBC_C_STD_FLAGS     = $(EBC_C_STD_FLAGS) $(BUILD_STRING_FLAGS)

!IF "$(EFI_DEBUG)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_DEBUG
!ENDIF

!IF "$(EFI_DEBUG_CLEAR_MEMORY)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_DEBUG_CLEAR_MEMORY
!ENDIF

!IF "$(EFI_PEI_PERFORMANCE)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_PEI_PERFORMANCE /D EFI_DXE_PERFORMANCE
!ENDIF

!IF "$(EFI_ADDTIONAL_DRIVERS)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_ADDTIONAL_DRIVERS
!ENDIF

!IF "$(EFI_USE_CUSTOM_COMPRESS)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_USE_CUSTOM_COMPRESS
!ENDIF

!IF "$(EFI_UNLOCK_FWH)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_UNLOCK_FWH
!ENDIF

!IF "$(EFI_DXE_PERFORMANCE)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_DXE_PERFORMANCE
!ENDIF

!IF "$(EFI_S3_RESUME)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_S3_RESUME
!ENDIF

!IF "$(EFI_NO_CSM_SUPPORT)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_NO_CSM_SUPPORT
!ENDIF

!IF "$(EFI_SIZE_REDUCTION_APPLIED)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_SIZE_REDUCTION_APPLIED
!ENDIF

!IF "$(EFI_PEI_REPORT_STATUS_CODE)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D EFI_PEI_REPORT_STATUS_CODE_ON
!ENDIF

!IF "$(SIZE_REDUCTION_ISA_COMBINED)" == "YES"
FEATURE_FLAGS   = $(FEATURE_FLAGS) /D SIZE_REDUCTION_ISA_COMBINED
!ENDIF

C_STD_FLAGS       = $(C_STD_FLAGS) $(FEATURE_FLAGS)
EBC_C_STD_FLAGS   = $(EBC_C_STD_FLAGS) $(FEATURE_FLAGS)
C_FLAGS_ASL       = $(C_FLAGS_ASL) $(FEATURE_FLAGS)
VFRCOMPILE_FLAGS  = $(VFRCOMPILE_FLAGS) -ppflag "$(FEATURE_FLAGS)"
!IF "$(TOOLCHAIN)" != "TOOLCHAIN_IPF"
ASM_STD_FLAGS     = $(ASM_STD_FLAGS) $(FEATURE_FLAGS)
!ENDIF

#
# This is used for preprocessing dependency files
#
C_FLAGS_DPX       = /nologo /EP $(INC) $(VERSION_FLAGS) $(FEATURE_FLAGS)

###############################################################################

###############################################################################
#
# Collect final build flags for components.  These flags are used to build
# any standard component and some non-standard components.
#
###############################################################################
C_FLAGS           = $(C_STD_FLAGS) $(C_ARCH_FLAGS) $(C_PROJ_FLAGS) $(C_STD_INCLUDE)
ASM_FLAGS         = $(ASM_STD_FLAGS) $(ASM_ARCH_FLAGS) $(ASM_PROJ_FLAGS)
LINK_FLAGS_DLL    = $(LINK_STD_FLAGS) $(LINK_ARCH_FLAGS) $(LINK_PROJ_FLAGS) /DLL 
LINK_FLAGS_EXE    = $(LINK_STD_FLAGS) $(LINK_ARCH_FLAGS) $(LINK_PROJ_FLAGS) 
LIB_FLAGS         = $(LIB_STD_FLAGS) $(LIB_ARCH_FLAGS) $(LIB_PROJ_FLAGS)
EBC_C_FLAGS       = $(EBC_C_STD_FLAGS) $(EBC_C_ARCH_FLAGS) $(EBC_C_PROJ_FLAGS)
EBC_LINK_FLAGS    = $(EBC_LINK_STD_FLAGS) $(EBC_LINK_ARCH_FLAGS) $(EBC_LINK_PROJ_FLAGS)
EBC_LIB_FLAGS     = $(EBC_LIB_STD_FLAGS) $(EBC_LIB_ARCH_FLAGS) $(EBC_LIB_PROJ_FLAGS)

###############################################################################
#
# define X64 denpendant driver files
#
###############################################################################
!IF "$(EFI_BUILD_TARGET_X64)" == "YES"
BUILD_TARGET_PROCESSOR = X64
DXE_IPL                = DxeIplX64
!ELSE
BUILD_TARGET_PROCESSOR = IA32
DXE_IPL                = DxeIpl
!ENDIF                                                                                        
###############################################################################
#
# define EFI specification denpendant driver files
#
###############################################################################
!IF "$(UEFI_MODE)" == "YES"
UEFI_PREFIX = Uefi
ATAPI_PASS_THRU_INF = Sample\Bus\Pci\AtapiExtPassThru\Dxe\AtapiExtPassThru.inf
!IF "$(CAPSULE_INF)" == ""
CAPSULE_INF = Sample\Universal\Capsule\RuntimeDxe\Capsule.inf 
!ENDIF
DEVPATH_INF = Sample\Universal\DevicePath\Dxe\DevicePath.inf
!ELSE
UEFI_PREFIX =
CAPSULE_INF =
DEVPATH_INF =
ATAPI_PASS_THRU_INF = Sample\Bus\Pci\AtapiPassThru\Dxe\AtapiPassThru.inf
!ENDIF
###############################################################################
#
# define PIWG specification denpendant driver files
#
###############################################################################
!IF "$(PI_MODE)" == "YES"
PI_PREFIX = Pi
!ELSE
PI_PREFIX =
!ENDIF
###############################################################################
#
# define customized compress makefile
#
###############################################################################
CUSTOMIZEDCOMPRESS_MAKEFILE   = $(EDK_TOOLS_SOURCE)\CustomizedCompress\Makefile 
COMPRESS_METHOD               = Dummy                                                 
###############################################################################         
#                                                                                       
# define EFI_BINARY default path
#                                                                                       
###############################################################################  
!IFNDEF EFI_BINARY
EFI_BINARY=$(EDK_SOURCE)\Bin
!ENDIF

EFI_PLATFORM_BIN=$(EFI_BINARY)\$(PROJECT_NAME)$(BUILD_TARGET_DIRECTORY)