]>
Commit | Line | Data |
---|---|---|
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 | # | |
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 | ||
3e170ce0 A |
29 | ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1) |
30 | do_build_setup:: | |
31 | $(_v)$(CAT) > $(OBJPATH)/compile_commands.json < /dev/null | |
32 | endif | |
33 | ||
cb323159 A |
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 | ||
39236c6e A |
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 | # | |
cb323159 | 49 | # There are 4 primary build outputs: |
fe8ab488 A |
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) | |
d9a64523 A |
53 | # 4) $(KERNEL_FILE_NAME).link (bits for static linking) |
54 | ||
55 | ifeq ($(BUILD_STATIC_LINK),1) | |
56 | ||
57 | KERNEL_STATIC_LINK_TARGETS = \ | |
cb323159 | 58 | $(TARGET)/$(KERNEL_FILE_NAME).link/$(KERNEL_FILE_NAME).a |
d9a64523 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 | |
39236c6e | 70 | |
fe8ab488 | 71 | do_build_all:: do_build_kernel |
39236c6e | 72 | |
fe8ab488 | 73 | .PHONY: do_build_kernel |
39236c6e | 74 | |
d9a64523 | 75 | do_build_kernel: $(TARGET)/$(KERNEL_FILE_NAME) $(TARGET)/$(KERNEL_FILE_NAME).unstripped $(KERNEL_STATIC_LINK_TARGETS) |
fe8ab488 | 76 | @: |
39236c6e A |
77 | |
78 | ifeq ($(BUILD_DSYM),1) | |
fe8ab488 | 79 | do_build_all:: do_build_kernel_dSYM |
39236c6e A |
80 | endif |
81 | ||
fe8ab488 | 82 | .PHONY: do_build_kernel_dSYM |
39236c6e | 83 | |
39037602 | 84 | do_build_kernel_dSYM: $(TARGET)/$(KERNEL_FILE_NAME).dSYM |
39236c6e A |
85 | @: |
86 | ||
fe8ab488 | 87 | .LDFLAGS: ALWAYS |
d9a64523 | 88 | $(_v)$(REPLACECONTENTS) $@ $(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_EXPORTS) $(LD_KERNEL_LIBS) |
fe8ab488 A |
89 | .CFLAGS: ALWAYS |
90 | $(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS) | |
91 | ||
cb323159 A |
92 | $(TARGET)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).unstripped $(TARGET)/$(KERNEL_FILE_NAME).dSYM |
93 | $(call makelog,$(ColorH)STRIP$(Color0) $(ColorLF)$(@F)$(Color0)) | |
39236c6e A |
94 | $(_v)$(STRIP) $(STRIP_FLAGS) $< -o $@ |
95 | $(_v)$(RM) $@.ctfdata | |
96 | ifeq ($(DO_CTFMERGE),1) | |
cb323159 A |
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 | |
39236c6e | 101 | $(_v)if [ -s $@.ctfdata ]; then \ |
cb323159 | 102 | $(LOG) "$(ColorH)CTFINSERT$(Color0) $(ColorLF)$(@F)$(Color0)"; \ |
39037602 | 103 | $(CTFINSERT) $@ $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \ |
39236c6e A |
104 | $@.ctfdata -o $@; \ |
105 | fi; | |
cb323159 | 106 | endif |
fe8ab488 | 107 | $(_v)$(LN) $(call function_convert_build_config_to_objdir,$(CURRENT_BUILD_CONFIG))/$(KERNEL_FILE_NAME) $(OBJROOT)/$(KERNEL_FILE_NAME) |
39236c6e | 108 | |
fe8ab488 | 109 | $(TARGET)/$(KERNEL_FILE_NAME).dSYM: $(TARGET)/$(KERNEL_FILE_NAME).unstripped |
cb323159 | 110 | $(call makelog,$(ColorH)DSYMUTIL$(Color0) $(ColorLF)$(@F)$(Color0)) |
39236c6e | 111 | $(_v)$(DSYMUTIL) $(DSYMUTIL_FLAGS) $< -o $@ |
fe8ab488 | 112 | $(_v)$(MV) $@/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME).unstripped $@/$(DSYMDWARFDIR)/$(KERNEL_FILE_NAME) |
39236c6e A |
113 | $(_v)$(TOUCH) $@ |
114 | ||
cb323159 | 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)) |
39236c6e | 116 | $(_v)${MAKE} -f $(firstword $(MAKEFILE_LIST)) version.o |
cb323159 A |
117 | ifeq ($(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 | |
141 | else | |
142 | $(call makelog,$(ColorL)LD$(Color0) $(ColorLF)$(@F)$(Color0)) | |
39236c6e | 143 | $(_v)$(CAT) $(filter %.filelist,$+) < /dev/null > link.filelist |
d9a64523 | 144 | $(_v)$(LD) $(LDFLAGS_KERNEL) $(LDFLAGS_KERNEL_EXPORTS) -filelist link.filelist version.o $(filter %.o,$+) -o $@ $(LD_KERNEL_LIBS) $(LD_KERNEL_ARCHIVES) |
cb323159 A |
145 | endif |
146 | ||
d9a64523 | 147 | |
cb323159 A |
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)) | |
d9a64523 | 150 | $(_v)$(MKDIR) $(dir $@) |
cb323159 A |
151 | ifeq ($(PRE_LTO),1) |
152 | $(_v)$(LIBTOOL) -ca $(TARGET)/justlto.o -filelist nonltolink.filelist -o $@ | |
153 | else | |
154 | $(_v)$(LIBTOOL) -ca -filelist link.filelist version.o lastkerneldataconst.o lastkernelconstructor.o -o $@ | |
155 | endif | |
d9a64523 A |
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 | |
39236c6e | 161 | |
cb323159 A |
162 | nonlto.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) |
163 | nonlto.o: $(SRCROOT)/libsa/nonlto.c | |
164 | ${C_RULE_0} | |
165 | ${C_RULE_1A}$< $(CFLAGS_NOLTO_FLAG) | |
166 | ${C_RULE_2} | |
167 | ||
fe8ab488 A |
168 | -include version.d |
169 | version.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
39236c6e | 170 | version.o: $(OBJPATH)/version.c |
fe8ab488 | 171 | ${C_RULE_0} |
39236c6e A |
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 | ||
d9a64523 | 181 | |
3e170ce0 A |
182 | -include lastkerneldataconst.d |
183 | lastkerneldataconst.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
184 | lastkerneldataconst.o: $(SRCROOT)/libsa/lastkerneldataconst.c | |
185 | ${C_RULE_0} | |
186 | ${C_RULE_1A}$< | |
187 | ${C_RULE_2} | |
188 | ||
189 | ||
190 | lastkernelconstructor.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 | ||
196 | LAST_FILES=lastkernelconstructor.o | |
fe8ab488 A |
197 | -include lastkernelconstructor.d |
198 | lastkernelconstructor.o: .CFLAGS $(filter %/MakeInc.kernel,$(MAKEFILE_LIST)) | |
39236c6e | 199 | lastkernelconstructor.o: $(SRCROOT)/libsa/lastkernelconstructor.c |
fe8ab488 | 200 | ${C_RULE_0} |
39236c6e A |
201 | ${C_RULE_1A}$< $(CFLAGS_NOLTO_FLAG) |
202 | ${C_RULE_2} | |
203 | ${C_RULE_3} | |
204 | ${C_RULE_4} | |
3e170ce0 | 205 | $(_v)for last_file in ${LAST_FILES}; \ |
cb323159 | 206 | do \ |
3e170ce0 | 207 | $(SEG_HACK) -s __DATA -n __LAST -o $${last_file}__ $${last_file} || exit 1; \ |
cb323159 A |
208 | mv $${last_file}__ $${last_file} || exit 1; \ |
209 | done | |
39236c6e | 210 | |
39236c6e A |
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 | |
fe8ab488 | 216 | # $(DSTROOT)/$(KERNEL_FILE_NAME), and consequently each primary build config |
39236c6e A |
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 | ||
39236c6e A |
223 | do_build_install_primary:: do_install_machine_specific_kernel |
224 | ifeq ($(BUILD_DSYM),1) | |
225 | do_build_install_primary:: do_install_machine_specific_kernel_dSYM | |
226 | endif | |
39236c6e A |
227 | |
228 | do_build_install_non_primary:: do_install_machine_specific_kernel | |
229 | ifeq ($(BUILD_DSYM),1) | |
230 | do_build_install_non_primary:: do_install_machine_specific_kernel_dSYM | |
231 | endif | |
232 | ||
233 | ifeq ($(BUILD_DSYM),1) | |
234 | ifeq ($(INSTALL_KERNEL_SYM_TO_KDK),1) | |
235 | do_build_install_primary:: do_install_machine_specific_KDK_dSYM | |
236 | do_build_install_non_primary:: do_install_machine_specific_KDK_dSYM | |
237 | endif | |
238 | endif | |
239 | ||
240 | ifeq ($(INSTALL_XNU_DEBUG_FILES),1) | |
241 | do_build_install_primary:: do_install_xnu_debug_files | |
39236c6e A |
242 | endif |
243 | ||
fe8ab488 | 244 | .PHONY: do_install_xnu_debug_files |
39236c6e A |
245 | |
246 | do_install_xnu_debug_files: $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/README.DEBUG-kernel.txt | |
247 | @: | |
248 | ||
39236c6e A |
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 | |
fe8ab488 | 253 | # the timestamps would $(DSTROOT)/$(KERNEL_FILE_NAME) is not out of date compared |
39236c6e A |
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 | ||
fe8ab488 | 258 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME) ALWAYS |
39236c6e | 259 | $(_v)$(MKDIR) $(dir $@) |
cb323159 | 260 | $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0) $(ColorLF)$(CURRENT_MACHINE_CONFIG_LC)$(Color0))") |
fe8ab488 | 261 | $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \ |
fe8ab488 A |
262 | $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \ |
263 | cmdstatus=$$?; \ | |
264 | else \ | |
fe8ab488 A |
265 | $(LIPO) -create $@ $< -output $@; \ |
266 | cmdstatus=$$?; \ | |
267 | fi; \ | |
39236c6e A |
268 | exit $$cmdstatus |
269 | ||
d9a64523 A |
270 | ifeq ($(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 $@) | |
cb323159 | 274 | $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)) |
d9a64523 A |
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 $@) | |
cb323159 | 279 | $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)) |
d9a64523 A |
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 $@) | |
cb323159 | 284 | $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)) |
d9a64523 A |
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 $@) | |
cb323159 | 289 | $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)) |
d9a64523 A |
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 $@) | |
cb323159 | 294 | $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)) |
d9a64523 A |
295 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ |
296 | ||
297 | # BUILD_STATIC_LINK | |
298 | endif | |
299 | ||
fe8ab488 | 300 | $(SYMROOT)/$(KERNEL_FILE_NAME): $(TARGET)/$(KERNEL_FILE_NAME).unstripped ALWAYS |
39236c6e | 301 | $(_v)$(MKDIR) $(dir $@) |
cb323159 | 302 | $(call makelog,$(ColorH)INSTALLSYM$(Color0) $(ColorF)$(@F)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))") |
39236c6e | 303 | $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \ |
39236c6e A |
304 | $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \ |
305 | cmdstatus=$$?; \ | |
306 | else \ | |
39236c6e A |
307 | $(LIPO) -create $@ $< -output $@; \ |
308 | cmdstatus=$$?; \ | |
309 | fi; \ | |
310 | exit $$cmdstatus | |
311 | ||
d9a64523 A |
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 | |
39236c6e | 317 | $(_v)$(MKDIR) $(dir $@) |
cb323159 | 318 | $(call makelog,$(ColorH)INSTALLMACROS$(Color0) $(ColorF)$(@F)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))") |
39236c6e A |
319 | $(_v)$(CP) -r $< $(dir $@) |
320 | $(_v)$(TOUCH) $@ | |
321 | ||
d9a64523 A |
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) | |
39236c6e | 326 | $(_v)$(MKDIR) $(dir $@) |
cb323159 | 327 | $(call makelog,$(ColorH)INSTALLMACROS$(Color0) $(ColorF)$(@F)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))") |
39236c6e A |
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 $@) | |
cb323159 | 332 | $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0)) |
39236c6e A |
333 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ |
334 | ||
fe8ab488 | 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 |
39236c6e | 336 | $(_v)$(MKDIR) $(dir $@) |
cb323159 | 337 | $(call makelog,$(ColorH)INSTALLSYM$(Color0) $(ColorL)dSYM$(Color0) $(ColorF)$(@F)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))") |
39236c6e A |
338 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ |
339 | ||
fe8ab488 | 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 |
39236c6e | 341 | $(_v)$(MKDIR) $(dir $@) |
cb323159 | 342 | $(call makelog,$(ColorH)INSTALLSYM$(Color0) $(ColorL)dSYM$(Color0) $(ColorF)$(@F).dSYM$(ColorF) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))") |
39236c6e | 343 | $(_v)if [ $(OBJROOT)/.mach_kernel.timestamp -nt $@ ]; then \ |
39037602 A |
344 | $(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@; \ |
345 | cmdstatus=$$?; \ | |
39236c6e | 346 | else \ |
39037602 A |
347 | $(LIPO) -create $@ $< -output $@; \ |
348 | cmdstatus=$$?; \ | |
39236c6e A |
349 | fi; \ |
350 | exit $$cmdstatus | |
351 | ||
352 | .PHONY: do_install_machine_specific_kernel do_install_machine_specific_kernel_dSYM | |
353 | ||
d9a64523 A |
354 | do_install_machine_specific_kernel: $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME) \ |
355 | $(SYMROOT)/$(KERNEL_FILE_NAME) \ | |
356 | $(KERNEL_STATIC_LINK_DST) | |
39236c6e A |
357 | @: |
358 | ||
359 | do_install_machine_specific_kernel_dSYM: \ | |
fe8ab488 A |
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) | |
39236c6e A |
364 | @: |
365 | ||
366 | .PHONY: do_install_machine_specific_KDK_dSYM | |
367 | ||
368 | do_install_machine_specific_KDK_dSYM: \ | |
fe8ab488 A |
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) | |
39236c6e A |
373 | @: |
374 | ||
39236c6e A |
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 | |
fe8ab488 | 378 | do_installhdrs_mi:: $(DSTROOT)/$(KRESDIR)/Info.plist |
cb323159 | 379 | ifneq ($(INSTALLHDRS_SKIP_HOST),YES) |
39236c6e A |
380 | $(_v)$(MKDIR) $(DSTROOT)/$(KINCFRAME) |
381 | $(_v)$(MKDIR) $(DSTROOT)/$(KPINCDIR) | |
fe8ab488 | 382 | $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR) |
39236c6e A |
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 | |
fe8ab488 A |
391 | $(_v)$(RM) $(DSTROOT)/$(KINCFRAME)/Resources |
392 | $(_v)$(LN) Versions/Current/Resources \ | |
393 | $(DSTROOT)/$(KINCFRAME)/Resources | |
cb323159 | 394 | endif |
39236c6e A |
395 | |
396 | $(DSTROOT)/$(KRESDIR)/Info.plist: $(SOURCE)/EXTERNAL_HEADERS/Info.plist | |
cb323159 | 397 | ifneq ($(INSTALLHDRS_SKIP_HOST),YES) |
39236c6e A |
398 | $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR) |
399 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
400 | $(_v)$(NEWVERS) $@ $(_vstdout) | |
401 | ifeq ($(USE_BINARY_PLIST),1) | |
402 | $(_v)$(PLUTIL) -convert binary1 -o $@ $@ | |
403 | endif | |
cb323159 | 404 | endif |
39236c6e | 405 | |
39037602 | 406 | $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(ALIAS_FILE_NAME): ALWAYS |
cb323159 | 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))") |
39037602 A |
408 | $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(KERNEL_FILE_NAME) $@ |
409 | ||
410 | install_alias: $(DSTROOT)/$(INSTALL_KERNEL_DIR)/$(ALIAS_FILE_NAME) | |
411 | ||
39236c6e A |
412 | print_exports: |
413 | $(_v)printenv | sort |