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