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