]> git.saurik.com Git - apple/xnu.git/blame_incremental - config/Makefile
xnu-3789.1.32.tar.gz
[apple/xnu.git] / config / Makefile
... / ...
CommitLineData
1export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
2export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
3export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
4export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
5
6include $(MakeInc_cmd)
7include $(MakeInc_def)
8
9MD_SUPPORTED_KPI_FILENAME = SupportedKPIs-${CURRENT_ARCH_CONFIG_LC}.txt
10MI_SUPPORTED_KPI_FILENAME = SupportedKPIs-all-archs.txt
11
12INSTALL_KEXT_DIR = $(DSTROOT)$(INSTALL_EXTENSIONS_DIR)
13
14KEXT_PLIST_LIST = \
15 System.kext/Info.plist \
16 System.kext/PlugIns/AppleNMI.kext/Info.plist \
17 System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \
18 System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \
19 System.kext/PlugIns/IOSystemManagement.kext/Info.plist
20
21SYMBOL_COMPONENT_LIST = \
22 BSDKernel \
23 IOKit \
24 Libkern \
25 Mach \
26 MACFramework \
27 Unsupported \
28 Private
29
30# In general you want it to be possible to have a CPU sub-type's symbol exports
31# alias to the parent type's exports. This is a special-case way to handle it
32# for now:
33ifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64h)
34EXPORT_SOURCE_ARCH_CONFIG_LC = x86_64
35else
36EXPORT_SOURCE_ARCH_CONFIG_LC = $(CURRENT_ARCH_CONFIG_LC)
37endif
38
39KEXT_MACHO_LIST = $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/$(symbolset))
40KEXT_PLIST_LIST += $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/Info.plist)
41
42SYMROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(SYMROOT)/,$(KEXT_MACHO_LIST))
43DSTROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_MACHO_LIST))
44
45SYMROOT_INSTALL_KEXT_PLISTS = $(addprefix $(SYMROOT)/,$(KEXT_PLIST_LIST))
46DSTROOT_INSTALL_KEXT_PLISTS = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_PLIST_LIST))
47
48EXPORTS_FILES = $(foreach symbolset,$(SYMBOL_COMPONENT_LIST),$(symbolset).exports $(symbolset).$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports) Unused.exports
49
50SYMBOL_SET_BUILD = $(foreach symbolset, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(symbolset).symbolset)
51
52$(OBJPATH)/allsymbols: $(OBJPATH)/$(KERNEL_FILE_NAME)
53 $(_v)$(NM) -gj $< > $@
54
55$(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset : %.exports %.$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols $(KEXT_CREATE_SYMBOL_SET)
56 @echo "$(ColorH)SYMBOLSET$(Color0) $(ColorF)$*$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
57 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
58 $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
59 -import $(OBJPATH)/allsymbols \
60 -export $(SOURCE)/$*.exports \
61 -export $(SOURCE)/$*.$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports \
62 -output $@ $(_vstdout)
63
64.PHONY: check_all_exports
65
66check_all_exports: $(OBJPATH)/allsymbols $(KEXT_CREATE_SYMBOL_SET)
67 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
68 $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
69 -import $(OBJPATH)/allsymbols \
70 $(foreach symbolset,$(filter-out Private,$(SYMBOL_COMPONENT_LIST)), \
71 -export $(SOURCE)/$(symbolset).exports \
72 -export $(SOURCE)/$(symbolset).$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports) \
73 -output /dev/null $(_vstdout)
74 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
75 $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
76 -import $(OBJPATH)/allsymbols \
77 $(foreach symbolset,$(filter-out Unsupported,$(SYMBOL_COMPONENT_LIST)), \
78 -export $(SOURCE)/$(symbolset).exports \
79 -export $(SOURCE)/$(symbolset).$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports) \
80 -output /dev/null $(_vstdout)
81
82$(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES)
83 @echo "$(ColorH)SUPPORTED_KPI$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
84 $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) $(EXPORT_SOURCE_ARCH_CONFIG_LC) $@
85
86$(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES)
87 @echo "$(ColorH)SUPPORTED_KPI$(Color0) \"($(ColorLF)all$(Color0))\""
88 $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) all $@
89
90build_symbol_sets: check_all_exports $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols \
91 $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) \
92 $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME)
93
94do_config_all:: build_symbol_sets
95
96# There's no simple static pattern rule for these paths, so hardcode dependencies in the command list
97$(SYMROOT_INSTALL_KEXT_MACHO_FILES): ALWAYS
98 $(_v)$(MKDIR) $(dir $@)
99 $(_v)if [ $(OBJROOT)/.symbolset.timestamp -nt $@ ]; then \
100 echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \
101 $(INSTALL) $(EXEC_INSTALL_FLAGS) $(OBJPATH)/$(@F).symbolset $@; \
102 cmdstatus=$$?; \
103 else \
104 echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \
105 $(LIPO) -create $@ $(OBJPATH)/$(@F).symbolset -output $@ 2>/dev/null || true; \
106 cmdstatus=$$?; \
107 fi; \
108 exit $$cmdstatus
109
110$(SYMROOT_INSTALL_KEXT_PLISTS): $(SYMROOT)/% : $(SOURCE)/%
111 $(_v)$(MKDIR) $(dir $@)
112 @echo "$(ColorH)INSTALLSYM$(ColorH) $(ColorLF)kextplist$(Color0) $(ColorF)$*$(Color0)"
113 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
114 $(_v)$(NEWVERS) $@ $(_vstdout)
115
116$(DSTROOT_INSTALL_KEXT_PLISTS): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/%
117 $(_v)$(MKDIR) $(dir $@)
118 @echo "$(ColorH)INSTALL$(ColorH) $(ColorLF)kextplist$(Color0) $(ColorF)$*$(Color0)"
119 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
120
121$(DSTROOT_INSTALL_KEXT_MACHO_FILES): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/% ALWAYS
122 $(_v)$(MKDIR) $(dir $@)
123 @echo "$(ColorF)INSTALL$(Color0) $(ColorF)$(notdir $@)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
124 $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
125
126$(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME): $(DSTROOT)/$(KRESDIR)/% : $(OBJPATH)/%
127 $(_v)$(MKDIR) $(dir $@)
128 @echo "$(ColorH)INSTALL$(Color0) $(ColorF)$*$(Color0)"
129 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
130
131do_config_install:: $(SYMROOT_INSTALL_KEXT_MACHO_FILES) \
132 $(SYMROOT_INSTALL_KEXT_PLISTS) \
133 $(DSTROOT_INSTALL_KEXT_MACHO_FILES) \
134 $(DSTROOT_INSTALL_KEXT_PLISTS) \
135 $(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) \
136 $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME)
137
138$(OBJPATH)/all-kpi.exp: $(EXPORTS_FILES)
139 $(_v)$(SOURCE)/generate_linker_exports.sh $@ $+
140
141do_build_all:: $(OBJPATH)/all-kpi.exp
142
143include $(MakeInc_rule)
144include $(MakeInc_dir)