summaryrefslogtreecommitdiff
path: root/BaseTools/Conf/build_rule.template
blob: e9c918b116f6babb6132de658beee025ee5511de (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
#
#  Copyright (c) 2007, Intel Corporation
#
#  All rights reserved. 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.
#
#  Filename: build_rule.template
#

## 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.
#
# "[" Build.<File-Type>[.<version>][, Build.<File-Type>[.<version>]] "]" <EOL>
#   <InputFile[.<ToolChainFamily>]> <EOL>
#       [File-Type =] (?|*).<File-Extension> [(\n|,|;) (?|*).<File-Extension>]
#
#   <OutputFile[.<ToolChainFamily>]> <EOL>
#       <FileFullPath>
#
#   <Command[.<ToolChainFamily>]> <EOL>
#       <Command1>
#       [<Command2>]
#

## 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
#   $(LIBS)             Static library files of current module
#   $(<tool>_FLAGS)     Tools flags of current module
#   $(MODULE_NAME)      Current module name
#   $(MODULE_TYPE)      Current module type
#   $(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_TYPE_LIST>) 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_FILE_LIST macro.)
#
#   $(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.C-Code-File]
    <InputFile>
        ?.c
        ?.C
        ?.cc
        ?.CC
        ?.cpp
        ?.Cpp
        ?.CPP

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

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

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

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

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

    <Command>


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

    <InputFile.GCC>
        ?.S

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

    <Command.MSFT, Command.INTEL>
        "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
        Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
        "$(ASM)" /Fo${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii

    <Command.GCC>
        "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
        Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
        "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii

[Build.Iasm-Code-File]
    <InputFile>
        ?.s

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

    <Command.MSFT, Command.INTEL>
        "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
        Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
        "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii

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

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

    <Command>
        "$(PP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
        Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
        -mkdir ${d_path} > NUL 2>&1
        VfrCompile --no-pre-processing --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii

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

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

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

    <Command.GCC>
        "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src}

#[Build.Object-File, Build.Static-Library-File]
#BUILD_VERSION =  0x00010000
#
#    <InputFile>
#       Object-File = *.obj
#       Static-Library-File = *.lib, *.a
#
#    <OutputFile>
#        $(OUTPUT_DIR)(+)$(MODULE_NAME).lib
#
#    <Command.MSFT>
#        "$(SLINK)" /OUT:${dst} $(SLINK_FLAGS) ${src}
#
#    <Command.GCC>
#        "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) ${src1} -( ${src2} -)
#
[Build.Static-Library-File]
    <InputFile.MSFT, InputFile.Intel>
        ?.lib
        $(LIBS)
        $(MAKE_FILE)

    <InputFile.GCC>
        ?.lib
        $(LIBS)
        $(MAKE_FILE)

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

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

    <Command.GCC>
        "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(LIBS) ${src} -\)

[Build.Dynamic-Library-File]
    <InputFile>
        ?.dll

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

    <Command>
        GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
        $(CP) ${dst} $(OUTPUT_DIR)
        $(CP) ${dst} $(BIN_DIR)
        -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)

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

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

    <Command>
        "$(PP)" $(CC_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

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

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

    <Command.MSFT, Command.INTEL>
        "$(PP)" $(APP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
        "$(ASL)" -p ${dst} $(ASL_FLAGS) ${d_path}(+)${s_base}.i

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

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

    <Command.MSFT, Command.INTEL>
        "$(CC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(INC) ${src}
        "$(DLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
        GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll

[Build.Masm16-Code-File]
    <InputFile>
        ?.asm16, ?.Asm16, ?.ASM16

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

    <Command.MSFT, Command.INTEL>
        cd $(OUTPUT_DIR)(+)${s_dir}
        "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}
        "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,

[Build.Microcode-File]
    <InputFile>
        ?.txt, ?.TXT, ?.Txt

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

    <Command>
        GenFw -o ${dst} -m ${src}

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

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

    <Command>
        GenFw -o ${dst} -j ${src}

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

    <OutputFile>
        $(DEBUG_DIR)(+)AutoGen.c
        $(DEBUG_DIR)(+)AutoGen.h

    <Command>