1 # file extention : file type
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",
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",
37 ".i" : "Preprocessed-Code",
38 ".asl" : "Acpi-Source-Language",
39 ".Asl" : "Acpi-Source-Language",
40 ".ASL" : "Acpi-Source-Language",
43 ".lib" : "Static-Library",
44 ".a" : "Static-Library",
45 ".dll" : "Dynamic-Library",
46 ".so" : "Dynamic-Library",
49 DefaultToolCode = ["CC", "ASM", "SLINK", "DLINK", "PCH", "PP", "ASL", "VFRC", "AUTOGEN"]
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",
62 "Static-Library" : "DLINK",
63 "Dependency-Expression" : "PP",
66 ToolChainFamilyMapping = {
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"],
83 ## Build rules for makefile
84 # Placeholders for string substitution
85 # ${fdir} File relative directory within a module
86 # ${fname} File full name without path
87 # ${fbase} File name without extension and path
88 # ${fext} File extension
89 # ${dep} Dependency file
90 # ${sep} Directory separator
95 ${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE_DIR)${sep}${dep}
96 ${END} "$(CC)" $(CC_FLAGS) $(INC) /Fo$@ $(MODULE_DIR)${sep}${fdir}${sep}${fname}
100 ${BEGIN}$(OUTPUT_DIR)${sep}${fbase}.obj : $(WORKSPACE_DIR)${sep}${dep}
101 ${END} "$(CC)" $(CC_FLAGS) $(INC) /Fo$@ $(DEBUG_DIR)${sep}${fname}
105 ${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE_DIR)${sep}${dep}
106 ${END} "$(PP)" $(PP_FLAGS) $(INC) $(MODULE_DIR)${sep}${fdir}${sep}${fname} > $(@D)${sep}${fbase}.i
107 Trim -CONVERT $(@D)${sep}${fbase}.i
108 "$(ASM)" $(ASM_FLAGS) /Fo$@ $(@D)${sep}${fbase}.iii
112 ${BEGIN}$(OUTPUT_DIR)${sep}${fdir}${sep}${fbase}.obj : $(WORKSPACE_DIR)${sep}${dep}
113 ${END} "$(APP)" $(APP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)${sep}${fbase}.i
114 "$(ASM)" $(ASM_FLAGS) $(ASM_OUTPUT)$@ $(@D)${sep}${fbase}.i
117 "Visual-Form-Representation" :
118 '$(OUTPUT_DIR)\\%(fdir)s\\%(fbase)s.obj : $(MODULE_DIR)\\%(fdir)s\\%(fname)s $(DEP_FILES)\n'\
119 '\t"$(PP)" $(PP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)\\%(fbase)s.i\n'\
120 '\t"$(VFRC)" $(VFRC_FLAGS) $(INC) $(VFRC_OUTPUT)$(DEBUG_DIR)\\%(fdir)s\\%(fbase)s.c $(@D)\\%(fbase)s.i\n'\
121 '\t"$(CC)" $(CC_FLAGS) $(INC) $(CC_OUTPUT)$@ $(DEBUG_DIR)\\%(fdir)s\\%(fbase)s.c\n',
126 '''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
127 \t"$(CC)" $(CC_FLAGS) $(INC) $(CC_OUTPUT)$@ $<''',
130 '''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
131 \t"$(PP)" $(PP_FLAGS) $(INC) $? $(PP_OUTPUT)$(@D)/%(fbase)s.i
132 \tTrim -CONVERT $(@D)/%(fbase)s.i
133 \t"$(ASM)" $(ASM_FLAGS) $(ASM_OUTPUT)$@ $(@D)/%(fbase)s.iii''',
136 '''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
137 \t"$(ASM)" $(ASM_FLAGS) $(INC) $(ASM_OUTPUT)$@ $<''',
140 '''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
141 \t"$(APP)" $(APP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)/%(fbase)s.i
142 \t"$(ASM)" $(ASM_FLAGS) $(ASM_OUTPUT)$@ $(@D)/%(fbase)s.i''',
144 "Visual-Form-Representation" :
145 '''$(OUTPUT_DIR)/%(fdir)s/%(fbase)s.obj : $(MODULE_DIR)/%(fdir)s/%(fname)s $(DEP_FILES)
146 \t"$(PP)" $(PP_FLAGS) $(INC) $< $(PP_OUTPUT)$(@D)/%(fbase)s.i
147 \t"$(VFRC)" $(VFRC_FLAGS) $(INC) $(VFRC_OUTPUT)$(DEBUG_DIR)/%(fdir)s/%(fbase)s.c $(@D)/%(fbase)s.i
148 \t"$(CC)" $(CC_FLAGS) $(INC) $(CC_OUTPUT)$@ $(DEBUG_DIR)/%(fdir)s/%(fbase)s.c''',
152 # This acts like the main() function for the script, unless it is 'import'ed into another
154 if __name__ == '__main__':
155 for ext in FileTypeMapping:
156 print ext,":",FileTypeMapping[ext]
158 for type in Makefile["nmake"]:
159 print "[",type,"]\n",Makefile["nmake"][type]
162 for type in Makefile["gmake"]:
163 print "[",type,"]\n",Makefile["gmake"][type]