summaryrefslogtreecommitdiffstats
path: root/BaseTools/Conf/build_rule.template
blob: 3add1029f276aad462d7693fc0c0644418f3719a (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
#
#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#  Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
#  Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
#  SPDX-License-Identifier: BSD-2-Clause-Patent
#

## Syntax
#
# "*" is used to indicate that the source files will be processed at the same time.
# "?" is used to indicate that the source files will be processed one by one.
#
# "[" <File-Type>[.<Build-Type>][.<Arch>][, <File-Type>[.<Build-Type>][.<Arch>]] "]" <EOL>
#   <InputFile[.<ToolChainFamily>]> <EOL>
#       (?|*).<File-Extension> [(\n|,) (?|*).<File-Extension>]
#
#   <OutputFile[.<ToolChainFamily>]> <EOL>
#       <FileFullPath>
#
#   <ExtraDependency>
#       <FileFullPath>
#
#   <Command[.<ToolChainFamily>]> <EOL>
#       <Command1>
#       [<Command2>]
#
# <Build-Type> is the MODULE_TYPE in EDK2 or COMPONENT_TYPE  in EDK.
# Missing <InputFile> will cause an exception and break build.
# Missing <Command> will cause that related build target won't be generated but
#   won't break build.
#

## Placeholders for string substitution
#
#   ${src}      Source file(s) to be built (full path)
#   ${s_path}   Source file directory (absolute path)
#   ${s_dir}    Source file relative directory within a module
#               (Note: ${s_dir} is always equals to "." if source file is given in absolute path.)
#   ${s_name}   Source file name without path
#   ${s_base}   Source file name without extension and path
#   ${s_ext}    Source file extension
#
#   ${dst}      Destination file(s) built from ${src} (full path)
#   ${d_path}   Destination file directory (absolute path)
#   ${d_name}   Destination file name without path
#   ${d_base}   Destination file name without extension and path
#   ${d_ext}    Destination file extension
#
#   (+)         Directory separator
#

## Macro
#   $(WORKSPACE)        Workspace directory
#   $(OUTPUT_DIR)       Directory for intermediate files for building a module
#   $(DEBUG_DIR)        Directory for files used to debug a module
#   $(BUILD_DIR)        All files for building a platform will be put in this directory
#   $(BIN_DIR)          Common directory for executable files
#   $(FV_DIR)           Directory to store flash image files
#   $(INC)              Search path of current module
#   $(NASM_INC)         Search nasm file path of current module
#   $(INC_LIST)         A file containing search paths of current module
#   $(LIBS)             Static library files of current module
#   $(<tool>_FLAGS)     Tools flags of current module
#   $(MODULE_NAME)      Current module name
#   $(MODULE_NAME_GUID) Current module name with module FILE_GUID if same $(MODULE_NAME) exists
#                       in different modules, otherwise its value is same as $(MODULE_NAME)
#   $(MODULE_TYPE)      Current module type
#   $(MODULE_GUID)      Current module guid
#   $(ARCH)             Architecture of current module
#   $(TOOLCHAIN)        Toolchain used to build current module
#   $(TARGET)           Target of current module (DEBUG/RELEASE)
#   $(<tool>)           Path of tool
#   $(EDK_TOOLS_PATH)   Path of build tools
#   $(<FILE_TYPES>)     File list of each file type
#                       (Note: The macro name is derived from file type name. For example,
#                        C-Code-File will have C_CODE_FILES macro.)
#   $(<FILE_TYPES_LIST>) Macro point to a file containing list of files of a file type
#                       (
#                        Note: The macro and file name are derived from file type name.
#                        For example, C-Code-File will have C_CODE_FILES_LIST macro pointing
#                        to $(OUTPUT_DIR)/c_code_files.lst. The list file and macro name
#                        will be generated only when this macro is used in command line.
#                        This is intended to get over the long command line limitation.
#                       )
#   $(DEPS_FLAGS)        This is a tool flag to have c compiler generate dependent header file list for a source file.
#                        To enable incremental build, this flag must apply to $(CC), $(VFRPP), $(PP), $(ASLCC) and $(ASLPP).
#
#   $(CP)     copy command
#   $(MV)     move command
#   $(RM)     delete command
#   $(MD)     create dir command
#   $(RD)     remove dir command
#

## Reserved File-Type
#
# Don't change following names of file types and their associated files,
# which are also used in tools' code
#
#   C-Code-File
#   C-Header-File
#   Dynamic-Library-File
#   Static-Library-File
#   Visual-Form-Representation-File
#   Unicode-Text-File
#

## Build Rule Version Number
#  build_rule_version=0.1
#

[C-Code-File]
    <InputFile>
        ?.c
        ?.C
        ?.cc
        ?.CC
        ?.cpp
        ?.Cpp
        ?.CPP

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj

    <Command.MSFT, Command.INTEL>
        "$(CC)" /Fo${dst} $(DEPS_FLAGS) $(CC_FLAGS) $(INC) ${src}

    <Command.GCC, Command.RVCT>
        # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
        "$(CC)" $(DEPS_FLAGS) $(CC_FLAGS) -c -o ${dst} $(INC) ${src}

    <Command.XCODE>
        "$(CC)" $(DEPS_FLAGS) $(CC_FLAGS) -o ${dst} $(INC) ${src}

[C-Code-File.BASE.AARCH64,C-Code-File.SEC.AARCH64,C-Code-File.PEI_CORE.AARCH64,C-Code-File.PEIM.AARCH64,C-Code-File.BASE.ARM,C-Code-File.SEC.ARM,C-Code-File.PEI_CORE.ARM,C-Code-File.PEIM.ARM]
    <InputFile>
        ?.c

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj

    <Command.GCC, Command.RVCT>
        "$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -c -o ${dst} $(INC) ${src}

[C-Header-File]
    <InputFile>
        *.h, *.H

    <OutputFile>

    <Command>

[Assembly-Code-File.COMMON.COMMON]
    <InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
        ?.asm, ?.Asm, ?.ASM

    <InputFile.GCC>
        ?.S, ?.s

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj

    <Command.MSFT, Command.INTEL>
        Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
        Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
        "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iiii

    <Command.GCC, Command.RVCT>
        Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
        Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
        # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
        "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iiii

[Assembly-Code-File.COMMON.ARM,Assembly-Code-File.COMMON.AARCH64]
    # Remove --convert-hex for ARM as it breaks MSFT assemblers
    <InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
        ?.asm, ?.Asm, ?.ASM

    <InputFile.GCC>
        ?.S, ?.s

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj

    <Command.INTEL>
        Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
        Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
        "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iiii

    <Command.MSFT>
        Trim --asm-file  -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
        Trim --source-code --trim-long -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
        "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iiii

    <Command.GCC, Command.RVCT>
        Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
        Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iiii ${d_path}(+)${s_base}.ii
        # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
        "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iiii

[Nasm-Assembly-Code-File.COMMON.COMMON]
    <InputFile>
        ?.nasm

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj

    <Command>
        Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
        Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
        "$(NASM)" -I${s_path}(+) $(NASM_INC) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii

[Device-Tree-Source-File]
    <InputFile>
        ?.dts

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dtb

    <Command.GCC>
        "$(DTCPP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
        "$(DTC)" $(DTC_FLAGS) -I dts -O dtb -o ${dst} ${d_path}(+)${s_base}.i

[Visual-Form-Representation-File]
    <InputFile>
        ?.vfr
        ?.Vfr
        ?.VFR

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c

    <Command>
        "$(VFRPP)" $(DEPS_FLAGS) $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_base}.i
        "$(VFR)" $(VFR_FLAGS) --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_base}.i

[Object-File]
    <InputFile>
        *.obj
        *.o

    <OutputFile>
        $(OUTPUT_DIR)(+)$(MODULE_NAME).lib

    <Command.MSFT, Command.INTEL, Command.CLANGPDB>
        "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)

    <Command.GCC>
        $(RM) ${dst}
        "$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
    
    <Command.RVCT>
        "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
    
    <Command.RVCTCYGWIN>
        # $(OBJECT_FILES_LIST) has wrong paths for cygwin
        "$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES)

    <Command.XCODE>
        "$(SLINK)" $(SLINK_FLAGS) ${dst} -filelist $(OBJECT_FILES_LIST)

[Static-Library-File]
    <InputFile>
        *.lib

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(DEBUG_DIR)(+)$(MODULE_NAME).dll

    <Command.MSFT, Command.INTEL>
        "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK2_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
        "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

    <Command.CLANGPDB>
        "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)

    <Command.GCC>
        "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) $(DLINK2_FLAGS)
        "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}

    <Command.RVCT>
        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)

    <Command.RVCTCYGWIN>
        #$(STATIC_LIBRARY_FILES_LIST) has wrong paths for cygwin
        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)

    <Command.XCODE>
        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)
    
    
[Static-Library-File.SEC.AARCH64, Static-Library-File.PEI_CORE.AARCH64, Static-Library-File.PEIM.AARCH64,Static-Library-File.SEC.ARM, Static-Library-File.PEI_CORE.ARM, Static-Library-File.PEIM.ARM]
    <InputFile>
        *.lib

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(DEBUG_DIR)(+)$(MODULE_NAME).dll

    <Command.GCC>
        "$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_XIPFLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) $(CC_XIPFLAGS) $(DLINK2_FLAGS)
        "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}


[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
    <InputFile>
        *.lib

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(DEBUG_DIR)(+)$(MODULE_NAME)

    <Command.MSFT, Command.INTEL, Command.CLANGPDB>
        "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

    <Command.GCC>
        "$(DLINK)" $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)

    <Command.RVCT>
        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)

    <Command.RVCTCYGWIN>
        #$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)

    <Command.XCODE>
        "$(DLINK)" -o ${dst} $(DLINK_FLAGS)  $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)
      
      
[Dynamic-Library-File]
    <InputFile>
        ?.dll

    <OutputFile>
        $(OUTPUT_DIR)(+)$(MODULE_NAME).efi

    <Command.MSFT, Command.INTEL, Command.RVCT, Command.CLANGPDB>
        "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
        $(CP) ${dst} $(DEBUG_DIR)
        $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
        -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
        -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) 
    <Command.GCC>
        $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
        $(OBJCOPY) --strip-unneeded -R .eh_frame ${src}

        #
        #The below 2 lines are only needed for UNIXGCC tool chain, which generates PE image directly
        #
        -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
        -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug

        "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
        $(CP) ${dst} $(DEBUG_DIR)
        $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
        -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
        
    <Command.XCODE>
        # tool to convert Mach-O to PE/COFF
        "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
        # create symbol file for GDB debug
        -$(DSYMUTIL) ${src}
        "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
        $(CP) ${dst} $(DEBUG_DIR)
        $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
        -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)

[Dependency-Expression-File]
    <InputFile>
        ?.dxs, ?.Dxs, ?.DXS

    <OutputFile>
        $(OUTPUT_DIR)(+)$(MODULE_NAME).depex

    <ExtraDependency>
        $(MAKE_FILE)

    <Command>
        "$(PP)" $(DEPS_FLAGS) $(APP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
        Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
        GenDepex -t $(MODULE_TYPE) -o ${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii

[Acpi-Source-Language-File]
    <InputFile>
        ?.asl, ?.Asl, ?.ASL

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli

    <ExtraDependency>
        $(MAKE_FILE)

    <Command.MSFT, Command.INTEL>
        Trim --asl-file --asl-deps -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(ASLPP)" $(DEPS_FLAGS) $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
        Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii 
        "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
        $(CP) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli

    <Command.GCC>
        Trim --asl-file --asl-deps -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(ASLPP)" $(DEPS_FLAGS) $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
        Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii 
        "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
        $(CP) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.amli

[Acpi-Machine-Language-File-to-C.DXE_DRIVER]
    <InputFile>
        ?.amli

    <OutputFile>
        ${s_path}(+)${s_base}.c

    <Command>
        -AmlToC ${src}

[C-Code-File.AcpiTable]
    <InputFile>
        ?.c

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi

    <ExtraDependency>
        $(MAKE_FILE)

    <Command.MSFT, Command.INTEL>
        "$(ASLCC)" $(DEPS_FLAGS) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
        "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
        "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)

    <Command.GCC>
        "$(ASLCC)" $(DEPS_FLAGS) -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
        "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
        "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)

[Acpi-Table-Code-File]
    <InputFile>
        ?.aslc, ?.act

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi

    <ExtraDependency>
        $(MAKE_FILE)

    <Command.MSFT, Command.INTEL>
        "$(ASLCC)" $(DEPS_FLAGS) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
        "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
        "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)

    <Command.GCC>
        "$(ASLCC)" $(DEPS_FLAGS) -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
        "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS)
        "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)

    <Command.CLANGPDB>
        "$(ASLCC)" $(DEPS_FLAGS) -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
        "$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
        "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)

    <Command.XCODE>        
        "$(ASLCC)" $(DEPS_FLAGS) -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj  $(ASLCC_FLAGS) $(DEPS_FLAGS) $(INC) ${src}
        "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
        "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff
        "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff $(GENFW_FLAGS)
      
      
[Masm16-Code-File]
    <InputFile>
        ?.asm16, ?.Asm16, ?.ASM16, ?.s16, ?.S16

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_base}.com

    <Command.MSFT, Command.INTEL>
        Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
        Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
        cd $(OUTPUT_DIR)(+)${s_dir}
        "$(ASM16)" /nologo /c /omf $(ASM16_FLAGS) $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
        "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,

    <Command.GCC>
      Trim --asm-file -o {d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
      "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
      Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
      "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
      "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj --end-group
     
    <Command.XCODE>
      Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
      "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
      Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
      "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
      "$(SLINK)" $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
      otool -t $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib | hex2bin.py ${dst}
      

[Nasm-to-Binary-Code-File]
    <InputFile>
        ?.nasmb

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_base}.bin

    <Command>
        Trim --asm-file -o ${d_path}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(PP)" $(DEPS_FLAGS) $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.ii
        Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii
        "$(NASM)" -I${s_path}(+) -l ${d_path}(+)${s_base}.lst $(NASMB_FLAGS) $(NASM_INC) -o $dst ${d_path}(+)${s_base}.iii
        # copy the output file with .com postfix that be same to the output file of .asm16
        $(CP) ${dst} $(OUTPUT_DIR)(+)${s_base}.com

[Microcode-File.USER_DEFINED, Microcode-File.Microcode]
    <InputFile>
        ?.txt, ?.TXT, ?.Txt, ?.mut, ?.inc

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_base}.mcb

    <Command>
        "$(GENFW)" -o ${dst} -m ${src} $(GENFW_FLAGS)

[Microcode-Binary-File]
    <InputFile>
        *.mcb

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)$(MODULE_NAME).bin

    <Command>
        "$(GENFW)" -o ${dst} -j $(MICROCODE_BINARY_FILES) $(GENFW_FLAGS)
        -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).bin

[EFI-Image-File]
    <InputFile>
        ?.efi, ?.Efi, ?.EFI

    <OutputFile>

    <Command>

[Unicode-Text-File]
    <InputFile>
        *.uni, *.Uni, *.UNI

    <OutputFile>
        $(DEBUG_DIR)(+)AutoGen.c
        $(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h
        $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk

    <Command>

[Image-Definition-File]
    <InputFile>
        *.idf, *.Idf, *.IDF

    <OutputFile>
        $(DEBUG_DIR)(+)AutoGen.c
        $(DEBUG_DIR)(+)$(MODULE_NAME)ImgDefs.h
        $(OUTPUT_DIR)(+)$(MODULE_NAME)Idf.hpk

    <Command>

[Efi-Image.UEFI_OPTIONROM]
    <InputFile>
        ?.efi, ?.EFI, ?.Efi

    <OutputFile>
        $(BIN_DIR)(+)$(MODULE_NAME_GUID).rom

    <Command>
        $(OPTROM) -i $(PCI_DEVICE_ID) -f $(PCI_VENDOR_ID) -l $(PCI_CLASS_CODE) -r $(PCI_REVISION) -o $dst $(OPTROM_FLAGS) $src

[Unicode-Text-File.UEFI_HII]
    <InputFile>
        *.uni, *.Uni, *.UNI

    <OutputFile>
        $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk
        $(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h

    <Command>

[Image-Definition-File.UEFI_HII]
    <InputFile>
        *.idf, *.Idf, *.IDF

    <OutputFile>
        $(DEBUG_DIR)(+)$(MODULE_NAME)ImgDefs.h
        $(OUTPUT_DIR)(+)$(MODULE_NAME)Idf.hpk

    <Command>

[Visual-Form-Representation-File.UEFI_HII]
    <InputFile>
        ?.vfr
        ?.Vfr
        ?.VFR

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.hpk

    <Command>
        "$(VFRPP)" $(DEPS_FLAGS) $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
        "$(VFR)" $(VFR_FLAGS) --create-ifr-package --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory $(OUTPUT_DIR)(+)${s_dir} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i

[Hii-Binary-Package.UEFI_HII]
    <InputFile>
        *.hpk

    <OutputFile.MSFT, OutputFile.INTEL, OutputFile.GCC, OutputFile.CLANGPDB>
        $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.lib

    <OutputFile.XCODE, OutputFile.RVCT>
        $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc

    <Command.MSFT, Command.INTEL, Command.CLANGPDB>
        "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
        "$(RC)" /Fo${dst} $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc

    <Command.GCC>
        "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
        "$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}
    <Command.XCODE, Command.RVCT, Command.CLANGGCC>
        "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)