]>
Commit | Line | Data |
---|---|---|
1 | # -*- mode: makefile;-*- | |
2 | # | |
3 | # Copyright (C) 1999-2020 Apple Inc. All rights reserved. | |
4 | # | |
5 | # MakeInc.kernel augments the single-architecture | |
6 | # recursive build system with rules specific | |
7 | # to assembling and linking a kernel. | |
8 | # | |
9 | ||
10 | # | |
11 | # Validate configuration options | |
12 | # | |
13 | ifeq ($(filter $(CURRENT_ARCH_CONFIG),$(SUPPORTED_ARCH_CONFIGS)),) | |
14 | $(error Unsupported CURRENT_ARCH_CONFIG $(CURRENT_ARCH_CONFIG)) | |
15 | endif | |
16 | ||
17 | ifeq ($(filter $(CURRENT_KERNEL_CONFIG),$(SUPPORTED_KERNEL_CONFIGS)),) | |
18 | $(error Unsupported CURRENT_KERNEL_CONFIG $(CURRENT_KERNEL_CONFIG)) | |
19 | endif | |
20 | ||
21 | ifeq ($(filter $(CURRENT_MACHINE_CONFIG),$(SUPPORTED_$(CURRENT_ARCH_CONFIG)_MACHINE_CONFIGS)),) | |
22 | $(error Unsupported CURRENT_MACHINE_CONFIG $(CURRENT_MACHINE_CONFIG)) | |
23 | endif | |
24 | ||
25 | ifeq ($(filter $(PLATFORM),$(SUPPORTED_PLATFORMS)),) | |
26 | $(error Unsupported PLATFORM $(PLATFORM)) | |
27 | endif | |
28 | ||
29 | ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1) | |
30 | do_build_setup:: | |
31 | $(_v)$(CAT) > $(OBJPATH)/compile_commands.json < /dev/null | |
32 | endif | |
33 | ||
34 | ifeq ($(BUILD_STATIC_LINK),1) | |
35 | ifeq ($(USE_LTO),1) | |
36 | # <rdar://problem/46252406> | |
37 | # To run LTO in the xnu project while linking the final result in KCB, without losing debugging info, | |
38 | # run ld -r on only the LTO bitcode object files to produce one mach-o for KCB to use, which is added | |
39 | # to the static link archive, along with the non-LTO objects (not linked, since ld -r on mach-o objects | |
40 | # does not preserve DWARF.) | |
41 | PRE_LTO=1 | |
42 | endif | |
43 | endif | |
44 | ||
45 | # | |
46 | # Rules for the highly parallel "build" phase, where each build configuration | |
47 | # writes into their own $(TARGET) independent of other build configs | |
48 | # | |
49 | # There are 5 primary build outputs: | |
50 | # 1) $(KERNEL_FILE_NAME).unstripped (raw linked kernel, unstripped) | |
51 | # 2) $(KERNEL_FILE_NAME) (stripped kernel, with optional CTF data) | |
52 | # 3) $(KERNEL_FILE_NAME).dSYM (dSYM) | |
53 | # 4) $(KERNEL_FILE_NAME).link (bits for static linking) | |
54 | # 5) lib$(KERNEL_FILE_NAME).a (static archive for testing) | |
55 | ||
56 | ifeq ($(BUILD_STATIC_LINK),1) | |
57 | ifeq ($(BUILD_XNU_LIBRARY),1) | |
58 | ||
59 | KERNEL_STATIC_LINK_TARGETS = \ | |
60 | $(TARGET)/lib$(KERNEL_FILE_NAME).a | |
61 | KERNEL_STATIC_LINK_DST = \ | |
62 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/lib$(KERNEL_FILE_NAME).a | |
63 | ||
64 | else | |
65 | ||
66 | KERNEL_STATIC_LINK_TARGETS = \ | |
67 | $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a | |
68 | ||
69 | KERNEL_STATIC_LINK_DST = \ | |
70 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a \ | |
71 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments \ | |
72 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives \ | |
73 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp \ | |
74 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp \ | |
75 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \ | |
76 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) | |
77 | ||
78 | endif | |
79 | endif | |
80 | ||
81 | do_build_all:: do_build_kernel | |
82 | ||
83 | .PHONY: do_build_kernel | |
84 | ||
85 | ifeq ($(BUILD_XNU_LIBRARY),1) | |
86 | do_build_kernel: $(KERNEL_STATIC_LINK_TARGETS) | |
87 | ||
88 | else | |
89 | ||
90 | do_build_kernel: $(TARGET)/$(KERNEL_FILE_NAME) $(TARGET)/$(KERNEL_FILE_NAME).unstripped $(KERNEL_STATIC_LINK_TARGETS) | |
91 | @: | |
92 | ||
93 | ifeq ($(BUILD_DSYM),1) | |
94 | do_build_all:: do_build_kernel_dSYM | |
95 | endif | |
96 | ||
97 | .PHONY: do_build_kernel_dSYM | |
98 | ||
99 | do_build_kernel_dSYM: $(TARGET)/$(KERNEL_FILE_NAME).dSYM | |
100 | @: | |
101 | ||
102 | endif | |
103 | ||
104 | .LDFLAGS: ALWAYS | |
105 | $(_v)$(REPLACECONTENTS) $@ $(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_ONLY) $(LD_KERNEL_LIBS) | |
106 | .CFLAGS: ALWAYS | |
107 | $(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS) | |
108 | ||
109 | $(TARGET)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).unstripped $(TARGET)/$(KERNEL_FILE_NAME).dSYM | |
110 | @$(LOG_STRIP) "$(@F)" | |
111 | $(_v)$(STRIP) $(STRIP_FLAGS) $< -o $@ | |
112 | @echo "built kernel at $@" | |
113 | $(_v)$(RM) $@.ctfdata | |
114 | ifeq ($(DO_CTFMERGE),1) | |
115 | @$(LOG_CTFCONVERT) "$(@F)" | |
116 | $(_v)$(CTFCONVERT) -c -l xnu -u xnu -o $@.ctf $(TARGET)/$(KERNEL_FILE_NAME).dSYM/Contents/Resources/DWARF/$(KERNEL_FILE_NAME) | |
117 | @$(LOG_CTFMERGE) "$(@F)" | |
118 | $(_v)$(CTFMERGE) -l xnu -o $@ -Z $@.ctfdata $@.ctf | |
119 | $(_v)if [ -s $@.ctfdata ]; then \ | |
120 | $(LOG_CTFINSERT) "$(@F)"; \ | |
121 | $(CTFINSERT) $@ $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \ | |
122 | $@.ctfdata -o $@; \ | |
123 | fi; | |
124 | endif | |
125 | $(_v)$(LN) $(call function_convert_build_config_to_objdir,$(CURRENT_BUILD_CONFIG))/$(KERNEL_FILE_NAME) $(OBJROOT)/$(KERNEL_FILE_NAME) | |
126 | ||
127 | $(TARGET)/$(KERNEL_FILE_NAME).dSYM: $(TARGET)/$(KERNEL_FILE_NAME).unstripped | |
128 | @$(LOG_DSYMUTIL) "$(@F)" | |
129 | $(_v)bash -c "$(DSYMUTIL) $(DSYMUTIL_FLAGS) $< -o $@ $(_vstdout) 2> >(grep -v '^warning:.*could not find object file symbol for symbol' 1>&2)" | |
130 | $(_v)$(MV) $@/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME).unstripped $@/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME) | |
131 | $(_v)$(TOUCH) $@ | |
132 | ||
133 | ifeq ($(BUILD_XNU_LIBRARY),1) | |
134 | $(TARGET)/lib$(KERNEL_FILE_NAME).a: $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST),$(component)/$(CURRENT_KERNEL_CONFIG)/$(component).libfilelist)) nonlto.o $(SRCROOT)/config/version.c $(SRCROOT)/config/MasterVersion .LDFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
135 | $(_v)${MAKE} -f $(firstword $(MAKEFILE_LIST)) version.o | |
136 | @$(LOG_LIBTOOL) "$(@F)" | |
137 | $(_v)$(CAT) $(filter %.libfilelist,$+) < /dev/null > link.filelist | |
138 | $(_v)$(LIBTOOL) -static -csD -filelist link.filelist -o $@ | |
139 | $(_v)$(LN) $(call function_convert_build_config_to_objdir,$(CURRENT_BUILD_CONFIG))/lib$(KERNEL_FILE_NAME).a $(OBJROOT)/lib$(KERNEL_FILE_NAME).a | |
140 | endif | |
141 | ||
142 | $(TARGET)/$(KERNEL_FILE_NAME).unstripped: $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST),$(component)/$(CURRENT_KERNEL_CONFIG)/$(component).filelist)) lastkerneldataconst.o lastkernelconstructor.o nonlto.o $(SRCROOT)/config/version.c $(SRCROOT)/config/MasterVersion .LDFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
143 | $(_v)${MAKE} -f $(firstword $(MAKEFILE_LIST)) version.o | |
144 | ifeq ($(PRE_LTO),1) | |
145 | @$(LOG_LTO) "$(@F)" | |
146 | $(_v)rm -f ltolink.filelist | |
147 | $(_v)rm -f nonltolink.filelist | |
148 | $(_v)files="$$($(CAT) $(filter %.filelist,$+)) version.o $(filter %.o,$+)"; \ | |
149 | for ofile in $$files; \ | |
150 | do \ | |
151 | hdr=$$(od -An -N 4 -t x4 $$ofile); \ | |
152 | if [ $$hdr == "0b17c0de" ]; \ | |
153 | then \ | |
154 | lto="$$lto$$ofile"$$'\n'; \ | |
155 | else \ | |
156 | nonlto="$$nonlto$$ofile"$$'\n'; \ | |
157 | fi; \ | |
158 | done; \ | |
159 | printf "$$lto" >ltolink.filelist; \ | |
160 | printf "$$nonlto" >nonltolink.filelist | |
161 | @$(LOG_LD) "$(@F)" | |
162 | $(_v)if [ -s ltolink.filelist ]; \ | |
163 | then \ | |
164 | $(LD) $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) -r nonlto.o -filelist ltolink.filelist $(LDFLAGS_KERNEL_LTO) -Wl,-object_path_lto,$(TARGET)/justlto.o -o $(TARGET)/justlto.tmp.o && \ | |
165 | $(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_ONLY) -filelist nonltolink.filelist $(TARGET)/justlto.o $(LDFLAGS_KERNEL_STRIP_LTO) -o $@ $(LD_KERNEL_LIBS) $(LD_KERNEL_ARCHIVES); \ | |
166 | else \ | |
167 | $(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_ONLY) -filelist nonltolink.filelist -o $@ $(LD_KERNEL_LIBS) $(LD_KERNEL_ARCHIVES); \ | |
168 | fi | |
169 | else | |
170 | @$(LOG_LD) "$(@F)" | |
171 | $(_v)$(CAT) $(filter %.filelist,$+) < /dev/null > link.filelist | |
172 | $(_v)$(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_ONLY) -filelist link.filelist version.o $(filter %.o,$+) -o $@ $(LD_KERNEL_LIBS) $(LD_KERNEL_ARCHIVES) | |
173 | endif | |
174 | ||
175 | # for now, rename LASTDATA_CONST to LAST on static kernel cache builds | |
176 | EXTRA_KC_LINKARGS = -Wl,-rename_segment,__LASTDATA_CONST,__LAST | |
177 | ||
178 | $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a: $(TARGET)/$(KERNEL_FILE_NAME).unstripped .LDFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
179 | @$(LOG_LIBTOOL) "$(@F)" | |
180 | $(_v)$(MKDIR) $(dir $@) | |
181 | ifeq ($(PRE_LTO),1) | |
182 | $(_v)$(LIBTOOL) -ca $(TARGET)/justlto.o -filelist nonltolink.filelist -o $@ | |
183 | else | |
184 | $(_v)$(LIBTOOL) -ca -filelist link.filelist version.o lastkerneldataconst.o lastkernelconstructor.o -o $@ | |
185 | endif | |
186 | $(_v)cp $(TARGET)/all-kpi.exp $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp | |
187 | $(_v)cp $(TARGET)/all-alias.exp $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp | |
188 | $(_v)echo "$(LD_KERNEL_ARCHIVES)" >$(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives | |
189 | $(_v)echo "$(LDFLAGS_KERNEL) $(LD_KERNEL_LIBS) $(EXTRA_KC_LINKARGS)" >$(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments | |
190 | $(_v)$(LN) $(call function_convert_build_config_to_objdir,$(CURRENT_BUILD_CONFIG))/$(KERNEL_FILE_NAME).link $(OBJROOT)/$(KERNEL_FILE_NAME).link | |
191 | ||
192 | nonlto.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
193 | nonlto.o: $(SRCROOT)/libsa/nonlto.c | |
194 | ${C_RULE_0} | |
195 | ${C_RULE_1A}$< $(CFLAGS_NOLTO_FLAG) | |
196 | ${C_RULE_2} | |
197 | ||
198 | -include version.d | |
199 | version.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
200 | version.o: $(OBJPATH)/version.c | |
201 | ${C_RULE_0} | |
202 | ${C_RULE_1A}$< | |
203 | ${C_RULE_2} | |
204 | ${C_RULE_4} | |
205 | ||
206 | # Always recreate version.sh | |
207 | $(OBJPATH)/version.c: $(SRCROOT)/config/version.c $(NEWVERS) $(SRCROOT)/config/MasterVersion ALWAYS | |
208 | $(_v)$(CP) $< $@ | |
209 | $(_v)$(NEWVERS) $(OBJPATH)/version.c > /dev/null; | |
210 | ||
211 | ||
212 | -include lastkerneldataconst.d | |
213 | lastkerneldataconst.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
214 | lastkerneldataconst.o: $(SRCROOT)/libsa/lastkerneldataconst.c | |
215 | ${C_RULE_0} | |
216 | ${C_RULE_1A}$< | |
217 | ${C_RULE_2} | |
218 | ||
219 | ||
220 | lastkernelconstructor.o_CFLAGS_RM = -fprofile-instr-generate | |
221 | # the LAST segment is mapped read-only on arm, so if we include llvm profiling | |
222 | # here it will segfault the kernel. (see arm_vm_init.c) We don't currently have | |
223 | # a way of retrieving these counters from LAST anyway, so there's no harm in just | |
224 | # disabling them. | |
225 | ||
226 | LAST_FILES=lastkernelconstructor.o | |
227 | -include lastkernelconstructor.d | |
228 | lastkernelconstructor.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
229 | lastkernelconstructor.o: $(SRCROOT)/libsa/lastkernelconstructor.c | |
230 | ${C_RULE_0} | |
231 | ${C_RULE_1A}$< $(CFLAGS_NOLTO_FLAG) | |
232 | ${C_RULE_2} | |
233 | ${C_RULE_3} | |
234 | ${C_RULE_4} | |
235 | $(_v)for last_file in ${LAST_FILES}; \ | |
236 | do \ | |
237 | $(SEG_HACK) -s __DATA -n __LASTDATA_CONST -o $${last_file}__ $${last_file} || exit 1; \ | |
238 | mv $${last_file}__ $${last_file} || exit 1; \ | |
239 | done | |
240 | EXTRA_KC_LINKARGS = -Wl,-rename_segment,__LASTDATA_CONST,__LAST | |
241 | ||
242 | # | |
243 | # Install rules. Each build config is classified as "primary" (the first | |
244 | # config for an architecture) or "non-primary". Primary build configs | |
245 | # have the semantic of competing to *combine* single-architecture | |
246 | # files into a multi-architecture output in the DSTROOT, like | |
247 | # $(DSTROOT)/$(KERNEL_FILE_NAME), and consequently each primary build config | |
248 | # has its install target run serially with respect to other primary | |
249 | # build configs. Non-primary build configs will never compete for | |
250 | # files in the DSTROOT or SYMROOT, and can be installed in parallel | |
251 | # with other non-primary configs (and even primary configs) | |
252 | # | |
253 | ||
254 | do_build_install_primary:: do_install_machine_specific_kernel | |
255 | ifeq ($(BUILD_DSYM),1) | |
256 | do_build_install_primary:: do_install_machine_specific_kernel_dSYM | |
257 | endif | |
258 | ||
259 | do_build_install_non_primary:: do_install_machine_specific_kernel | |
260 | ifeq ($(BUILD_DSYM),1) | |
261 | do_build_install_non_primary:: do_install_machine_specific_kernel_dSYM | |
262 | endif | |
263 | ||
264 | ifeq ($(BUILD_DSYM),1) | |
265 | ifeq ($(INSTALL_KERNEL_SYM_TO_KDK),1) | |
266 | do_build_install_primary:: do_install_machine_specific_KDK_dSYM | |
267 | do_build_install_non_primary:: do_install_machine_specific_KDK_dSYM | |
268 | endif | |
269 | endif | |
270 | ||
271 | ifneq ($(BUILD_XNU_LIBRARY),1) | |
272 | ifeq ($(INSTALL_XNU_DEBUG_FILES),1) | |
273 | do_build_install_primary:: do_install_xnu_debug_files | |
274 | endif | |
275 | ||
276 | .PHONY: do_install_xnu_debug_files | |
277 | ||
278 | do_install_xnu_debug_files: $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/README.DEBUG-kernel.txt | |
279 | @: | |
280 | endif | |
281 | ||
282 | # | |
283 | # If the timestamp indicates the DSTROOT kernel is out of | |
284 | # date, start over. Normal dependencies don't work because we can have | |
285 | # ( BUILDA, BUILDB, INSTALLB, INSTALLA ) in which case at INSTALLA time | |
286 | # the timestamps would $(DSTROOT)/$(KERNEL_FILE_NAME) is not out of date compared | |
287 | # to BUILDA. So we maintain a separate file at the time make(1) | |
288 | # was run and use it to determine what actions to take | |
289 | # | |
290 | ||
291 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME) ALWAYS | |
292 | $(_v)$(MKDIR) $(dir $@) | |
293 | @$(LOG_INSTALL) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))" | |
294 | $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \ | |
295 | $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \ | |
296 | cmdstatus=$$?; \ | |
297 | else \ | |
298 | $(LIPO) -create $@ $< -output $@; \ | |
299 | cmdstatus=$$?; \ | |
300 | fi; \ | |
301 | exit $$cmdstatus | |
302 | ||
303 | ifeq ($(BUILD_STATIC_LINK),1) | |
304 | ifeq ($(BUILD_XNU_LIBRARY),1) | |
305 | ||
306 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/lib$(KERNEL_FILE_NAME).a: $(TARGET)/lib$(KERNEL_FILE_NAME).a ALWAYS | |
307 | $(_v)$(MKDIR) $(dir $@) | |
308 | @$(LOG_INSTALL) "$(@F)" | |
309 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
310 | ||
311 | else | |
312 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a ALWAYS | |
313 | $(_v)$(MKDIR) $(dir $@) | |
314 | @$(LOG_INSTALL) "$(@F)" | |
315 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
316 | ||
317 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments ALWAYS | |
318 | $(_v)$(MKDIR) $(dir $@) | |
319 | @$(LOG_INSTALL) "$(@F)" | |
320 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
321 | ||
322 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives ALWAYS | |
323 | $(_v)$(MKDIR) $(dir $@) | |
324 | @$(LOG_INSTALL) "$(@F)" | |
325 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
326 | ||
327 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp ALWAYS | |
328 | $(_v)$(MKDIR) $(dir $@) | |
329 | @$(LOG_INSTALL) "$(@F)" | |
330 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
331 | ||
332 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp ALWAYS | |
333 | $(_v)$(MKDIR) $(dir $@) | |
334 | @$(LOG_INSTALL) "$(@F)" | |
335 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
336 | endif | |
337 | ||
338 | # BUILD_STATIC_LINK | |
339 | endif | |
340 | ||
341 | $(SYMROOT)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).unstripped ALWAYS | |
342 | $(_v)$(MKDIR) $(dir $@) | |
343 | @$(LOG_INSTALLSYM) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))" | |
344 | $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \ | |
345 | $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \ | |
346 | cmdstatus=$$?; \ | |
347 | else \ | |
348 | $(LIPO) -create $@ $< -output $@; \ | |
349 | cmdstatus=$$?; \ | |
350 | fi; \ | |
351 | exit $$cmdstatus | |
352 | ||
353 | ||
354 | $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \ | |
355 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \ | |
356 | $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros: \ | |
357 | $(TARGET)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros | |
358 | $(_v)$(MKDIR) $(dir $@) | |
359 | @$(LOG_INSTALLMACROS) "$(@F)$(Color0) $(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))" | |
360 | $(_v)$(CP) -r $< $(dir $@) | |
361 | $(_v)$(TOUCH) $@ | |
362 | ||
363 | $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \ | |
364 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \ | |
365 | $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME): \ | |
366 | $(TARGET)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) | |
367 | $(_v)$(MKDIR) $(dir $@) | |
368 | @$(LOG_INSTALLMACROS) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))" | |
369 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
370 | ||
371 | $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/README.DEBUG-kernel.txt: $(SRCROOT)/config/README.DEBUG-kernel.txt | |
372 | $(_v)$(MKDIR) $(dir $@) | |
373 | @$(LOG_INSTALL) "$(@F)" | |
374 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
375 | ||
376 | $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist: $(TARGET)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist | |
377 | $(_v)$(MKDIR) $(dir $@) | |
378 | @$(LOG_INSTALLSYM) "$(ColorL)dSYM$(Color0) $(ColorF)$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))" | |
379 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
380 | ||
381 | $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME) $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME) ALWAYS | |
382 | $(_v)$(MKDIR) $(dir $@) | |
383 | @$(LOG_INSTALLSYM) "$(ColorL)dSYM$(Color0) $(ColorF)$(@F).dSYM$(ColorF) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))" | |
384 | $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \ | |
385 | $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \ | |
386 | cmdstatus=$$?; \ | |
387 | else \ | |
388 | $(LIPO) -create $@ $< -output $@; \ | |
389 | cmdstatus=$$?; \ | |
390 | fi; \ | |
391 | exit $$cmdstatus | |
392 | ||
393 | .PHONY: do_install_machine_specific_kernel do_install_machine_specific_kernel_dSYM | |
394 | .PHONY: do_install_machine_specific_KDK_dSYM | |
395 | ||
396 | ifeq ($(BUILD_XNU_LIBRARY),1) | |
397 | ||
398 | do_install_machine_specific_kernel: $(KERNEL_STATIC_LINK_DST) | |
399 | @: | |
400 | do_install_machine_specific_kernel_dSYM: | |
401 | @: | |
402 | ||
403 | else | |
404 | ||
405 | do_install_machine_specific_kernel: $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME) \ | |
406 | $(SYMROOT)/$(KERNEL_FILE_NAME) \ | |
407 | $(KERNEL_STATIC_LINK_DST) | |
408 | @: | |
409 | ||
410 | do_install_machine_specific_kernel_dSYM: \ | |
411 | $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist \ | |
412 | $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \ | |
413 | $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \ | |
414 | $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME) | |
415 | @: | |
416 | ||
417 | do_install_machine_specific_KDK_dSYM: \ | |
418 | $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist \ | |
419 | $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \ | |
420 | $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \ | |
421 | $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME) | |
422 | @: | |
423 | ||
424 | endif | |
425 | ||
426 | # The $(RM) is needed so that the $(LN) doesn't dereference an existing | |
427 | # symlink during incremental builds and create a new symlink inside | |
428 | # the target of the existing symlink | |
429 | do_installhdrs_mi:: $(DSTROOT)/$(KRESDIR)/Info.plist | |
430 | ifneq ($(INSTALLHDRS_SKIP_HOST),YES) | |
431 | $(_v)$(MKDIR) $(DSTROOT)/$(KINCFRAME) | |
432 | $(_v)$(MKDIR) $(DSTROOT)/$(KPINCDIR) | |
433 | $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR) | |
434 | $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Versions/Current | |
435 | $(_v)$(LN) $(KINCVERS) $(DSTROOT)/$(KINCFRAME)/Versions/Current | |
436 | $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Headers | |
437 | $(_v)$(LN) Versions/Current/Headers \ | |
438 | $(DSTROOT)/$(KINCFRAME)/Headers | |
439 | $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/PrivateHeaders | |
440 | $(_v)$(LN) Versions/Current/PrivateHeaders \ | |
441 | $(DSTROOT)/$(KINCFRAME)/PrivateHeaders | |
442 | $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Resources | |
443 | $(_v)$(LN) Versions/Current/Resources \ | |
444 | $(DSTROOT)/$(KINCFRAME)/Resources | |
445 | endif | |
446 | ||
447 | $(DSTROOT)/$(KRESDIR)/Info.plist: $(SOURCE)/EXTERNAL_HEADERS/Info.plist | |
448 | ifneq ($(INSTALLHDRS_SKIP_HOST),YES) | |
449 | $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR) | |
450 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
451 | $(_v)$(NEWVERS) $@ $(_vstdout) | |
452 | ifeq ($(USE_BINARY_PLIST),1) | |
453 | $(_v)$(PLUTIL) -convert binary1 -o $@ $@ | |
454 | endif | |
455 | endif | |
456 | ||
457 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(ALIAS_FILE_NAME): ALWAYS | |
458 | @$(LOG_ALIAS) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0) $(ColorLF)$(CURRENT_MACHINE_CONFIG_LC)$(Color0) $(ColorLF)$(CURRENT_ALIAS_MACHINE_CONFIG_LC)$(Color0))" | |
459 | $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME) $@ | |
460 | ||
461 | install_alias: $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(ALIAS_FILE_NAME) | |
462 | ||
463 | print_exports: | |
464 | $(_v)printenv | sort | |
465 | ||
466 | # vim: set ft=make: |