]> git.saurik.com Git - apple/xnu.git/blobdiff - config/Makefile
xnu-6153.61.1.tar.gz
[apple/xnu.git] / config / Makefile
index 73a9076354261c62aeb0971fe5331c1d8448f610..0f5f3ab63f0d078e931f034127e48dfeed353f98 100644 (file)
@@ -13,6 +13,7 @@ INSTALL_KEXT_DIR = $(DSTROOT)$(INSTALL_EXTENSIONS_DIR)
 
 KEXT_PLIST_LIST = \
        System.kext/Info.plist \
+       System.kext/PlugIns/Kasan.kext/Info.plist \
        System.kext/PlugIns/AppleNMI.kext/Info.plist \
        System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \
        System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \
@@ -49,17 +50,26 @@ EXPORTS_FILES = $(foreach symbolset,$(SYMBOL_COMPONENT_LIST),$(symbolset).export
 
 SYMBOL_SET_BUILD = $(foreach symbolset, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(symbolset).symbolset)
 
+ifeq ($(KASAN),1)
+KASAN_EXPORTS = $(SRCROOT)/san/Kasan_kasan.exports
+endif
+
 $(OBJPATH)/allsymbols: $(OBJPATH)/$(KERNEL_FILE_NAME)
        $(_v)$(NM) -gj $< > $@
 
-$(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset :  %.exports %.$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols $(KEXT_CREATE_SYMBOL_SET)
-       @echo SYMBOLSET $* "($(CURRENT_ARCH_CONFIG_LC))"
-       $(_v)$(KEXT_CREATE_SYMBOL_SET)                                  \
-               $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG))                    \
-               -import $(OBJPATH)/allsymbols                           \
-               -export $(SOURCE)/$*.exports                            \
-               -export $(SOURCE)/$*.$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports    \
-               -output $@ $(_vstdout)
+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
 
@@ -80,11 +90,11 @@ check_all_exports: $(OBJPATH)/allsymbols $(KEXT_CREATE_SYMBOL_SET)
                -output /dev/null $(_vstdout)
 
 $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES)
-       @echo SUPPORTED_KPI "($(CURRENT_ARCH_CONFIG_LC))"
+       $(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)
-       @echo SUPPORTED_KPI "(all)"
+       $(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 \
@@ -96,12 +106,11 @@ 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                \
-               echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))";   \
                $(INSTALL) $(EXEC_INSTALL_FLAGS) $(OBJPATH)/$(@F).symbolset $@; \
                cmdstatus=$$?;                                                  \
        else                                                                    \
-               echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))";   \
                $(LIPO) -create $@ $(OBJPATH)/$(@F).symbolset -output $@ 2>/dev/null || true;   \
                cmdstatus=$$?;                                                  \
        fi;                                                                     \
@@ -109,36 +118,42 @@ $(SYMROOT_INSTALL_KEXT_MACHO_FILES): ALWAYS
 
 $(SYMROOT_INSTALL_KEXT_PLISTS): $(SYMROOT)/% : $(SOURCE)/%
        $(_v)$(MKDIR) $(dir $@)
-       @echo INSTALLSYM kextplist $*
+       $(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 $@)
-       @echo INSTALL kextplist $*
+       $(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 $@)
-       @echo INSTALL $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"
+       $(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 $@)
-       @echo INSTALL $*
+       $(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)
+endif
+
 
 $(OBJPATH)/all-kpi.exp: $(EXPORTS_FILES)
-       $(_v)$(SOURCE)/generate_linker_exports.sh $@ $+
+       $(_v)$(SOURCE)/generate_linker_exports.sh $@ $+ $(KASAN_EXPORTS)
+
+$(OBJPATH)/all-alias.exp: $(EXPORTS_FILES)
+       $(_v)$(SOURCE)/generate_linker_aliases.sh $@ $+ $(KASAN_EXPORTS)
 
-do_build_all:: $(OBJPATH)/all-kpi.exp
+do_build_all:: $(OBJPATH)/all-kpi.exp $(OBJPATH)/all-alias.exp
 
 include $(MakeInc_rule)
 include $(MakeInc_dir)