-$(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset : %.exports %.$(ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols
- $(_v)if [ "$*" != System6.0 -o $(SUPPORT_SYSTEM60_KEXT) -eq 1 ]; then \
- $(KEXT_CREATE_SYMBOL_SET) \
- $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_ALL_)) \
- -import $(OBJPATH)/allsymbols \
- -export $*.exports \
- -export $*.$(ARCH_CONFIG_LC).exports \
- -output $@ $(_vstdout); \
- fi
- $(_v)if [ ! -e $@ ]; then \
- printf "" > $@; \
- fi
-
-# When building the top-level install target for all architectures, aggregate the per-arch
-# symbolsets for the primary machine configuration for each kernel/arch config
-$(SYMBOL_SET_FAT): $(OBJROOT)/%.symbolset :
- $(_v)per_arch_symbolsets=""; \
- kernel_config=$(INSTALL_TYPE); \
- machine_config=$(MACHINE_CONFIG); \
- for arch_config in $(INSTALL_ARCHS); \
- do \
- if [ $${arch_config} = ARM ] ; then \
- if [ $${machine_config} = DEFAULT ] ; then \
- machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
- fi; \
- fi; \
- if [ $${machine_config} = DEFAULT ] ; then \
- objpath=${OBJROOT}/$${kernel_config}_$${arch_config}; \
- else \
- objpath=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
- fi; \
- if [ -s "$${objpath}/$*.symbolset" ]; then \
- per_arch_symbolsets="$${per_arch_symbolsets} $${objpath}/$*.symbolset"; \
- fi; \
- done; \
- if [ -n "$${per_arch_symbolsets}" ]; then \
- $(LIPO) $${per_arch_symbolsets} -create -output $@; \
- else \
- printf "" > $@; \
- fi
-
-build_symbol_sets: $(SYMBOL_SET_BUILD)
- $(_v)$(KEXT_CREATE_SYMBOL_SET) \
- $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_ALL_)) \
- -import $(OBJPATH)/allsymbols \
- -export $(SRCROOT)/$(COMPONENT)/Libkern.exports \
- -export $(SRCROOT)/$(COMPONENT)/Libkern.$(ARCH_CONFIG_LC).exports \
- -export $(SRCROOT)/$(COMPONENT)/Mach.exports \
- -export $(SRCROOT)/$(COMPONENT)/Mach.$(ARCH_CONFIG_LC).exports \
- -export $(SRCROOT)/$(COMPONENT)/IOKit.exports \
- -export $(SRCROOT)/$(COMPONENT)/IOKit.$(ARCH_CONFIG_LC).exports \
- -export $(SRCROOT)/$(COMPONENT)/BSDKernel.exports \
- -export $(SRCROOT)/$(COMPONENT)/BSDKernel.$(ARCH_CONFIG_LC).exports \
- $(MACFRAMEWORKEXPORTS) \
- -export $(SRCROOT)/$(COMPONENT)/Unsupported.exports \
- -export $(SRCROOT)/$(COMPONENT)/Unsupported.$(ARCH_CONFIG_LC).exports \
- -output /dev/null $(_vstdout);
- $(_v)$(KEXT_CREATE_SYMBOL_SET) \
- $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \
- -import $(OBJPATH)/allsymbols \
- -export $(SRCROOT)/$(COMPONENT)/Libkern.exports \
- -export $(SRCROOT)/$(COMPONENT)/Libkern.$(ARCH_CONFIG_LC).exports \
- -export $(SRCROOT)/$(COMPONENT)/Mach.exports \
- -export $(SRCROOT)/$(COMPONENT)/Mach.$(ARCH_CONFIG_LC).exports \
- -export $(SRCROOT)/$(COMPONENT)/IOKit.exports \
- -export $(SRCROOT)/$(COMPONENT)/IOKit.$(ARCH_CONFIG_LC).exports \
- -export $(SRCROOT)/$(COMPONENT)/BSDKernel.exports \
- -export $(SRCROOT)/$(COMPONENT)/BSDKernel.$(ARCH_CONFIG_LC).exports \
- $(MACFRAMEWORKEXPORTS) \
- -export $(SRCROOT)/$(COMPONENT)/Private.exports \
- -export $(SRCROOT)/$(COMPONENT)/Private.$(ARCH_CONFIG_LC).exports \
- -output /dev/null $(_vstdout);
- $(_v) $(SRCROOT)/$(COMPONENT)/list_supported.sh $(SRCROOT)/$(COMPONENT) $(ARCH_CONFIG_LC) $(OBJPATH)/${MD_SUPPORTED_KPI_FILENAME};
- $(_v)if [ -n `echo $${ARCH_CONFIGS%%\ *} | grep -i $(ARCH_CONFIG)` ]; \
- then \
- $(SRCROOT)/$(COMPONENT)/list_supported.sh $(SRCROOT)/$(COMPONENT) "ALL" $(OBJROOT)/${MI_SUPPORTED_KPI_FILENAME}; \
- fi
-
-
-install_symbol_sets: $(SYMBOL_SET_FAT) $(SRCROOT)/config/MasterVersion
- $(_v)if [ -s "$(OBJROOT)/System6.0.symbolset" ]; then \
- install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/System6.0.kext/kernel.6.0; \
- install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Mach6.0.kext/Mach6.0; \
- install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/BSDKernel6.0.kext/BSDKernel6.0; \
- install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Libkern6.0.kext/Libkern6.0; \
- install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/IOKit6.0.kext/IOKit6.0; \
- fi
- $(_v)install $(INSTALL_FLAGS) $(OBJROOT)/BSDKernel.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/BSDKernel.kext/BSDKernel;
- $(_v)install $(INSTALL_FLAGS) $(OBJROOT)/IOKit.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/IOKit.kext/IOKit;
- $(_v)install $(INSTALL_FLAGS) $(OBJROOT)/Libkern.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Libkern.kext/Libkern;
- $(_v)install $(INSTALL_FLAGS) $(OBJROOT)/Mach.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Mach.kext/Mach;
- $(_v)install $(INSTALL_FLAGS) $(OBJROOT)/Unsupported.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Unsupported.kext/Unsupported;
- $(_v)install $(INSTALL_FLAGS) $(OBJROOT)/Private.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Private.kext/Private;
- $(_v)$(NEWVERS) $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/AppleNMI.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/BSDKernel.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/IOKit.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/IOSystemManagement.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Libkern.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Mach.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Unsupported.kext/Info.plist \
- $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/Private.kext/Info.plist;
- $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR);
- $(_v)install $(INSTALL_FLAGS) $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR);
- $(_v)if [ -n `echo $${ARCH_CONFIGS%%\ *} | grep -i $(ARCH_CONFIG)` ]; then \
- install $(INSTALL_FLAGS) $(OBJROOT)/$(MI_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR); \
- fi
-ifdef MAC
- $(_v)install $(INSTALL_FLAGS) $(OBJROOT)/MACFramework.symbolset $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/MACFramework.kext/MACFramework;
- $(_v)$(NEWVERS) $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/PlugIns/MACFramework.kext/Info.plist
+define symbol_set_rule
+$(OBJPATH)/$(1).symbolset: MY_EXPORTS := $(filter $(1)%,$(EXPORTS_FILES))
+$(OBJPATH)/$(1).symbolset: MY_EXPORTS_ARGS := $$(foreach file,$$(MY_EXPORTS),-export $(SOURCE)/$$(file))
+$(OBJPATH)/$(1).symbolset: $$(MY_EXPORTS) $(OBJPATH)/allsymbols $(KEXT_CREATE_SYMBOL_SET)
+ $$(call makelog,$(ColorH)SYMBOLSET$(Color0) $(ColorF)$(1)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))")
+ $(_v)$(KEXT_CREATE_SYMBOL_SET) \
+ $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
+ -import $(OBJPATH)/allsymbols \
+ $$(MY_EXPORTS_ARGS) \
+ -output $$@ $(_vstdout)
+endef
+
+$(foreach symbolset,$(SYMBOL_COMPONENT_LIST),$(eval $(call symbol_set_rule,$(symbolset))))
+
+.PHONY: check_all_exports
+
+check_all_exports: $(OBJPATH)/allsymbols $(KEXT_CREATE_SYMBOL_SET)
+ $(_v)$(KEXT_CREATE_SYMBOL_SET) \
+ $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
+ -import $(OBJPATH)/allsymbols \
+ $(foreach symbolset,$(filter-out Private,$(SYMBOL_COMPONENT_LIST)), \
+ -export $(SOURCE)/$(symbolset).exports \
+ -export $(SOURCE)/$(symbolset).$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports) \
+ -output /dev/null $(_vstdout)
+ $(_v)$(KEXT_CREATE_SYMBOL_SET) \
+ $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
+ -import $(OBJPATH)/allsymbols \
+ $(foreach symbolset,$(filter-out Unsupported,$(SYMBOL_COMPONENT_LIST)), \
+ -export $(SOURCE)/$(symbolset).exports \
+ -export $(SOURCE)/$(symbolset).$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports) \
+ -output /dev/null $(_vstdout)
+
+$(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES)
+ $(call makelog,$(ColorH)SUPPORTED_KPI$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))")
+ $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) $(EXPORT_SOURCE_ARCH_CONFIG_LC) $@
+
+$(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES)
+ $(call makelog,$(ColorH)SUPPORTED_KPI$(Color0) "($(ColorLF)all$(Color0))")
+ $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) all $@
+
+build_symbol_sets: check_all_exports $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols \
+ $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) \
+ $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME)
+
+do_config_all:: build_symbol_sets
+
+# There's no simple static pattern rule for these paths, so hardcode dependencies in the command list
+$(SYMROOT_INSTALL_KEXT_MACHO_FILES): ALWAYS
+ $(_v)$(MKDIR) $(dir $@)
+ $(call makelog,$(ColorH)INSTALLSYM$(Color0) $(ColorF)symbolset $(notdir $@)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))")
+ $(_v)if [ $(OBJROOT)/.symbolset.timestamp -nt $@ ]; then \
+ $(INSTALL) $(EXEC_INSTALL_FLAGS) $(OBJPATH)/$(@F).symbolset $@; \
+ cmdstatus=$$?; \
+ else \
+ $(LIPO) -create $@ $(OBJPATH)/$(@F).symbolset -output $@ 2>/dev/null || true; \
+ cmdstatus=$$?; \
+ fi; \
+ exit $$cmdstatus
+
+$(SYMROOT_INSTALL_KEXT_PLISTS): $(SYMROOT)/% : $(SOURCE)/%
+ $(_v)$(MKDIR) $(dir $@)
+ $(call makelog,$(ColorH)INSTALLSYM$(Coloro) $(ColorLF)kextplist$(Color0) $(ColorF)$*$(Color0))
+ $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
+ $(_v)$(NEWVERS) $@ $(_vstdout)
+
+$(DSTROOT_INSTALL_KEXT_PLISTS): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/%
+ $(_v)$(MKDIR) $(dir $@)
+ $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorLF)kextplist$(Color0) $(ColorF)$*$(Color0))
+ $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
+
+$(DSTROOT_INSTALL_KEXT_MACHO_FILES): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/% ALWAYS
+ $(_v)$(MKDIR) $(dir $@)
+ $(call makelog,$(ColorF)INSTALL$(Color0) $(ColorF)$(notdir $@)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))")
+ $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
+
+$(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME): $(DSTROOT)/$(KRESDIR)/% : $(OBJPATH)/%
+ $(_v)$(MKDIR) $(dir $@)
+ $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$*$(Color0))
+ $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
+
+ifneq ($(INSTALL_KASAN_ONLY),1)
+do_config_install:: $(SYMROOT_INSTALL_KEXT_MACHO_FILES) \
+ $(SYMROOT_INSTALL_KEXT_PLISTS) \
+ $(DSTROOT_INSTALL_KEXT_MACHO_FILES) \
+ $(DSTROOT_INSTALL_KEXT_PLISTS) \
+ $(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) \
+ $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME)