]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Conf/build_rule.template
Change the default active platform from MdeModulePkg to Nt32Pkg
[mirror_edk2.git] / BaseTools / Conf / build_rule.template
CommitLineData
589d5eaa 1# file extention : file type
2FileTypeMapping = {
3 ".c" : "C-Code",
4 ".C" : "C-Code",
5 ".cpp" : "C-Code",
6 ".Cpp" : "C-Code",
7 ".CPP" : "C-Code",
8 ".h" : "C-Header",
9 ".H" : "C-Header",
10 ".asm" : "Masm-Code",
11 ".Asm" : "Masm-Code",
12 ".ASM" : "Masm-Code",
13 ".s" : "Iasm-Code", # IPF assembly code
14 ".S" : "Gasm-Code", # GNU assembly code
15 ".uni" : "Unicode-Text",
16 ".Uni" : "Unicode-Text",
17 ".UNI" : "Unicode-Text",
18 ".vfr" : "Visual-Form-Representation",
19 ".Vfr" : "Visual-Form-Representation",
20 ".VFR" : "Visual-Form-Representation",
21 ".dxs" : "Dependency-Expression",
22 ".Dxs" : "Dependency-Expression",
23 ".DXS" : "Dependency-Expression",
24 ".fv" : "FirmwareVolume",
25 ".Fv" : "FirmwareVolume",
26 ".FV" : "FirmwareVolume",
27 ".efi" : "Efi-Image",
28 ".Efi" : "Efi-Image",
29 ".EFI" : "Efi-Image",
30 ".SEC" : "Firmware-File-System",
31 ".PEI" : "Firmware-File-System",
32 ".DXE" : "Firmware-File-System",
33 ".APP" : "Firmware-File-System",
34 ".FYI" : "Firmware-File-System",
35 ".FFS" : "Firmware-File-System",
36 ".bmp" : "Bmp-Image",
37 ".i" : "Preprocessed-Code",
38 ".asl" : "Acpi-Source-Language",
39 ".Asl" : "Acpi-Source-Language",
40 ".ASL" : "Acpi-Source-Language",
41 ".obj" : "Object",
42 ".o" : "Object",
43 ".lib" : "Static-Library",
44 ".a" : "Static-Library",
45 ".dll" : "Dynamic-Library",
46 ".so" : "Dynamic-Library",
47}
48
49DefaultToolCode = ["CC", "ASM", "SLINK", "DLINK", "PCH", "PP", "ASL", "VFRC", "AUTOGEN"]
50
51ToolCodeMapping = {
52 "C-Code" : "CC",
53 "C-Header" : "PCH",
54 "Masm-Code" : "ASM",
55 "Iasm-Code" : "ASM", # IPF assembly code
56 "Gasm-Code" : "ASM", # GNU assembly code
57 "Unicode-Text" : "AUTOGEN",
58 "Visual-Form-Representation" : "VFRC",
59 "Preprocessed-Code" : "CC",
60 "Acpi-Source-Language" : "ASL",
61 "Object" : "SLINK",
62 "Static-Library" : "DLINK",
8cc72408 63 "Dependency-Expression" : "PP",
589d5eaa 64}
65
66ToolChainFamilyMapping = {
67 "C-Code" : ["MSFT", "INTEL", "GCC"],
68 "C-Header" : ["MSFT", "INTEL", "GCC"],
69 "Masm-Code" : ["MSFT", "INTEL"],
70 "Iasm-Code" : ["MSFT", "INTEL"], # IPF assembly code
71 "Gasm-Code" : ["GCC"], # GNU assembly code
72 "Unicode-Text" : ["MSFT", "INTEL", "GCC"],
73 "Visual-Form-Representation" : ["MSFT", "INTEL", "GCC"],
74 "Dependency-Expression" : ["MSFT", "INTEL", "GCC"],
75 "FirmwareVolume" : ["MSFT", "INTEL", "GCC"],
76 "Efi-Image" : ["MSFT", "INTEL", "GCC"],
77 "Firmware-File-System" : ["MSFT", "INTEL", "GCC"],
78 "Bmp-Image" : ["MSFT", "INTEL", "GCC"],
79 "Preprocessed-Code" : ["MSFT", "INTEL"],
80 "Acpi-Source-Language" : ["MSFT", "INTEL"],
81}
82
83## Build rules for makefile
84# Placeholders for string substitution
a9c9a31d 85# ${fpath} File path relative to $(WORKSPACE)
86# ${fdir} File relative directory within a module
589d5eaa 87# ${fname} File full name without path
88# ${fbase} File name without extension and path
a9c9a31d 89# ${fext} File extension
90# ${fdep} File dependencies
91# ${sep} Directory separator
589d5eaa 92#
93Makefile = {
94"nmake" : {
95"C-Code" : '''\
a9c9a31d 96$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(COMMON_DEPS)
97${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE)${sep}${fdep}
98${END} "$(CC)" $(CC_FLAGS) $(INC) /Fo$@ $(WORKSPACE)${sep}${fpath}
589d5eaa 99''',
100
101"Masm-Code" : '''\
a9c9a31d 102$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(COMMON_DEPS)
103${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE)${sep}${fdep}
104${END} "$(PP)" $(PP_FLAGS) $(INC) $(WORKSPACE)${sep}${fpath} > $(@D)${sep}${fbase}.i
589d5eaa 105 Trim -CONVERT $(@D)${sep}${fbase}.i
106 "$(ASM)" $(ASM_FLAGS) /Fo$@ $(@D)${sep}${fbase}.iii
107''',
108
109"Iasm-Code" : '''\
a9c9a31d 110$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(COMMON_DEPS)
111${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE)${sep}${fdep}
112${END} "$(APP)" $(APP_FLAGS) $(INC) $(WORKSPACE)${sep}${fpath} > $(@D)${sep}${fbase}.i
3f94b8e8 113 "$(ASM)" $(ASM_FLAGS) -o$@ $(@D)${sep}${fbase}.i
589d5eaa 114''',
115
8cc72408 116"Visual-Form-Representation" : '''\
117$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(COMMON_DEPS)
118${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE)${sep}${fdep}
119${END}\t"$(VFRPP)" $(VFRPP_FLAGS) $(INC) $(WORKSPACE)${sep}${fpath} > $(@D)${sep}${fbase}.i
120\tTrim -VFR $(@D)${sep}${fbase}.i
2a3e0cce 121\t-mkdir $(DEBUG_DIR)${sep}${fdir} > NUL 2>&1
8cc72408 122\t"$(VFRC)" $(VFRC_FLAGS) -od $(DEBUG_DIR)${sep}${fdir} $(@D)${sep}${fbase}.iii
123\t"$(CC)" $(CC_FLAGS) $(INC) /Fo$@ $(DEBUG_DIR)${sep}${fdir}${sep}${fbase}.c
124''',
589d5eaa 125},
126
127"gmake" : {
128"C-Code" :
129'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
130\t"$(CC)" $(CC_FLAGS) $(INC) $(CC_OUTPUT)$@ $<''',
131
132"Masm-Code" :
133'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
134\t"$(PP)" $(PP_FLAGS) $(INC) $? $(PP_OUTPUT)$(@D)/%(fbase)s.i
135\tTrim -CONVERT $(@D)/%(fbase)s.i
136\t"$(ASM)" $(ASM_FLAGS) $(ASM_OUTPUT)$@ $(@D)/%(fbase)s.iii''',
137
138"Gasm-Code" :
139'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
140\t"$(ASM)" $(ASM_FLAGS) $(INC) $(ASM_OUTPUT)$@ $<''',
141
142"Iasm-Code" :
143'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
144\t"$(APP)" $(APP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)/%(fbase)s.i
145\t"$(ASM)" $(ASM_FLAGS) $(ASM_OUTPUT)$@ $(@D)/%(fbase)s.i''',
146
147"Visual-Form-Representation" :
148'''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
149\t"$(PP)" $(PP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)/%(fbase)s.i
150\t"$(VFRC)" $(VFRC_FLAGS) $(INC) $(VFRC_OUTPUT)$(DEBUG_DIR)/%(fdir)s/%(fbase)s.c $(@D)/%(fbase)s.i
151\t"$(CC)" $(CC_FLAGS) $(INC) $(CC_OUTPUT)$@ $(DEBUG_DIR)/%(fdir)s/%(fbase)s.c''',
152}
153}
154
155# This acts like the main() function for the script, unless it is 'import'ed into another
156# script.
157if __name__ == '__main__':
158 for ext in FileTypeMapping:
159 print ext,":",FileTypeMapping[ext]
160
161 for type in Makefile["nmake"]:
162 print "[",type,"]\n",Makefile["nmake"][type]
163 print
164
165 for type in Makefile["gmake"]:
166 print "[",type,"]\n",Makefile["gmake"][type]
167 print
168