1 export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
2 export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
3 export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
4 export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
10 MD_SUPPORTED_KPI_FILENAME = SupportedKPIs-${CURRENT_ARCH_CONFIG_LC}.txt
11 MI_SUPPORTED_KPI_FILENAME = SupportedKPIs-all-archs.txt
13 INSTALL_KEXT_DIR = $(DSTROOT)$(INSTALL_EXTENSIONS_DIR)
16 System.kext/Info.plist \
17 System.kext/PlugIns/AppleNMI.kext/Info.plist \
18 System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \
19 System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \
20 System.kext/PlugIns/IOSystemManagement.kext/Info.plist
22 SYMBOL_COMPONENT_LIST = \
31 KEXT_MACHO_LIST = $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/$(symbolset))
32 KEXT_PLIST_LIST += $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/Info.plist)
34 SYMROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(SYMROOT)/,$(KEXT_MACHO_LIST))
35 DSTROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_MACHO_LIST))
37 SYMROOT_INSTALL_KEXT_PLISTS = $(addprefix $(SYMROOT)/,$(KEXT_PLIST_LIST))
38 DSTROOT_INSTALL_KEXT_PLISTS = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_PLIST_LIST))
40 EXPORTS_FILES = $(foreach symbolset,$(SYMBOL_COMPONENT_LIST),$(symbolset).exports $(symbolset).$(CURRENT_ARCH_CONFIG_LC).exports) Unused.exports
42 SYMBOL_SET_BUILD = $(foreach symbolset, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(symbolset).symbolset)
44 $(OBJPATH)/allsymbols: $(OBJPATH)/mach_kernel
45 $(_v)$(NM) -gj $< > $@
47 $(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset : %.exports %.$(CURRENT_ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols
48 @echo SYMBOLSET $* "($(CURRENT_ARCH_CONFIG_LC))"
49 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
50 $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
51 -import $(OBJPATH)/allsymbols \
52 -export $(SOURCE)/$*.exports \
53 -export $(SOURCE)/$*.$(CURRENT_ARCH_CONFIG_LC).exports \
54 -output $@ $(_vstdout)
56 .PHONY: check_all_exports
58 check_all_exports: $(OBJPATH)/allsymbols
59 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
60 $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
61 -import $(OBJPATH)/allsymbols \
62 $(foreach symbolset,$(filter-out Private,$(SYMBOL_COMPONENT_LIST)), \
63 -export $(SOURCE)/$(symbolset).exports \
64 -export $(SOURCE)/$(symbolset).$(CURRENT_ARCH_CONFIG_LC).exports) \
65 -output /dev/null $(_vstdout)
66 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
67 $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
68 -import $(OBJPATH)/allsymbols \
69 $(foreach symbolset,$(filter-out Unsupported,$(SYMBOL_COMPONENT_LIST)), \
70 -export $(SOURCE)/$(symbolset).exports \
71 -export $(SOURCE)/$(symbolset).$(CURRENT_ARCH_CONFIG_LC).exports) \
72 -output /dev/null $(_vstdout)
74 $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES)
75 @echo SUPPORTED_KPI "($(CURRENT_ARCH_CONFIG_LC))"
76 $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) $(CURRENT_ARCH_CONFIG_LC) $@
78 $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES)
79 @echo SUPPORTED_KPI "(all)"
80 $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) all $@
82 build_symbol_sets: check_all_exports $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols \
83 $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) \
84 $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME)
86 do_config_all:: build_symbol_sets
88 # There's no simple static pattern rule for these paths, so hardcode dependencies in the command list
89 $(SYMROOT_INSTALL_KEXT_MACHO_FILES): ALWAYS
90 $(_v)$(MKDIR) $(dir $@)
91 $(_v)if [ $(OBJROOT)/.symbolset.timestamp -nt $@ ]; then \
92 echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \
93 $(INSTALL) $(EXEC_INSTALL_FLAGS) $(OBJPATH)/$(@F).symbolset $@; \
96 echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \
97 $(LIPO) -create $@ $(OBJPATH)/$(@F).symbolset -output $@ 2>/dev/null || true; \
102 .PHONY: symroot_kext_plists
104 symroot_kext_plists: $(SYMROOT_INSTALL_KEXT_PLISTS)
106 $(SYMROOT_INSTALL_KEXT_PLISTS): $(SYMROOT)/% : $(SOURCE)/%
107 $(_v)$(MKDIR) $(dir $@)
108 @echo INSTALLSYM kextplist $*
109 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
110 $(_v)$(NEWVERS) $@ $(_vstdout)
112 .PHONY: dstroot_kext_plists
114 dstroot_kext_plists: $(DSTROOT_INSTALL_KEXT_PLISTS)
116 $(DSTROOT_INSTALL_KEXT_PLISTS): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/%
117 $(_v)$(MKDIR) $(dir $@)
118 @echo INSTALL kextplist $*
119 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
121 $(DSTROOT_INSTALL_KEXT_MACHO_FILES): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/%
122 $(_v)$(MKDIR) $(dir $@)
123 @echo INSTALL $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"
124 $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
126 $(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME): $(DSTROOT)/$(KRESDIR)/% : $(OBJPATH)/%
127 $(_v)$(MKDIR) $(dir $@)
129 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
131 install_symbol_sets: $(SYMROOT_INSTALL_KEXT_MACHO_FILES) \
132 symroot_kext_plists \
133 $(DSTROOT_INSTALL_KEXT_MACHO_FILES) \
134 dstroot_kext_plists \
135 $(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) \
136 $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME)
138 do_build_install_primary:: install_symbol_sets
140 $(OBJPATH)/kernel-kpi.exp: $(EXPORTS_FILES)
141 $(_v)$(SOURCE)/generate_linker_exports.sh $@ $+
143 .PHONY: build_mach_kernel_exports
145 build_mach_kernel_exports: $(OBJPATH)/kernel-kpi.exp
147 do_build_all:: build_mach_kernel_exports
149 include $(MakeInc_rule)
150 include $(MakeInc_dir)