]> git.saurik.com Git - apple/xnu.git/blob - makedefs/MakeInc.kernel
f630a4ba05a9f23c1129ab7484a8c329e940d874
[apple/xnu.git] / makedefs / MakeInc.kernel
1 # -*- mode: makefile;-*-
2 #
3 # Copyright (C) 1999-2016 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 4 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
55 ifeq ($(BUILD_STATIC_LINK),1)
56
57 KERNEL_STATIC_LINK_TARGETS = \
58 $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a
59
60 KERNEL_STATIC_LINK_DST = \
61 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a \
62 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments \
63 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives \
64 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp \
65 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp \
66 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
67 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME)
68
69 endif
70
71 do_build_all:: do_build_kernel
72
73 .PHONY: do_build_kernel
74
75 do_build_kernel: $(TARGET)/$(KERNEL_FILE_NAME) $(TARGET)/$(KERNEL_FILE_NAME).unstripped $(KERNEL_STATIC_LINK_TARGETS)
76 @:
77
78 ifeq ($(BUILD_DSYM),1)
79 do_build_all:: do_build_kernel_dSYM
80 endif
81
82 .PHONY: do_build_kernel_dSYM
83
84 do_build_kernel_dSYM: $(TARGET)/$(KERNEL_FILE_NAME).dSYM
85 @:
86
87 .LDFLAGS: ALWAYS
88 $(_v)$(REPLACECONTENTS) $@ $(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_ONLY) $(LD_KERNEL_LIBS)
89 .CFLAGS: ALWAYS
90 $(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS)
91
92 $(TARGET)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).unstripped $(TARGET)/$(KERNEL_FILE_NAME).dSYM
93 @$(LOG_STRIP) "$(@F)"
94 $(_v)$(STRIP) $(STRIP_FLAGS) $< -o $@
95 @echo "built kernel at $@"
96 $(_v)$(RM) $@.ctfdata
97 ifeq ($(DO_CTFMERGE),1)
98 @$(LOG_CTFCONVERT) "$(@F)"
99 $(_v)$(CTFCONVERT) -c -l xnu -u xnu -o $@.ctf $(TARGET)/$(KERNEL_FILE_NAME).dSYM/Contents/Resources/DWARF/$(KERNEL_FILE_NAME)
100 @$(LOG_CTFMERGE) "$(@F)"
101 $(_v)$(CTFMERGE) -l xnu -o $@ -Z $@.ctfdata $@.ctf
102 $(_v)if [ -s $@.ctfdata ]; then \
103 $(LOG_CTFINSERT) "$(@F)"; \
104 $(CTFINSERT) $@ $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
105 $@.ctfdata -o $@; \
106 fi;
107 endif
108 $(_v)$(LN) $(call function_convert_build_config_to_objdir,$(CURRENT_BUILD_CONFIG))/$(KERNEL_FILE_NAME) $(OBJROOT)/$(KERNEL_FILE_NAME)
109
110 $(TARGET)/$(KERNEL_FILE_NAME).dSYM: $(TARGET)/$(KERNEL_FILE_NAME).unstripped
111 @$(LOG_DSYMUTIL) "$(@F)"
112 $(_v)bash -c "$(DSYMUTIL) $(DSYMUTIL_FLAGS) $< -o $@ $(_vstdout) 2> >(grep -v '^warning:.*could not find object file symbol for symbol' 1>&2)"
113 $(_v)$(MV) $@/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME).unstripped $@/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME)
114 $(_v)$(TOUCH) $@
115
116 $(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))
117 $(_v)${MAKE} -f $(firstword $(MAKEFILE_LIST)) version.o
118 ifeq ($(PRE_LTO),1)
119 @$(LOG_LTO) "$(@F)"
120 $(_v)rm -f ltolink.filelist
121 $(_v)rm -f nonltolink.filelist
122 $(_v)files="$$($(CAT) $(filter %.filelist,$+)) version.o $(filter %.o,$+)"; \
123 for ofile in $$files; \
124 do \
125 hdr=$$(od -An -N 4 -t x4 $$ofile); \
126 if [ $$hdr == "0b17c0de" ]; \
127 then \
128 lto="$$lto$$ofile"$$'\n'; \
129 else \
130 nonlto="$$nonlto$$ofile"$$'\n'; \
131 fi; \
132 done; \
133 printf "$$lto" >ltolink.filelist; \
134 printf "$$nonlto" >nonltolink.filelist
135 @$(LOG_LD) "$(@F)"
136 $(_v)if [ -s ltolink.filelist ]; \
137 then \
138 $(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 && \
139 $(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_ONLY) -filelist nonltolink.filelist $(TARGET)/justlto.o $(LDFLAGS_KERNEL_STRIP_LTO) -o $@ $(LD_KERNEL_LIBS) $(LD_KERNEL_ARCHIVES); \
140 else \
141 $(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_ONLY) -filelist nonltolink.filelist -o $@ $(LD_KERNEL_LIBS) $(LD_KERNEL_ARCHIVES); \
142 fi
143 else
144 @$(LOG_LD) "$(@F)"
145 $(_v)$(CAT) $(filter %.filelist,$+) < /dev/null > link.filelist
146 $(_v)$(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_ONLY) -filelist link.filelist version.o $(filter %.o,$+) -o $@ $(LD_KERNEL_LIBS) $(LD_KERNEL_ARCHIVES)
147 endif
148
149 # for now, rename LASTDATA_CONST to LAST on static kernel cache builds
150 EXTRA_KC_LINKARGS = -Wl,-rename_segment,__LASTDATA_CONST,__LAST
151
152 $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a: $(TARGET)/$(KERNEL_FILE_NAME).unstripped .LDFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
153 @$(LOG_LIBTOOL) "$(@F)"
154 $(_v)$(MKDIR) $(dir $@)
155 ifeq ($(PRE_LTO),1)
156 $(_v)$(LIBTOOL) -ca $(TARGET)/justlto.o -filelist nonltolink.filelist -o $@
157 else
158 $(_v)$(LIBTOOL) -ca -filelist link.filelist version.o lastkerneldataconst.o lastkernelconstructor.o -o $@
159 endif
160 $(_v)cp $(TARGET)/all-kpi.exp $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp
161 $(_v)cp $(TARGET)/all-alias.exp $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp
162 $(_v)echo "$(LD_KERNEL_ARCHIVES)" >$(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives
163 $(_v)echo "$(LDFLAGS_KERNEL) $(LD_KERNEL_LIBS) $(EXTRA_KC_LINKARGS)" >$(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments
164 $(_v)$(LN) $(call function_convert_build_config_to_objdir,$(CURRENT_BUILD_CONFIG))/$(KERNEL_FILE_NAME).link $(OBJROOT)/$(KERNEL_FILE_NAME).link
165
166 nonlto.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
167 nonlto.o: $(SRCROOT)/libsa/nonlto.c
168 ${C_RULE_0}
169 ${C_RULE_1A}$< $(CFLAGS_NOLTO_FLAG)
170 ${C_RULE_2}
171
172 -include version.d
173 version.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
174 version.o: $(OBJPATH)/version.c
175 ${C_RULE_0}
176 ${C_RULE_1A}$<
177 ${C_RULE_2}
178 ${C_RULE_4}
179
180 # Always recreate version.sh
181 $(OBJPATH)/version.c: $(SRCROOT)/config/version.c $(NEWVERS) $(SRCROOT)/config/MasterVersion ALWAYS
182 $(_v)$(CP) $< $@
183 $(_v)$(NEWVERS) $(OBJPATH)/version.c > /dev/null;
184
185
186 -include lastkerneldataconst.d
187 lastkerneldataconst.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
188 lastkerneldataconst.o: $(SRCROOT)/libsa/lastkerneldataconst.c
189 ${C_RULE_0}
190 ${C_RULE_1A}$<
191 ${C_RULE_2}
192
193
194 lastkernelconstructor.o_CFLAGS_RM = -fprofile-instr-generate
195 # the LAST segment is mapped read-only on arm, so if we include llvm profiling
196 # here it will segfault the kernel. (see arm_vm_init.c) We don't currently have
197 # a way of retrieving these counters from LAST anyway, so there's no harm in just
198 # disabling them.
199
200 LAST_FILES=lastkernelconstructor.o
201 -include lastkernelconstructor.d
202 lastkernelconstructor.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
203 lastkernelconstructor.o: $(SRCROOT)/libsa/lastkernelconstructor.c
204 ${C_RULE_0}
205 ${C_RULE_1A}$< $(CFLAGS_NOLTO_FLAG)
206 ${C_RULE_2}
207 ${C_RULE_3}
208 ${C_RULE_4}
209 $(_v)for last_file in ${LAST_FILES}; \
210 do \
211 $(SEG_HACK) -s __DATA -n __LASTDATA_CONST -o $${last_file}__ $${last_file} || exit 1; \
212 mv $${last_file}__ $${last_file} || exit 1; \
213 done
214 EXTRA_KC_LINKARGS = -Wl,-rename_segment,__LASTDATA_CONST,__LAST
215
216 #
217 # Install rules. Each build config is classified as "primary" (the first
218 # config for an architecture) or "non-primary". Primary build configs
219 # have the semantic of competing to *combine* single-architecture
220 # files into a multi-architecture output in the DSTROOT, like
221 # $(DSTROOT)/$(KERNEL_FILE_NAME), and consequently each primary build config
222 # has its install target run serially with respect to other primary
223 # build configs. Non-primary build configs will never compete for
224 # files in the DSTROOT or SYMROOT, and can be installed in parallel
225 # with other non-primary configs (and even primary configs)
226 #
227
228 do_build_install_primary:: do_install_machine_specific_kernel
229 ifeq ($(BUILD_DSYM),1)
230 do_build_install_primary:: do_install_machine_specific_kernel_dSYM
231 endif
232
233 do_build_install_non_primary:: do_install_machine_specific_kernel
234 ifeq ($(BUILD_DSYM),1)
235 do_build_install_non_primary:: do_install_machine_specific_kernel_dSYM
236 endif
237
238 ifeq ($(BUILD_DSYM),1)
239 ifeq ($(INSTALL_KERNEL_SYM_TO_KDK),1)
240 do_build_install_primary:: do_install_machine_specific_KDK_dSYM
241 do_build_install_non_primary:: do_install_machine_specific_KDK_dSYM
242 endif
243 endif
244
245 ifeq ($(INSTALL_XNU_DEBUG_FILES),1)
246 do_build_install_primary:: do_install_xnu_debug_files
247 endif
248
249 .PHONY: do_install_xnu_debug_files
250
251 do_install_xnu_debug_files: $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/README.DEBUG-kernel.txt
252 @:
253
254 #
255 # If the timestamp indicates the DSTROOT kernel is out of
256 # date, start over. Normal dependencies don't work because we can have
257 # ( BUILDA, BUILDB, INSTALLB, INSTALLA ) in which case at INSTALLA time
258 # the timestamps would $(DSTROOT)/$(KERNEL_FILE_NAME) is not out of date compared
259 # to BUILDA. So we maintain a separate file at the time make(1)
260 # was run and use it to determine what actions to take
261 #
262
263 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME) ALWAYS
264 $(_v)$(MKDIR) $(dir $@)
265 @$(LOG_INSTALL) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
266 $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \
267 $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \
268 cmdstatus=$$?; \
269 else \
270 $(LIPO) -create $@ $< -output $@; \
271 cmdstatus=$$?; \
272 fi; \
273 exit $$cmdstatus
274
275 ifeq ($(BUILD_STATIC_LINK),1)
276
277 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a ALWAYS
278 $(_v)$(MKDIR) $(dir $@)
279 @$(LOG_INSTALL) "$(@F)"
280 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
281
282 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments ALWAYS
283 $(_v)$(MKDIR) $(dir $@)
284 @$(LOG_INSTALL) "$(@F)"
285 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
286
287 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives ALWAYS
288 $(_v)$(MKDIR) $(dir $@)
289 @$(LOG_INSTALL) "$(@F)"
290 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
291
292 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp ALWAYS
293 $(_v)$(MKDIR) $(dir $@)
294 @$(LOG_INSTALL) "$(@F)"
295 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
296
297 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp ALWAYS
298 $(_v)$(MKDIR) $(dir $@)
299 @$(LOG_INSTALL) "$(@F)"
300 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
301
302 # BUILD_STATIC_LINK
303 endif
304
305 $(SYMROOT)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).unstripped ALWAYS
306 $(_v)$(MKDIR) $(dir $@)
307 @$(LOG_INSTALLSYM) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
308 $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \
309 $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \
310 cmdstatus=$$?; \
311 else \
312 $(LIPO) -create $@ $< -output $@; \
313 cmdstatus=$$?; \
314 fi; \
315 exit $$cmdstatus
316
317
318 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
319 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
320 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros: \
321 $(TARGET)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros
322 $(_v)$(MKDIR) $(dir $@)
323 @$(LOG_INSTALLMACROS) "$(@F)$(Color0) $(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
324 $(_v)$(CP) -r $< $(dir $@)
325 $(_v)$(TOUCH) $@
326
327 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \
328 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \
329 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME): \
330 $(TARGET)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME)
331 $(_v)$(MKDIR) $(dir $@)
332 @$(LOG_INSTALLMACROS) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
333 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
334
335 $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/README.DEBUG-kernel.txt: $(SRCROOT)/config/README.DEBUG-kernel.txt
336 $(_v)$(MKDIR) $(dir $@)
337 @$(LOG_INSTALL) "$(@F)"
338 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
339
340 $(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
341 $(_v)$(MKDIR) $(dir $@)
342 @$(LOG_INSTALLSYM) "$(ColorL)dSYM$(Color0) $(ColorF)$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
343 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
344
345 $(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
346 $(_v)$(MKDIR) $(dir $@)
347 @$(LOG_INSTALLSYM) "$(ColorL)dSYM$(Color0) $(ColorF)$(@F).dSYM$(ColorF) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))"
348 $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \
349 $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \
350 cmdstatus=$$?; \
351 else \
352 $(LIPO) -create $@ $< -output $@; \
353 cmdstatus=$$?; \
354 fi; \
355 exit $$cmdstatus
356
357 .PHONY: do_install_machine_specific_kernel do_install_machine_specific_kernel_dSYM
358
359 do_install_machine_specific_kernel: $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME) \
360 $(SYMROOT)/$(KERNEL_FILE_NAME) \
361 $(KERNEL_STATIC_LINK_DST)
362 @:
363
364 do_install_machine_specific_kernel_dSYM: \
365 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist \
366 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
367 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \
368 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME)
369 @:
370
371 .PHONY: do_install_machine_specific_KDK_dSYM
372
373 do_install_machine_specific_KDK_dSYM: \
374 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist \
375 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
376 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \
377 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME)
378 @:
379
380 # The $(RM) is needed so that the $(LN) doesn't dereference an existing
381 # symlink during incremental builds and create a new symlink inside
382 # the target of the existing symlink
383 do_installhdrs_mi:: $(DSTROOT)/$(KRESDIR)/Info.plist
384 ifneq ($(INSTALLHDRS_SKIP_HOST),YES)
385 $(_v)$(MKDIR) $(DSTROOT)/$(KINCFRAME)
386 $(_v)$(MKDIR) $(DSTROOT)/$(KPINCDIR)
387 $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR)
388 $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Versions/Current
389 $(_v)$(LN) $(KINCVERS) $(DSTROOT)/$(KINCFRAME)/Versions/Current
390 $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Headers
391 $(_v)$(LN) Versions/Current/Headers \
392 $(DSTROOT)/$(KINCFRAME)/Headers
393 $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/PrivateHeaders
394 $(_v)$(LN) Versions/Current/PrivateHeaders \
395 $(DSTROOT)/$(KINCFRAME)/PrivateHeaders
396 $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Resources
397 $(_v)$(LN) Versions/Current/Resources \
398 $(DSTROOT)/$(KINCFRAME)/Resources
399 endif
400
401 $(DSTROOT)/$(KRESDIR)/Info.plist: $(SOURCE)/EXTERNAL_HEADERS/Info.plist
402 ifneq ($(INSTALLHDRS_SKIP_HOST),YES)
403 $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR)
404 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
405 $(_v)$(NEWVERS) $@ $(_vstdout)
406 ifeq ($(USE_BINARY_PLIST),1)
407 $(_v)$(PLUTIL) -convert binary1 -o $@ $@
408 endif
409 endif
410
411 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(ALIAS_FILE_NAME): ALWAYS
412 @$(LOG_ALIAS) "$(@F)$(Color0) ($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0) $(ColorLF)$(CURRENT_MACHINE_CONFIG_LC)$(Color0) $(ColorLF)$(CURRENT_ALIAS_MACHINE_CONFIG_LC)$(Color0))"
413 $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME) $@
414
415 install_alias: $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(ALIAS_FILE_NAME)
416
417 print_exports:
418 $(_v)printenv | sort