]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.kernel
xnu-4903.270.47.tar.gz
[apple/xnu.git] / makedefs / MakeInc.kernel
CommitLineData
39236c6e
A
1# -*- mode: makefile;-*-
2#
39037602 3# Copyright (C) 1999-2016 Apple Inc. All rights reserved.
39236c6e
A
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
3e170ce0
A
29ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
30do_build_setup::
31 $(_v)$(CAT) > $(OBJPATH)/compile_commands.json < /dev/null
32endif
33
39236c6e
A
34#
35# Rules for the highly parallel "build" phase, where each build configuration
36# writes into their own $(TARGET) independent of other build configs
37#
fe8ab488
A
38# There are 3 primary build outputs:
39# 1) $(KERNEL_FILE_NAME).unstripped (raw linked kernel, unstripped)
40# 2) $(KERNEL_FILE_NAME) (stripped kernel, with optional CTF data)
41# 3) $(KERNEL_FILE_NAME).dSYM (dSYM)
d9a64523
A
42# 4) $(KERNEL_FILE_NAME).link (bits for static linking)
43
44ifeq ($(BUILD_STATIC_LINK),1)
45
46KERNEL_STATIC_LINK_TARGETS = \
47 $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a
48
49KERNEL_STATIC_LINK_DST = \
50 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a \
51 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments \
52 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives \
53 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp \
54 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp \
55 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
56 $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME)
57
58endif
39236c6e 59
fe8ab488 60do_build_all:: do_build_kernel
39236c6e 61
fe8ab488 62.PHONY: do_build_kernel
39236c6e 63
d9a64523 64do_build_kernel: $(TARGET)/$(KERNEL_FILE_NAME) $(TARGET)/$(KERNEL_FILE_NAME).unstripped $(KERNEL_STATIC_LINK_TARGETS)
fe8ab488 65 @:
39236c6e
A
66
67ifeq ($(BUILD_DSYM),1)
fe8ab488 68do_build_all:: do_build_kernel_dSYM
39236c6e
A
69endif
70
fe8ab488 71.PHONY: do_build_kernel_dSYM
39236c6e 72
39037602 73do_build_kernel_dSYM: $(TARGET)/$(KERNEL_FILE_NAME).dSYM
39236c6e
A
74 @:
75
fe8ab488 76.LDFLAGS: ALWAYS
d9a64523 77 $(_v)$(REPLACECONTENTS) $@ $(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_EXPORTS) $(LD_KERNEL_LIBS)
fe8ab488
A
78.CFLAGS: ALWAYS
79 $(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS)
80
81$(TARGET)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).unstripped
39037602 82 @echo "$(ColorH)STRIP$(Color0) $(ColorLF)$(@F)$(Color0)"
39236c6e
A
83 $(_v)$(STRIP) $(STRIP_FLAGS) $< -o $@
84 $(_v)$(RM) $@.ctfdata
85ifeq ($(DO_CTFMERGE),1)
39037602
A
86 @echo "$(ColorH)CTFMERGE$(Color0) $(ColorLF)$(@F)$(Color0)"
87 $(_v)$(FIND) $(TARGET)/ -name \*.ctf -size +0 | \
39236c6e
A
88 $(XARGS) $(CTFMERGE) -l xnu -o $@ -Z $@.ctfdata || true
89endif
90 $(_v)if [ -s $@.ctfdata ]; then \
39037602
A
91 echo "$(ColorH)CTFINSERT$(Color0) $(ColorLF)$(@F)$(Color0)"; \
92 $(CTFINSERT) $@ $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
39236c6e
A
93 $@.ctfdata -o $@; \
94 fi;
fe8ab488 95 $(_v)$(LN) $(call function_convert_build_config_to_objdir,$(CURRENT_BUILD_CONFIG))/$(KERNEL_FILE_NAME) $(OBJROOT)/$(KERNEL_FILE_NAME)
39236c6e 96
fe8ab488 97$(TARGET)/$(KERNEL_FILE_NAME).dSYM: $(TARGET)/$(KERNEL_FILE_NAME).unstripped
39037602 98 $(_v)echo "$(ColorH)DSYMUTIL$(Color0) $(ColorLF)$(@F)$(Color0)"
39236c6e 99 $(_v)$(DSYMUTIL) $(DSYMUTIL_FLAGS) $< -o $@
fe8ab488 100 $(_v)$(MV) $@/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME).unstripped $@/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME)
39236c6e
A
101 $(_v)$(TOUCH) $@
102
3e170ce0 103$(TARGET)/$(KERNEL_FILE_NAME).unstripped: $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST),$(component)/$(CURRENT_KERNEL_CONFIG)/$(component).filelist)) lastkerneldataconst.o lastkernelconstructor.o $(SRCROOT)/config/version.c $(SRCROOT)/config/MasterVersion .LDFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
39236c6e 104 $(_v)${MAKE} -f $(firstword $(MAKEFILE_LIST)) version.o
39037602 105 @echo "$(ColorL)LD$(Color0) $(ColorLF)$(@F)$(Color0)"
39236c6e 106 $(_v)$(CAT) $(filter %.filelist,$+) < /dev/null > link.filelist
d9a64523
A
107 $(_v)$(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_EXPORTS) -filelist link.filelist version.o $(filter %.o,$+) -o $@ $(LD_KERNEL_LIBS) $(LD_KERNEL_ARCHIVES)
108
109$(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a: $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST),$(component)/$(CURRENT_KERNEL_CONFIG)/$(component).filelist)) lastkerneldataconst.o lastkernelconstructor.o $(TARGET)/$(KERNEL_FILE_NAME).unstripped .LDFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
110 @echo "$(ColorL)LIBTOOL$(Color0) $(ColorLF)$(@F)$(Color0)"
111 $(_v)$(MKDIR) $(dir $@)
112 $(_v)$(CAT) $(filter %.filelist,$+) < /dev/null > libtool.filelist
113 $(_v)$(LIBTOOL) -ca -filelist libtool.filelist $(filter %.o,$+) version.o -o $@
114 $(_v)cp $(TARGET)/all-kpi.exp $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp
115 $(_v)cp $(TARGET)/all-alias.exp $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp
116 $(_v)echo "$(LD_KERNEL_ARCHIVES)" >$(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives
117 $(_v)echo "$(LDFLAGS_KERNEL) $(LD_KERNEL_LIBS)" >$(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments
118 $(_v)$(LN) $(call function_convert_build_config_to_objdir,$(CURRENT_BUILD_CONFIG))/$(KERNEL_FILE_NAME).link $(OBJROOT)/$(KERNEL_FILE_NAME).link
39236c6e 119
fe8ab488
A
120-include version.d
121version.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
39236c6e 122version.o: $(OBJPATH)/version.c
fe8ab488 123 ${C_RULE_0}
39236c6e
A
124 ${C_RULE_1A}$<
125 ${C_RULE_2}
126 ${C_RULE_4}
127
128# Always recreate version.sh
129$(OBJPATH)/version.c: $(SRCROOT)/config/version.c $(NEWVERS) $(SRCROOT)/config/MasterVersion ALWAYS
130 $(_v)$(CP) $< $@
131 $(_v)$(NEWVERS) $(OBJPATH)/version.c > /dev/null;
132
d9a64523 133
3e170ce0
A
134-include lastkerneldataconst.d
135lastkerneldataconst.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
136lastkerneldataconst.o: $(SRCROOT)/libsa/lastkerneldataconst.c
137 ${C_RULE_0}
138 ${C_RULE_1A}$<
139 ${C_RULE_2}
140
141
142lastkernelconstructor.o_CFLAGS_RM = -fprofile-instr-generate
143# the LAST segment is mapped read-only on arm, so if we include llvm profiling
144# here it will segfault the kernel. (see arm_vm_init.c) We don't currently have
145# a way of retrieving these counters from LAST anyway, so there's no harm in just
146# disabling them.
147
148LAST_FILES=lastkernelconstructor.o
fe8ab488
A
149-include lastkernelconstructor.d
150lastkernelconstructor.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST))
39236c6e 151lastkernelconstructor.o: $(SRCROOT)/libsa/lastkernelconstructor.c
fe8ab488 152 ${C_RULE_0}
39236c6e
A
153 ${C_RULE_1A}$< $(CFLAGS_NOLTO_FLAG)
154 ${C_RULE_2}
155 ${C_RULE_3}
156 ${C_RULE_4}
3e170ce0 157 $(_v)for last_file in ${LAST_FILES}; \
39037602 158 do \
3e170ce0
A
159 $(SEG_HACK) -s __DATA -n __LAST -o $${last_file}__ $${last_file} || exit 1; \
160 mv $${last_file}__ $${last_file} || exit 1; \
161 done
39236c6e 162
39236c6e
A
163#
164# Install rules. Each build config is classified as "primary" (the first
165# config for an architecture) or "non-primary". Primary build configs
166# have the semantic of competing to *combine* single-architecture
167# files into a multi-architecture output in the DSTROOT, like
fe8ab488 168# $(DSTROOT)/$(KERNEL_FILE_NAME), and consequently each primary build config
39236c6e
A
169# has its install target run serially with respect to other primary
170# build configs. Non-primary build configs will never compete for
171# files in the DSTROOT or SYMROOT, and can be installed in parallel
172# with other non-primary configs (and even primary configs)
173#
174
39236c6e
A
175do_build_install_primary:: do_install_machine_specific_kernel
176ifeq ($(BUILD_DSYM),1)
177do_build_install_primary:: do_install_machine_specific_kernel_dSYM
178endif
39236c6e
A
179
180do_build_install_non_primary:: do_install_machine_specific_kernel
181ifeq ($(BUILD_DSYM),1)
182do_build_install_non_primary:: do_install_machine_specific_kernel_dSYM
183endif
184
185ifeq ($(BUILD_DSYM),1)
186ifeq ($(INSTALL_KERNEL_SYM_TO_KDK),1)
187do_build_install_primary:: do_install_machine_specific_KDK_dSYM
188do_build_install_non_primary:: do_install_machine_specific_KDK_dSYM
189endif
190endif
191
192ifeq ($(INSTALL_XNU_DEBUG_FILES),1)
193do_build_install_primary:: do_install_xnu_debug_files
39236c6e
A
194endif
195
fe8ab488 196.PHONY: do_install_xnu_debug_files
39236c6e
A
197
198do_install_xnu_debug_files: $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/README.DEBUG-kernel.txt
199 @:
200
39236c6e
A
201#
202# If the timestamp indicates the DSTROOT kernel is out of
203# date, start over. Normal dependencies don't work because we can have
204# ( BUILDA, BUILDB, INSTALLB, INSTALLA ) in which case at INSTALLA time
fe8ab488 205# the timestamps would $(DSTROOT)/$(KERNEL_FILE_NAME) is not out of date compared
39236c6e
A
206# to BUILDA. So we maintain a separate file at the time make(1)
207# was run and use it to determine what actions to take
208#
209
fe8ab488 210$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME) ALWAYS
39236c6e 211 $(_v)$(MKDIR) $(dir $@)
fe8ab488 212 $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \
39037602 213 echo "$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0) $(ColorLF)$(CURRENT_MACHINE_CONFIG_LC)$(Color0))\""; \
fe8ab488
A
214 $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \
215 cmdstatus=$$?; \
216 else \
39037602 217 echo "$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0) $(ColorLF)$(CURRENT_MACHINE_CONFIG_LC)$(Color0))\""; \
fe8ab488
A
218 $(LIPO) -create $@ $< -output $@; \
219 cmdstatus=$$?; \
220 fi; \
39236c6e
A
221 exit $$cmdstatus
222
d9a64523
A
223ifeq ($(BUILD_STATIC_LINK),1)
224
225$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a ALWAYS
226 $(_v)$(MKDIR) $(dir $@)
227 @echo "$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)"
228 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
229
230$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarguments ALWAYS
231 $(_v)$(MKDIR) $(dir $@)
232 @echo "$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)"
233 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
234
235$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).linkarchives ALWAYS
236 $(_v)$(MKDIR) $(dir $@)
237 @echo "$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)"
238 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
239
240$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).exp ALWAYS
241 $(_v)$(MKDIR) $(dir $@)
242 @echo "$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)"
243 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
244
245$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp: $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).alias.exp ALWAYS
246 $(_v)$(MKDIR) $(dir $@)
247 @echo "$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)"
248 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
249
250# BUILD_STATIC_LINK
251endif
252
fe8ab488 253$(SYMROOT)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).unstripped ALWAYS
39236c6e
A
254 $(_v)$(MKDIR) $(dir $@)
255 $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \
39037602 256 echo "$(ColorH)INSTALLSYM$(Color0) $(ColorF)$(@F)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""; \
39236c6e
A
257 $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \
258 cmdstatus=$$?; \
259 else \
39037602 260 echo "$(ColorH)INSTALLSYM$(Color0) $(ColorF)$(@F)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""; \
39236c6e
A
261 $(LIPO) -create $@ $< -output $@; \
262 cmdstatus=$$?; \
263 fi; \
264 exit $$cmdstatus
265
d9a64523
A
266
267$(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
268$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
269$(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros: \
270$(TARGET)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros
39236c6e 271 $(_v)$(MKDIR) $(dir $@)
39037602 272 @echo "$(ColorH)INSTALLMACROS$(Color0) $(ColorF)$(@F)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
39236c6e
A
273 $(_v)$(CP) -r $< $(dir $@)
274 $(_v)$(TOUCH) $@
275
d9a64523
A
276$(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \
277$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \
278$(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME): \
279$(TARGET)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME)
39236c6e 280 $(_v)$(MKDIR) $(dir $@)
39037602 281 @echo "$(ColorH)INSTALLMACROS$(Color0) $(ColorF)$(@F)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
39236c6e
A
282 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
283
284$(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/README.DEBUG-kernel.txt: $(SRCROOT)/config/README.DEBUG-kernel.txt
285 $(_v)$(MKDIR) $(dir $@)
39037602 286 @echo "$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)"
39236c6e
A
287 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
288
fe8ab488 289$(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
39236c6e 290 $(_v)$(MKDIR) $(dir $@)
39037602 291 @echo "$(ColorH)INSTALLSYM$(Color0) $(ColorL)dSYM$(Color0) $(ColorF)$(@F)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""
39236c6e
A
292 $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
293
fe8ab488 294$(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
39236c6e
A
295 $(_v)$(MKDIR) $(dir $@)
296 $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \
39037602
A
297 echo "$(ColorH)INSTALLSYM$(Color0) $(ColorL)dSYM$(Color0) $(ColorF)$(@F).dSYM$(ColorF) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""; \
298 $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \
299 cmdstatus=$$?; \
39236c6e 300 else \
39037602
A
301 echo "$(ColorH)INSTALLSYM$(Color0) $(ColorL)dSYM$(Color0) $(ColorF)$(@F).dSYM$(ColorF) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\""; \
302 $(LIPO) -create $@ $< -output $@; \
303 cmdstatus=$$?; \
39236c6e
A
304 fi; \
305 exit $$cmdstatus
306
307.PHONY: do_install_machine_specific_kernel do_install_machine_specific_kernel_dSYM
308
d9a64523
A
309do_install_machine_specific_kernel: $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME) \
310 $(SYMROOT)/$(KERNEL_FILE_NAME) \
311 $(KERNEL_STATIC_LINK_DST)
39236c6e
A
312 @:
313
314do_install_machine_specific_kernel_dSYM: \
fe8ab488
A
315 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist \
316 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
317 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \
318 $(SYMROOT)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME)
39236c6e
A
319 @:
320
321.PHONY: do_install_machine_specific_KDK_dSYM
322
323do_install_machine_specific_KDK_dSYM: \
fe8ab488
A
324 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMINFODIR)/Info.plist \
325 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/lldbmacros \
326 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMLLDBMACROSDIR)/$(KERNEL_LLDBBOOTSTRAP_NAME) \
327 $(DSTROOT)/$(INSTALL_KERNEL_SYM_DIR)/$(KERNEL_FILE_NAME).dSYM/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME)
39236c6e
A
328 @:
329
39236c6e
A
330# The $(RM) is needed so that the $(LN) doesn't dereference an existing
331# symlink during incremental builds and create a new symlink inside
332# the target of the existing symlink
fe8ab488 333do_installhdrs_mi:: $(DSTROOT)/$(KRESDIR)/Info.plist
39236c6e
A
334 $(_v)$(MKDIR) $(DSTROOT)/$(KINCFRAME)
335 $(_v)$(MKDIR) $(DSTROOT)/$(KPINCDIR)
fe8ab488 336 $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR)
39236c6e
A
337 $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Versions/Current
338 $(_v)$(LN) $(KINCVERS) $(DSTROOT)/$(KINCFRAME)/Versions/Current
339 $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Headers
340 $(_v)$(LN) Versions/Current/Headers \
341 $(DSTROOT)/$(KINCFRAME)/Headers
342 $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/PrivateHeaders
343 $(_v)$(LN) Versions/Current/PrivateHeaders \
344 $(DSTROOT)/$(KINCFRAME)/PrivateHeaders
fe8ab488
A
345 $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Resources
346 $(_v)$(LN) Versions/Current/Resources \
347 $(DSTROOT)/$(KINCFRAME)/Resources
39236c6e
A
348
349$(DSTROOT)/$(KRESDIR)/Info.plist: $(SOURCE)/EXTERNAL_HEADERS/Info.plist
350 $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR)
351 $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@
352 $(_v)$(NEWVERS) $@ $(_vstdout)
353ifeq ($(USE_BINARY_PLIST),1)
354 $(_v)$(PLUTIL) -convert binary1 -o $@ $@
355endif
356
39037602
A
357$(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(ALIAS_FILE_NAME): ALWAYS
358 $(_v)echo "$(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))\""
359 $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME) $@
360
361install_alias: $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(ALIAS_FILE_NAME)
362
39236c6e
A
363print_exports:
364 $(_v)printenv | sort