]> git.saurik.com Git - apple/xnu.git/blame - config/Makefile
xnu-2422.1.72.tar.gz
[apple/xnu.git] / config / Makefile
CommitLineData
d7e50217
A
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
d7e50217
A
6include $(MakeInc_cmd)
7include $(MakeInc_def)
8
6d2010ae 9
39236c6e
A
10MD_SUPPORTED_KPI_FILENAME = SupportedKPIs-${CURRENT_ARCH_CONFIG_LC}.txt
11MI_SUPPORTED_KPI_FILENAME = SupportedKPIs-all-archs.txt
d7e50217 12
39236c6e 13INSTALL_KEXT_DIR = $(DSTROOT)$(INSTALL_EXTENSIONS_DIR)
d7e50217 14
39236c6e 15KEXT_PLIST_LIST = \
55e303ae 16 System.kext/Info.plist \
55e303ae
A
17 System.kext/PlugIns/AppleNMI.kext/Info.plist \
18 System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \
19 System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \
39236c6e 20 System.kext/PlugIns/IOSystemManagement.kext/Info.plist
6d2010ae 21
55e303ae 22SYMBOL_COMPONENT_LIST = \
55e303ae
A
23 BSDKernel \
24 IOKit \
6d2010ae
A
25 Libkern \
26 Mach \
27 MACFramework \
28 Unsupported \
29 Private
2d21ac55 30
39236c6e
A
31KEXT_MACHO_LIST = $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/$(symbolset))
32KEXT_PLIST_LIST += $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/Info.plist)
33
34SYMROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(SYMROOT)/,$(KEXT_MACHO_LIST))
35DSTROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_MACHO_LIST))
36
37SYMROOT_INSTALL_KEXT_PLISTS = $(addprefix $(SYMROOT)/,$(KEXT_PLIST_LIST))
38DSTROOT_INSTALL_KEXT_PLISTS = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_PLIST_LIST))
55e303ae 39
39236c6e 40EXPORTS_FILES = $(foreach symbolset,$(SYMBOL_COMPONENT_LIST),$(symbolset).exports $(symbolset).$(CURRENT_ARCH_CONFIG_LC).exports) Unused.exports
6d2010ae 41
39236c6e 42SYMBOL_SET_BUILD = $(foreach symbolset, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(symbolset).symbolset)
55e303ae 43
2d21ac55 44$(OBJPATH)/allsymbols: $(OBJPATH)/mach_kernel
b0d623f7 45 $(_v)$(NM) -gj $< > $@
55e303ae 46
39236c6e
A
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)
55
56.PHONY: check_all_exports
57
58check_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)
73
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) $@
77
78$(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES)
79 @echo SUPPORTED_KPI "(all)"
80 $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) all $@
81
82build_symbol_sets: check_all_exports $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols \
83 $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) \
84 $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME)
85
86do_config_all:: build_symbol_sets
87
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 $@; \
94 cmdstatus=$$?; \
95 else \
96 echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \
97 $(LIPO) -create $@ $(OBJPATH)/$(@F).symbolset -output $@ 2>/dev/null || true; \
98 cmdstatus=$$?; \
99 fi; \
100 exit $$cmdstatus
101
102.PHONY: symroot_kext_plists
103
104symroot_kext_plists: $(SYMROOT_INSTALL_KEXT_PLISTS)
105
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)
111
112.PHONY: dstroot_kext_plists
113
114dstroot_kext_plists: $(DSTROOT_INSTALL_KEXT_PLISTS)
115
116$(DSTROOT_INSTALL_KEXT_PLISTS): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/%
117 $(_v)$(MKDIR) $(dir $@)
118 @echo INSTALL kextplist $*
119 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
120
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) $< $@
125
126$(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME): $(DSTROOT)/$(KRESDIR)/% : $(OBJPATH)/%
127 $(_v)$(MKDIR) $(dir $@)
128 @echo INSTALL $*
129 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
130
131install_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)
137
138do_build_install_primary:: install_symbol_sets
139
140$(OBJPATH)/kernel-kpi.exp: $(EXPORTS_FILES)
141 $(_v)$(SOURCE)/generate_linker_exports.sh $@ $+
142
143.PHONY: build_mach_kernel_exports
144
145build_mach_kernel_exports: $(OBJPATH)/kernel-kpi.exp
146
147do_build_all:: build_mach_kernel_exports
b7266188 148
d7e50217
A
149include $(MakeInc_rule)
150include $(MakeInc_dir)