xref: /xnu-10063.101.15/makedefs/MakeInc.top (revision 94d3b452840153a99b38a3a9659680b2a006908e)
1*94d3b452SApple OSS Distributions# -*- mode: makefile;-*-
2*94d3b452SApple OSS Distributions#
3*94d3b452SApple OSS Distributions# Copyright (C) 2010-2020 Apple Inc. All rights reserved.
4*94d3b452SApple OSS Distributions#
5*94d3b452SApple OSS Distributions# MakeInc.top is the top-level makefile for the xnu
6*94d3b452SApple OSS Distributions# build system. All the main XBS targets
7*94d3b452SApple OSS Distributions# (like "installhdrs") are defined here, as
8*94d3b452SApple OSS Distributions# well as globals that can be overridden on
9*94d3b452SApple OSS Distributions# the command-line by the user.
10*94d3b452SApple OSS Distributions#
11*94d3b452SApple OSS Distributions# This makefile's main purpose is to bootstrap
12*94d3b452SApple OSS Distributions# the user's intent ("build these 3 kernels")
13*94d3b452SApple OSS Distributions# into 3 single-architecture builds that each
14*94d3b452SApple OSS Distributions# invoke the recursive make build system.
15*94d3b452SApple OSS Distributions# As such, we have no knowledge of how to build
16*94d3b452SApple OSS Distributions# a kernel or perform actions other than
17*94d3b452SApple OSS Distributions# invoking a sub-make with a different
18*94d3b452SApple OSS Distributions# current directory, makefile, and target. One
19*94d3b452SApple OSS Distributions# side effect of this is that each
20*94d3b452SApple OSS Distributions# single-architecture build is responsible for
21*94d3b452SApple OSS Distributions# inserting its build products into the final
22*94d3b452SApple OSS Distributions# multi-architecture output files. To avoid
23*94d3b452SApple OSS Distributions# races, these aggregating stages for
24*94d3b452SApple OSS Distributions# "primary" build configs are done in serial.
25*94d3b452SApple OSS Distributions#
26*94d3b452SApple OSS Distributions
27*94d3b452SApple OSS Distributionsexport MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd
28*94d3b452SApple OSS Distributions
29*94d3b452SApple OSS Distributionsinclude $(MakeInc_cmd)
30*94d3b452SApple OSS Distributions
31*94d3b452SApple OSS Distributions
32*94d3b452SApple OSS Distributions#
33*94d3b452SApple OSS Distributions# Architecture Configuration options
34*94d3b452SApple OSS Distributions#
35*94d3b452SApple OSS Distributions
36*94d3b452SApple OSS Distributions# Default to current kernel architecture
37*94d3b452SApple OSS Distributions
38*94d3b452SApple OSS Distributionsifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),)
39*94d3b452SApple OSS Distributions     override DEFAULT_ARCH_CONFIG := ARM64
40*94d3b452SApple OSS Distributionselse ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
41*94d3b452SApple OSS Distributions     override DEFAULT_ARCH_CONFIG := X86_64
42*94d3b452SApple OSS Distributionselse
43*94d3b452SApple OSS Distributions     override DEFAULT_ARCH_CONFIG := X86_64
44*94d3b452SApple OSS Distributionsendif
45*94d3b452SApple OSS Distributions
46*94d3b452SApple OSS Distributions# Accept either explicit ARCH_CONFIGS or XBS-style RC_ARCHS
47*94d3b452SApple OSS Distributionsifndef ARCH_CONFIGS
48*94d3b452SApple OSS Distributionsifdef RC_ARCHS
49*94d3b452SApple OSS DistributionsARCH_CONFIGS	:= $(shell printf "%s" "$(RC_ARCHS)" | $(TR) a-z A-Z | $(TR) " " "\n" | sort -u | $(TR) "\n" " ")
50*94d3b452SApple OSS Distributionselse
51*94d3b452SApple OSS DistributionsARCH_CONFIGS	:= DEFAULT
52*94d3b452SApple OSS Distributionsendif
53*94d3b452SApple OSS Distributionsendif
54*94d3b452SApple OSS Distributions
55*94d3b452SApple OSS Distributions#
56*94d3b452SApple OSS Distributions# Kernel Configuration options
57*94d3b452SApple OSS Distributions#
58*94d3b452SApple OSS Distributions
59*94d3b452SApple OSS DistributionsDEFAULT_PRODUCT_CONFIGS :=
60*94d3b452SApple OSS Distributions
61*94d3b452SApple OSS Distributionsifneq ($(filter $(RC_ProjectName),xnu_debug),)
62*94d3b452SApple OSS Distributionsoverride DEFAULT_KERNEL_CONFIG := DEBUG
63*94d3b452SApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_kasan),)
64*94d3b452SApple OSS Distributionsoverride KERNEL_CONFIGS := KASAN
65*94d3b452SApple OSS Distributionselse ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),)
66*94d3b452SApple OSS Distributionsoverride DEFAULT_KERNEL_CONFIG := DEVELOPMENT
67*94d3b452SApple OSS Distributionselse ifeq ($(PLATFORM),MacOSX)
68*94d3b452SApple OSS Distributionsoverride DEFAULT_KERNEL_CONFIG := DEVELOPMENT
69*94d3b452SApple OSS Distributionselse
70*94d3b452SApple OSS Distributionsoverride DEFAULT_KERNEL_CONFIG := RELEASE
71*94d3b452SApple OSS Distributionsendif
72*94d3b452SApple OSS Distributions
73*94d3b452SApple OSS Distributions# If KERNEL_CONFIGS is specified it should override default
74*94d3b452SApple OSS Distributionsifndef KERNEL_CONFIGS
75*94d3b452SApple OSS DistributionsKERNEL_CONFIGS := DEFAULT
76*94d3b452SApple OSS Distributionsendif
77*94d3b452SApple OSS Distributions
78*94d3b452SApple OSS Distributions# If PRODUCT_CONFIGS is specified it should override default
79*94d3b452SApple OSS Distributionsifndef PRODUCT_CONFIGS
80*94d3b452SApple OSS DistributionsPRODUCT_CONFIGS := $(DEFAULT_PRODUCT_CONFIGS)
81*94d3b452SApple OSS Distributionsendif
82*94d3b452SApple OSS Distributions
83*94d3b452SApple OSS Distributions#
84*94d3b452SApple OSS Distributions# Machine Configuration options
85*94d3b452SApple OSS Distributions#
86*94d3b452SApple OSS Distributions
87*94d3b452SApple OSS Distributionsoverride DEFAULT_I386_MACHINE_CONFIG := NONE
88*94d3b452SApple OSS Distributionsoverride DEFAULT_X86_64_MACHINE_CONFIG := NONE
89*94d3b452SApple OSS Distributionsoverride DEFAULT_X86_64H_MACHINE_CONFIG := NONE
90*94d3b452SApple OSS Distributions
91*94d3b452SApple OSS Distributionsifneq ($(findstring _Sim,$(RC_ProjectName)),)
92*94d3b452SApple OSS Distributionsoverride DEFAULT_ARM64_MACHINE_CONFIG	:= NONE
93*94d3b452SApple OSS Distributionselse ifneq ($(findstring _host,$(RC_ProjectName)),)
94*94d3b452SApple OSS Distributionsoverride DEFAULT_ARM64_MACHINE_CONFIG	:= NONE
95*94d3b452SApple OSS Distributionselse
96*94d3b452SApple OSS Distributionsoverride DEFAULT_ARM64_MACHINE_CONFIG	:= VMAPPLE
97*94d3b452SApple OSS Distributionsendif
98*94d3b452SApple OSS Distributions
99*94d3b452SApple OSS Distributions# This is typically never specified (TARGET_CONFIGS is used)
100*94d3b452SApple OSS Distributionsifndef MACHINE_CONFIGS
101*94d3b452SApple OSS DistributionsMACHINE_CONFIGS	:= DEFAULT
102*94d3b452SApple OSS Distributionsendif
103*94d3b452SApple OSS Distributions
104*94d3b452SApple OSS Distributions#
105*94d3b452SApple OSS Distributions# Target configuration options.  NOTE - target configurations will
106*94d3b452SApple OSS Distributions# override ARCH_CONFIGS and KERNEL_CONFIGS and MACHINE_CONFIGS.
107*94d3b452SApple OSS Distributions#
108*94d3b452SApple OSS Distributions# Target configs come in groups of three parameters.  The first is the
109*94d3b452SApple OSS Distributions# kernel configuration, the second is the architecture configuration,
110*94d3b452SApple OSS Distributions# and the third is the machine configuration.  You may pass in as
111*94d3b452SApple OSS Distributions# many groups of configurations as you wish.  Each item passed in is
112*94d3b452SApple OSS Distributions# seperated by whitespace.
113*94d3b452SApple OSS Distributions#
114*94d3b452SApple OSS Distributions# Example:
115*94d3b452SApple OSS Distributions#	TARGET_CONFIGS="release ppc default debug i386 default release arm MX31ADS"
116*94d3b452SApple OSS Distributions# Parameters may be in upper or lower case (they are converted to upper).
117*94d3b452SApple OSS Distributions#
118*94d3b452SApple OSS Distributions# "default" parameter is a special case.  It means use the default value for
119*94d3b452SApple OSS Distributions# that parameter.  Here are the default values for each configuration:
120*94d3b452SApple OSS Distributions#
121*94d3b452SApple OSS Distributions# default kernel configuration = DEFAULT_KERNEL_CONFIG
122*94d3b452SApple OSS Distributions# default architecture configuration = system architecture where you are running make.
123*94d3b452SApple OSS Distributions
124*94d3b452SApple OSS Distributionsifneq ($(filter $(SUPPORTED_PLATFORMS),$(PLATFORM)),)
125*94d3b452SApple OSS Distributions
126*94d3b452SApple OSS Distributions# Defaults for "make all_embedded"
127*94d3b452SApple OSS Distributionsifeq ($(KERNEL_CONFIGS),DEFAULT)
128*94d3b452SApple OSS DistributionsKERNEL_CONFIGS_EMBEDDED := RELEASE DEVELOPMENT
129*94d3b452SApple OSS Distributionselse
130*94d3b452SApple OSS DistributionsKERNEL_CONFIGS_EMBEDDED := $(KERNEL_CONFIGS)
131*94d3b452SApple OSS Distributionsendif
132*94d3b452SApple OSS Distributions
133*94d3b452SApple OSS Distributionsifeq ($(ARCH_CONFIGS),DEFAULT)
134*94d3b452SApple OSS DistributionsARCH_CONFIGS_EMBEDDED := ARM64
135*94d3b452SApple OSS DistributionsARCH_CONFIGS_DESKTOP := X86_64
136*94d3b452SApple OSS Distributionselse
137*94d3b452SApple OSS DistributionsARCH_CONFIGS_EMBEDDED := $(strip $(shell echo $(filter-out X86_64, $(ARCH_CONFIGS)) | $(TR) a-z A-Z))
138*94d3b452SApple OSS DistributionsARCH_CONFIGS_DESKTOP := $(strip $(shell echo $(filter X86_64, $(ARCH_CONFIGS)) | $(TR) a-z A-Z))
139*94d3b452SApple OSS Distributionsendif
140*94d3b452SApple OSS Distributions
141*94d3b452SApple OSS Distributions# Find supported products from the device map
142*94d3b452SApple OSS Distributionsifneq ($(EMBEDDED_DEVICE_MAP),)
143*94d3b452SApple OSS DistributionsDEVICEMAP_PRODUCTS_ARM64 := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH)		\
144*94d3b452SApple OSS Distributions				-list -query 'SELECT DISTINCT TargetType		\
145*94d3b452SApple OSS Distributions					FROM Files					\
146*94d3b452SApple OSS Distributions					  INNER JOIN Manifests USING (manifestID)	\
147*94d3b452SApple OSS Distributions					  INNER JOIN Targets USING (Target)		\
148*94d3b452SApple OSS Distributions					WHERE (KernelMachOArchitecture LIKE "arm64"	\
149*94d3b452SApple OSS Distributions					   AND fileType in ("KernelCache", "RestoreKernelCache"))')
150*94d3b452SApple OSS DistributionsDEVICEMAP_PRODUCTS_OSX_ARM64 := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH)		\
151*94d3b452SApple OSS Distributions					-list -query 'SELECT DISTINCT TargetType		\
152*94d3b452SApple OSS Distributions					      	FROM Files					\
153*94d3b452SApple OSS Distributions					  	  INNER JOIN Manifests USING (manifestID)	\
154*94d3b452SApple OSS Distributions					  	  INNER JOIN Targets USING (Target)		\
155*94d3b452SApple OSS Distributions					    	WHERE (KernelMachOArchitecture LIKE "arm64"	\
156*94d3b452SApple OSS Distributions					   	  AND fileType in ("KernelCache", "RestoreKernelCache") \
157*94d3b452SApple OSS Distributions						  AND SDKPlatform == "macosx")')
158*94d3b452SApple OSS Distributions
159*94d3b452SApple OSS Distributions
160*94d3b452SApple OSS Distributions# Generate a list of mappings of the form "n75:arm;t8002" based on the device map
161*94d3b452SApple OSS DistributionsDEVICEMAP_PRODUCT_SOC_MAPPINGS := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) -list -query SELECT DISTINCT TargetType, KernelMachOArchitecture, KernelPlatform FROM Targets | awk -F\| '{ if ($$2 ~ /arm64[a-z]?/) { print $$1 ":arm64;" $$3 ";" $$4} else { print $$1 ":" $$2 ";" $$3 ";" $$4} }' )
162*94d3b452SApple OSS Distributions
163*94d3b452SApple OSS Distributions# use embedded_device_map
164*94d3b452SApple OSS Distributionsendif
165*94d3b452SApple OSS Distributions
166*94d3b452SApple OSS Distributions# Map a product like "n75" to "arm;t8002"
167*94d3b452SApple OSS Distributions# $(1) is a product name in lower case
168*94d3b452SApple OSS Distributionsfunction_lookup_product = $(call function_substitute_word_with_replacement,	\
169*94d3b452SApple OSS Distributions				 $(1),						\
170*94d3b452SApple OSS Distributions				 $(DEVICEMAP_PRODUCT_SOC_MAPPINGS),		\
171*94d3b452SApple OSS Distributions				 unknown_arch_for_$(1);unknown_platform_for_$(1) \
172*94d3b452SApple OSS Distributions			   )
173*94d3b452SApple OSS Distributions
174*94d3b452SApple OSS Distributionsifneq ($(PLATFORM),MacOSX)
175*94d3b452SApple OSS Distributionsifneq ($(EMBEDDED_DEVICE_MAP),)
176*94d3b452SApple OSS Distributions# Generate a list of mappings for products that use a different platform for their kernel configuration than their true platform
177*94d3b452SApple OSS Distributions# of the form "n71m:arm64;s8000;s8003". The 4th element is the true SoC platform, which will get an on-disk copy, while the
178*94d3b452SApple OSS Distributions# kernel's recursive build system will build the 3rd element as the KernelPlatform
179*94d3b452SApple OSS DistributionsDEVICEMAP_PRODUCT_SOC_ALIASES := $(shell $(EMBEDDED_DEVICE_MAP) -db $(EDM_DBPATH) -list -query SELECT DISTINCT TargetType, KernelMachOArchitecture, KernelPlatform, Platform FROM Targets WHERE KernelPlatform "!=" Platform | awk -F\| '{ if ($$2 ~ /arm64[a-z]?/) { print $$1 ":arm64;" $$3 ";" $$4} else { print $$1 ":" $$2 ";" $$3 ";" $$4} }' )
180*94d3b452SApple OSS Distributions
181*94d3b452SApple OSS Distributionsendif
182*94d3b452SApple OSS Distributionsendif
183*94d3b452SApple OSS Distributions
184*94d3b452SApple OSS Distributionsfunction_lookup_product_alias = $(call function_substitute_word_with_replacement,	\
185*94d3b452SApple OSS Distributions					$(1),						\
186*94d3b452SApple OSS Distributions					$(DEVICEMAP_PRODUCT_SOC_ALIASES),		\
187*94d3b452SApple OSS Distributions				 )
188*94d3b452SApple OSS Distributionsendif
189*94d3b452SApple OSS Distributions
190*94d3b452SApple OSS Distributionsifeq ($(PLATFORM),MacOSX)
191*94d3b452SApple OSS Distributions
192*94d3b452SApple OSS Distributions# Defaults for "make all_desktop"
193*94d3b452SApple OSS Distributionsifeq ($(KERNEL_CONFIGS),DEFAULT)
194*94d3b452SApple OSS DistributionsKERNEL_CONFIGS_DESKTOP := RELEASE DEVELOPMENT
195*94d3b452SApple OSS Distributionselse
196*94d3b452SApple OSS DistributionsKERNEL_CONFIGS_DESKTOP := $(KERNEL_CONFIGS)
197*94d3b452SApple OSS Distributionsendif
198*94d3b452SApple OSS Distributions
199*94d3b452SApple OSS Distributionsendif
200*94d3b452SApple OSS Distributions
201*94d3b452SApple OSS Distributionsifndef TARGET_CONFIGS
202*94d3b452SApple OSS Distributionsifneq ($(PRODUCT_CONFIGS),)
203*94d3b452SApple OSS Distributions# generate TARGET_CONFIGS using KERNEL_CONFIGS and PRODUCT_CONFIGS
204*94d3b452SApple OSS DistributionsTARGET_CONFIGS := $(foreach my_devicemap_config,$(foreach my_product_config,$(shell printf "%s" "$(PRODUCT_CONFIGS)" | $(TR) A-Z a-z),$(call function_lookup_product,$(my_product_config))),$(foreach my_kernel_config,$(KERNEL_CONFIGS),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
205*94d3b452SApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_product_config,$(shell printf "%s" "$(PRODUCT_CONFIGS)" | $(TR) A-Z a-z),$(call function_lookup_product_alias,$(my_product_config))),$(foreach my_kernel_config,$(KERNEL_CONFIGS),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
206*94d3b452SApple OSS Distributionselse ifneq ($(filter %_release_embedded,$(MAKECMDGOALS)),)
207*94d3b452SApple OSS Distributions# generate TARGET_CONFIGS for RELEASE kernel configs and products in the device map
208*94d3b452SApple OSS DistributionsTARGET_CONFIGS := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product,$(my_product_config)))),$(foreach my_kernel_config,RELEASE,$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
209*94d3b452SApple OSS DistributionsTARGET_CONFIGS += $(EXTRA_TARGET_CONFIGS_RELEASE)
210*94d3b452SApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product_alias,$(my_product_config)))),$(foreach my_kernel_config,RELEASE,$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
211*94d3b452SApple OSS Distributionselse ifneq ($(filter %_development_embedded,$(MAKECMDGOALS)),)
212*94d3b452SApple OSS Distributions# generate TARGET_CONFIGS for DEVELOPMENT kernel configs and products in the device map
213*94d3b452SApple OSS DistributionsTARGET_CONFIGS := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product,$(my_product_config)))),$(foreach my_kernel_config,DEVELOPMENT,$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
214*94d3b452SApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product_alias,$(my_product_config)))),$(foreach my_kernel_config,DEVELOPMENT,$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
215*94d3b452SApple OSS Distributionselse ifneq ($(filter %_embedded,$(MAKECMDGOALS)),)
216*94d3b452SApple OSS Distributions# generate TARGET_CONFIGS for all kernel configs and products in the device map
217*94d3b452SApple OSS DistributionsTARGET_CONFIGS := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product,$(my_product_config)))),$(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
218*94d3b452SApple OSS DistributionsTARGET_CONFIGS += $(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(EXTRA_TARGET_CONFIGS_$(my_kernel_config)))
219*94d3b452SApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(call function_lookup_product_alias,$(my_product_config)))),$(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
220*94d3b452SApple OSS Distributionselse ifeq (xnu_headers_driverkit,$(RC_ProjectName))
221*94d3b452SApple OSS Distributions# generate TARGET_CONFIGS for all kernel configs for B&I
222*94d3b452SApple OSS DistributionsTARGET_CONFIGS = DEVELOPMENT arm64 DEFAULT DEVELOPMENT X86_64 DEFAULT
223*94d3b452SApple OSS Distributionselse ifneq ($(filter %_desktop,$(MAKECMDGOALS)),)
224*94d3b452SApple OSS Distributions# generate TARGET_CONFIGS for all kernel configs for B&I
225*94d3b452SApple OSS DistributionsTARGET_CONFIGS := $(foreach my_kern_config, $(KERNEL_CONFIGS_DESKTOP), $(foreach my_arch_config, $(ARCH_CONFIGS_DESKTOP), $(foreach my_machine_config, $(MACHINE_CONFIGS), $(my_kern_config) $(my_arch_config) $(my_machine_config))))
226*94d3b452SApple OSS DistributionsTARGET_CONFIGS += $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_OSX_$(my_arch_config)),$(call function_lookup_product,$(my_product_config)))),$(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
227*94d3b452SApple OSS DistributionsTARGET_CONFIGS += $(foreach my_kernel_config,$(KERNEL_CONFIGS_DESKTOP),$(EXTRA_TARGET_CONFIGS_$(my_kernel_config)))
228*94d3b452SApple OSS DistributionsTARGET_CONFIGS_ALIASES := $(foreach my_devicemap_config,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_OSX_$(my_arch_config)),$(call function_lookup_product_alias,$(my_product_config)))),$(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(my_kernel_config) $(subst ;, ,$(my_devicemap_config))))
229*94d3b452SApple OSS Distributionselse
230*94d3b452SApple OSS Distributions# generate TARGET_CONFIGS using KERNEL_CONFIGS and ARCH_CONFIGS and MACHINE_CONFIGS (which defaults to "DEFAULT")
231*94d3b452SApple OSS DistributionsTARGET_CONFIGS := $(foreach my_kern_config, $(KERNEL_CONFIGS), $(foreach my_arch_config, $(ARCH_CONFIGS), $(foreach my_machine_config, $(MACHINE_CONFIGS), $(my_kern_config) $(my_arch_config) $(my_machine_config))))
232*94d3b452SApple OSS DistributionsTARGET_CONFIGS_ALIASES :=
233*94d3b452SApple OSS Distributionsendif
234*94d3b452SApple OSS Distributionsendif
235*94d3b452SApple OSS Distributions
236*94d3b452SApple OSS Distributionsifeq ($(TARGET_CONFIGS),)
237*94d3b452SApple OSS Distributions$(error No TARGET_CONFIGS specified)
238*94d3b452SApple OSS Distributionsendif
239*94d3b452SApple OSS Distributions
240*94d3b452SApple OSS DistributionsTARGET_CONFIGS_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z A-Z))
241*94d3b452SApple OSS DistributionsTARGET_CONFIGS_ALIASES_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS_ALIASES)" | $(TR) a-z A-Z))
242*94d3b452SApple OSS Distributions
243*94d3b452SApple OSS Distributions#
244*94d3b452SApple OSS Distributions# Build Configurations
245*94d3b452SApple OSS Distributions#
246*94d3b452SApple OSS Distributions# TARGET_CONFIGS is unwieldy for use in Makefiles. Convert them to
247*94d3b452SApple OSS Distributions# "build configurations" which are tuples joined by "^". For
248*94d3b452SApple OSS Distributions# example, "RELEASE I386 DEFAULT DEVELOPMENT ARM DEFAULT" becomes
249*94d3b452SApple OSS Distributions# "RELEASE^I386^NONE DEVELOPMENT^ARM^T8002", which can be looped
250*94d3b452SApple OSS Distributions# over trivially. PRIMARY_BUILD_CONFIGS is the first config
251*94d3b452SApple OSS Distributions# for each architecture, used primarily for machine-dependent recursion.
252*94d3b452SApple OSS Distributions# VARIANT_CONFIGS contains one build configuration for each combination
253*94d3b452SApple OSS Distributions# of kernel architecture and configuration. It is used for variant
254*94d3b452SApple OSS Distributions# installation recursion.
255*94d3b452SApple OSS Distributions
256*94d3b452SApple OSS DistributionsBUILD_CONFIGS = $(call function_create_build_configs, $(TARGET_CONFIGS_UC))
257*94d3b452SApple OSS Distributions
258*94d3b452SApple OSS DistributionsPRIMARY_ARCHS = $(strip $(sort $(foreach build_config, $(BUILD_CONFIGS), $(call function_extract_arch_config_from_build_config, $(build_config)))))
259*94d3b452SApple OSS DistributionsPRIMARY_BUILD_CONFIGS = $(strip $(foreach arch, $(PRIMARY_ARCHS), $(firstword $(foreach build_config, $(BUILD_CONFIGS), $(if $(filter $(arch),$(call function_extract_arch_config_from_build_config, $(build_config))), $(build_config), )))))
260*94d3b452SApple OSS DistributionsNON_PRIMARY_BUILD_CONFIGS = $(strip $(filter-out $(PRIMARY_BUILD_CONFIGS), $(BUILD_CONFIGS)))
261*94d3b452SApple OSS DistributionsFIRST_BUILD_CONFIG = $(firstword $(BUILD_CONFIGS))
262*94d3b452SApple OSS Distributions
263*94d3b452SApple OSS Distributions# Build list of all kernel configurations present in all build configs.
264*94d3b452SApple OSS DistributionsPRIMARY_KERNEL_CONFIGS = $(strip $(sort $(foreach build_config, $(BUILD_CONFIGS), $(call function_extract_kernel_config_from_build_config, $(build_config)))))
265*94d3b452SApple OSS Distributions
266*94d3b452SApple OSS Distributions# Pick one build configuration for each kernel configuration.
267*94d3b452SApple OSS Distributions# This will be used to populate System.kext variants in SYMROOT / DSTROOT.
268*94d3b452SApple OSS DistributionsVARIANT_CONFIGS = $(strip \
269*94d3b452SApple OSS Distributions                    $(foreach kernel_config, $(PRIMARY_KERNEL_CONFIGS), \
270*94d3b452SApple OSS Distributions                      $(firstword $(call function_match_build_config_for_kernel_config, $(BUILD_CONFIGS), $(kernel_config)))))
271*94d3b452SApple OSS Distributions
272*94d3b452SApple OSS Distributionsifneq ($(TARGET_CONFIGS_ALIASES_UC),)
273*94d3b452SApple OSS DistributionsALIAS_CONFIGS = $(call function_create_alias_configs, $(TARGET_CONFIGS_ALIASES_UC))
274*94d3b452SApple OSS Distributionselse
275*94d3b452SApple OSS DistributionsALIAS_CONFIGS =
276*94d3b452SApple OSS Distributionsendif
277*94d3b452SApple OSS Distributions
278*94d3b452SApple OSS Distributions# $(warning PRIMARY_ARCHS is $(PRIMARY_ARCHS))
279*94d3b452SApple OSS Distributions# $(warning TARGET_CONFIGS is $(TARGET_CONFIGS))
280*94d3b452SApple OSS Distributions# $(warning BUILD_CONFIGS is $(BUILD_CONFIGS))
281*94d3b452SApple OSS Distributions# $(warning PRIMARY_BUILD_CONFIGS is $(PRIMARY_BUILD_CONFIGS))
282*94d3b452SApple OSS Distributions# $(warning NON_PRIMARY_BUILD_CONFIGS is $(NON_PRIMARY_BUILD_CONFIGS))
283*94d3b452SApple OSS Distributions# $(warning TARGET_CONFIGS_ALIASES is $(TARGET_CONFIGS_ALIASES))
284*94d3b452SApple OSS Distributions# $(warning ALIAS_CONFIGS is $(ALIAS_CONFIGS))
285*94d3b452SApple OSS Distributions# $(warning PRIMARY_KERNEL_CONFIGS is $(PRIMARY_KERNEL_CONFIGS))
286*94d3b452SApple OSS Distributions# $(warning VARIANT_CONFIGS is $(VARIANT_CONFIGS))
287*94d3b452SApple OSS Distributions
288*94d3b452SApple OSS DistributionsMEMORY_SIZE := $(shell /usr/sbin/sysctl -n hw.memsize)
289*94d3b452SApple OSS Distributions
290*94d3b452SApple OSS Distributions# Assume LTO scaling by default, unless it is being explicitly passed on the command-line
291*94d3b452SApple OSS DistributionsLARGE_BUILD_FOOTPRINT := $(if $(BUILD_LTO),$(BUILD_LTO),1)
292*94d3b452SApple OSS Distributions
293*94d3b452SApple OSS Distributionsifeq ($(LARGE_BUILD_FOOTPRINT),1)
294*94d3b452SApple OSS DistributionsRAM_PER_KERNEL_BUILD := 4294967296
295*94d3b452SApple OSS Distributionselse
296*94d3b452SApple OSS DistributionsRAM_PER_KERNEL_BUILD := 268435456
297*94d3b452SApple OSS Distributionsendif
298*94d3b452SApple OSS Distributions
299*94d3b452SApple OSS DistributionsKERNEL_BUILDS_IN_PARALLEL := $(shell if [ $(MEMORY_SIZE) -le $$((1 * $(RAM_PER_KERNEL_BUILD))) ]; then echo 1; elif [ $(MEMORY_SIZE) -gt $$(($(SYSCTL_HW_PHYSICALCPU) * $(RAM_PER_KERNEL_BUILD))) ]; then echo $(SYSCTL_HW_PHYSICALCPU); else expr $(MEMORY_SIZE) / $(RAM_PER_KERNEL_BUILD); fi )
300*94d3b452SApple OSS Distributions# $(warning Building $(KERNEL_BUILDS_IN_PARALLEL) kernels in parallel)
301*94d3b452SApple OSS Distributions
302*94d3b452SApple OSS Distributions#
303*94d3b452SApple OSS Distributions# TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template
304*94d3b452SApple OSS Distributions#
305*94d3b452SApple OSS Distributions# $(1) is the name of the makefile target to invoke for the each build config
306*94d3b452SApple OSS Distributions#      after setting up the parallel hierarchy in the TARGET directory
307*94d3b452SApple OSS Distributions# $(2) is an optional suffix on the TARGET directory, which might even be
308*94d3b452SApple OSS Distributions#      "/.."
309*94d3b452SApple OSS Distributions# $(3) are any dependencies for the bootstrap target
310*94d3b452SApple OSS Distributions# $(4) are any dependencies that are expanded per-build config to another bootstrap target
311*94d3b452SApple OSS Distributions# $(5) is how many build configurations to build in parallel
312*94d3b452SApple OSS Distributions# $(6) is which build configs to build in parallel
313*94d3b452SApple OSS Distributions#
314*94d3b452SApple OSS Distributions# Since building many configurations in parallel may overwhelm the system,
315*94d3b452SApple OSS Distributions# we try to throttle behavior into more managable S "stripes" of N/S
316*94d3b452SApple OSS Distributions# configurations by generating sequential dependencies between configs
317*94d3b452SApple OSS Distributions# in each stripe. That ensures that only S kernel builds are occurring
318*94d3b452SApple OSS Distributions# at once at any point in time
319*94d3b452SApple OSS Distributions
320*94d3b452SApple OSS Distributionsdefine TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template
321*94d3b452SApple OSS Distributions
322*94d3b452SApple OSS Distributions# Create a list of synthesized targets for each build config
323*94d3b452SApple OSS Distributions$(1)_bootstrap_target_list = $$(addprefix $(1)_bootstrap_,$(6))
324*94d3b452SApple OSS Distributions
325*94d3b452SApple OSS Distributions.PHONY: $$($(1)_bootstrap_target_list)
326*94d3b452SApple OSS Distributions
327*94d3b452SApple OSS Distributions$(1)_generated_stripe_dependencies = $$(call _function_generate_stripe_groupings,$(1),$(5),$(call reverse,$(6)))
328*94d3b452SApple OSS Distributionsifeq ($$(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
329*94d3b452SApple OSS Distributions$$(warning Generate makefile fragment: $$($(1)_generated_stripe_dependencies))
330*94d3b452SApple OSS Distributionsendif
331*94d3b452SApple OSS Distributions$$(eval $$($(1)_generated_stripe_dependencies))
332*94d3b452SApple OSS Distributions
333*94d3b452SApple OSS Distributions$$($(1)_bootstrap_target_list): $(1)_bootstrap_% : $(1)_stripe_dep_for_% $$(addsuffix _bootstrap_%,$(4)) $(3)
334*94d3b452SApple OSS Distributions	$$(_v)$$(MKDIR) $${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2)
335*94d3b452SApple OSS Distributions	$$(_v)$${MAKE}													        \
336*94d3b452SApple OSS Distributions		-C $${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2)		\
337*94d3b452SApple OSS Distributions		-f $${SRCROOT}/Makefile												\
338*94d3b452SApple OSS Distributions		CURRENT_KERNEL_CONFIG=$$(call function_extract_kernel_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@)) \
339*94d3b452SApple OSS Distributions		CURRENT_ARCH_CONFIG=$$(call function_extract_arch_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@))	  \
340*94d3b452SApple OSS Distributions		CURRENT_MACHINE_CONFIG=$$(call function_extract_machine_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@))	\
341*94d3b452SApple OSS Distributions		CURRENT_BUILD_CONFIG=$$(patsubst $(1)_bootstrap_%,%,$$@)							\
342*94d3b452SApple OSS Distributions		PRIMARY_BUILD_CONFIGS="$(PRIMARY_BUILD_CONFIGS)" BUILD_CONFIGS="$(BUILD_CONFIGS)"				\
343*94d3b452SApple OSS Distributions		SOURCE=$${SRCROOT}/												\
344*94d3b452SApple OSS Distributions		RELATIVE_SOURCE_PATH=.											\
345*94d3b452SApple OSS Distributions		TARGET=$${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2)/	\
346*94d3b452SApple OSS Distributions		OBJPATH=$${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))	\
347*94d3b452SApple OSS Distributions		$(1)
348*94d3b452SApple OSS Distributions
349*94d3b452SApple OSS Distributions.PHONY: $(1)_bootstrap
350*94d3b452SApple OSS Distributions
351*94d3b452SApple OSS Distributions$(1)_bootstrap: $$($(1)_bootstrap_target_list)
352*94d3b452SApple OSS Distributionsendef
353*94d3b452SApple OSS Distributions
354*94d3b452SApple OSS Distributions#
355*94d3b452SApple OSS Distributions# TOP_LEVEL_STRIPE_DEPENDENCY_template
356*94d3b452SApple OSS Distributions#
357*94d3b452SApple OSS Distributions# $(1) is the Makefile target we are building for
358*94d3b452SApple OSS Distributions# $(2) is the build config that must build first
359*94d3b452SApple OSS Distributions# $(3) is the build config that must build after $(2)
360*94d3b452SApple OSS Distributions
361*94d3b452SApple OSS Distributionsdefine TOP_LEVEL_STRIPE_DEPENDENCY_template
362*94d3b452SApple OSS Distributions
363*94d3b452SApple OSS Distributions.PHONY: $(1)_stripe_dep_for_$(3)
364*94d3b452SApple OSS Distributions
365*94d3b452SApple OSS Distributions $(1)_stripe_dep_for_$(3): $(if $(2),$(1)_bootstrap_$(2))
366*94d3b452SApple OSS Distributions
367*94d3b452SApple OSS Distributionsendef
368*94d3b452SApple OSS Distributions
369*94d3b452SApple OSS Distributions# $(1) is the Makefile target we are building for
370*94d3b452SApple OSS Distributions# $(2) is the stripe size
371*94d3b452SApple OSS Distributions# $(3) is the list of the build configs in the current group
372*94d3b452SApple OSS Distributions# $(4) is the list of remaining build configs
373*94d3b452SApple OSS Distributions_function_generate_stripe_groupings_recursive = $(foreach stripe_index,$(call sequence,$(2)),$(if $(word $(stripe_index),$(4)),$(call TOP_LEVEL_STRIPE_DEPENDENCY_template,$(1),$(word $(stripe_index),$(3)),$(word $(stripe_index),$(4))))) $(if $(word $(call increment,$(2)),$(4)),$(call _function_generate_stripe_groupings_recursive,$(1),$(2),$(wordlist 1,$(2),$(4)),$(wordlist $(call increment,$(2)),$(words $(4)),$(4))))
374*94d3b452SApple OSS Distributions
375*94d3b452SApple OSS Distributions# $(1) is the Makefile target we are building for
376*94d3b452SApple OSS Distributions# $(2) is the stripe size
377*94d3b452SApple OSS Distributions# $(3) is the list of the build configs
378*94d3b452SApple OSS Distributions_function_generate_stripe_groupings = $(call _function_generate_stripe_groupings_recursive,$(1),$(2),,$(3))
379*94d3b452SApple OSS Distributions
380*94d3b452SApple OSS Distributions#
381*94d3b452SApple OSS Distributions# Setup pass for build system tools
382*94d3b452SApple OSS Distributions#
383*94d3b452SApple OSS Distributions
384*94d3b452SApple OSS Distributionsgenerated_top_level_build_setup = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_setup,/..,,,1,$(FIRST_BUILD_CONFIG))
385*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
386*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_setup))
387*94d3b452SApple OSS Distributionsendif
388*94d3b452SApple OSS Distributions$(eval $(generated_top_level_build_setup))
389*94d3b452SApple OSS Distributions
390*94d3b452SApple OSS Distributions.PHONY: setup
391*94d3b452SApple OSS Distributions
392*94d3b452SApple OSS Distributions# invalidate current kernel in $(SYMROOT). Timestamp must be +1 from a previous kernel build
393*94d3b452SApple OSS Distributionssetup: build_setup_bootstrap
394*94d3b452SApple OSS Distributions	$(_v)$(TOUCH) $(OBJROOT)/.mach_kernel.timestamp.new
395*94d3b452SApple OSS Distributions    # -nt and -ot are evaluated differently by bash, dash, and zsh (and are not part of the POSIX specification).
396*94d3b452SApple OSS Distributions    # Explicitly specify what should happen when the right hand file doesn't exist.
397*94d3b452SApple OSS Distributions	$(_v)while [ \! $(OBJROOT)/.mach_kernel.timestamp.new -nt $(OBJROOT)/.mach_kernel.timestamp -a \( \! -e $(OBJROOT)/.mach_kernel.timestamp.new -o -e $(OBJROOT)/.mach_kernel.timestamp \) ]; do \
398*94d3b452SApple OSS Distributions		$(SLEEP) 1;					\
399*94d3b452SApple OSS Distributions		$(TOUCH) $(OBJROOT)/.mach_kernel.timestamp.new;	\
400*94d3b452SApple OSS Distributions	done
401*94d3b452SApple OSS Distributions	$(_v)$(MV) $(OBJROOT)/.mach_kernel.timestamp.new $(OBJROOT)/.mach_kernel.timestamp
402*94d3b452SApple OSS Distributions	$(_v)$(TOUCH) $(OBJROOT)/.symbolset.timestamp.new
403*94d3b452SApple OSS Distributions	$(_v)while [ $(OBJROOT)/.symbolset.timestamp.new -ot $(OBJROOT)/.symbolset.timestamp ]; do \
404*94d3b452SApple OSS Distributions		$(SLEEP) 1;					\
405*94d3b452SApple OSS Distributions		$(TOUCH) $(OBJROOT)/.symbolset.timestamp.new;	\
406*94d3b452SApple OSS Distributions	done
407*94d3b452SApple OSS Distributions	$(_v)$(MV) $(OBJROOT)/.symbolset.timestamp.new $(OBJROOT)/.symbolset.timestamp
408*94d3b452SApple OSS Distributions
409*94d3b452SApple OSS Distributions#
410*94d3b452SApple OSS Distributions# Install kernel header files
411*94d3b452SApple OSS Distributions#
412*94d3b452SApple OSS Distributions.PHONY: exporthdrs exporthdrs_mi exporthdrs_md
413*94d3b452SApple OSS Distributions
414*94d3b452SApple OSS Distributionsexporthdrs: exporthdrs_mi exporthdrs_md
415*94d3b452SApple OSS Distributions
416*94d3b452SApple OSS Distributions#
417*94d3b452SApple OSS Distributions# Install machine independent kernel header files
418*94d3b452SApple OSS Distributions#
419*94d3b452SApple OSS Distributions
420*94d3b452SApple OSS Distributionsgenerated_top_level_build_exporthdrs_mi = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_exporthdrs_mi,,setup,,1,$(FIRST_BUILD_CONFIG))
421*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
422*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_exporthdrs_mi))
423*94d3b452SApple OSS Distributionsendif
424*94d3b452SApple OSS Distributions$(eval $(generated_top_level_build_exporthdrs_mi))
425*94d3b452SApple OSS Distributions
426*94d3b452SApple OSS Distributionsexporthdrs_mi: build_exporthdrs_mi_bootstrap
427*94d3b452SApple OSS Distributions
428*94d3b452SApple OSS Distributions#
429*94d3b452SApple OSS Distributions# Install machine dependent kernel header files
430*94d3b452SApple OSS Distributions#
431*94d3b452SApple OSS Distributions
432*94d3b452SApple OSS Distributionsgenerated_top_level_build_exporthdrs_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_exporthdrs_md,,setup,,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS))
433*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
434*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_exporthdrs_md))
435*94d3b452SApple OSS Distributionsendif
436*94d3b452SApple OSS Distributions$(eval $(generated_top_level_build_exporthdrs_md))
437*94d3b452SApple OSS Distributions
438*94d3b452SApple OSS Distributionsexporthdrs_md: build_exporthdrs_md_bootstrap
439*94d3b452SApple OSS Distributions
440*94d3b452SApple OSS Distributions#
441*94d3b452SApple OSS Distributions# Install kernel header files
442*94d3b452SApple OSS Distributions#
443*94d3b452SApple OSS Distributions
444*94d3b452SApple OSS Distributions.PHONY: installhdrs installhdrs_mi installhdrs_md
445*94d3b452SApple OSS Distributions
446*94d3b452SApple OSS Distributionsifneq ($(filter $(RC_ProjectName),xnu_debug),)
447*94d3b452SApple OSS Distributionsinstallhdrs:
448*94d3b452SApple OSS Distributions	@:
449*94d3b452SApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_kasan),)
450*94d3b452SApple OSS Distributionsinstallhdrs:
451*94d3b452SApple OSS Distributions	@:
452*94d3b452SApple OSS Distributionselse
453*94d3b452SApple OSS Distributions
454*94d3b452SApple OSS Distributionsinstallhdrs: installhdrs_mi installhdrs_md
455*94d3b452SApple OSS Distributionsendif
456*94d3b452SApple OSS Distributions
457*94d3b452SApple OSS Distributions.PHONY: installhdrs_embedded installhdrs_release_embedded installhdrs_development_embedded installhdrs_desktop
458*94d3b452SApple OSS Distributions
459*94d3b452SApple OSS Distributionsinstallhdrs_embedded installhdrs_release_embedded installhdrs_desktop: installhdrs
460*94d3b452SApple OSS Distributions
461*94d3b452SApple OSS Distributionsinstallhdrs_development_embedded:
462*94d3b452SApple OSS Distributions
463*94d3b452SApple OSS Distributions#
464*94d3b452SApple OSS Distributions# Install machine independent header files
465*94d3b452SApple OSS Distributions#
466*94d3b452SApple OSS Distributions
467*94d3b452SApple OSS Distributionsgenerated_top_level_build_installhdrs_mi = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_installhdrs_mi,,setup,build_exporthdrs_mi,1,$(FIRST_BUILD_CONFIG))
468*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
469*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_installhdrs_mi))
470*94d3b452SApple OSS Distributionsendif
471*94d3b452SApple OSS Distributions$(eval $(generated_top_level_build_installhdrs_mi))
472*94d3b452SApple OSS Distributions
473*94d3b452SApple OSS Distributionsinstallhdrs_mi: build_installhdrs_mi_bootstrap
474*94d3b452SApple OSS Distributions
475*94d3b452SApple OSS Distributions#
476*94d3b452SApple OSS Distributions# Install machine dependent kernel header files
477*94d3b452SApple OSS Distributions#
478*94d3b452SApple OSS Distributions
479*94d3b452SApple OSS Distributionsgenerated_top_level_build_installhdrs_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_installhdrs_md,,setup,build_exporthdrs_md,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS))
480*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
481*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_installhdrs_md))
482*94d3b452SApple OSS Distributionsendif
483*94d3b452SApple OSS Distributions$(eval $(generated_top_level_build_installhdrs_md))
484*94d3b452SApple OSS Distributions
485*94d3b452SApple OSS Distributionsinstallhdrs_md: build_installhdrs_md_bootstrap
486*94d3b452SApple OSS Distributions
487*94d3b452SApple OSS Distributions.PHONY: install_textfiles install_textfiles_mi install_textfiles_md
488*94d3b452SApple OSS Distributions
489*94d3b452SApple OSS Distributionsinstall_textfiles: install_textfiles_mi install_textfiles_md
490*94d3b452SApple OSS Distributions
491*94d3b452SApple OSS Distributions#
492*94d3b452SApple OSS Distributions#  Install machine independent text files (man pages, dtrace scripts, etc.)
493*94d3b452SApple OSS Distributions#
494*94d3b452SApple OSS Distributions
495*94d3b452SApple OSS Distributionsgenerated_top_level_textfiles_install_mi = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,textfiles_install_mi,,setup,,1,$(FIRST_BUILD_CONFIG))
496*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
497*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_textfiles_install_mi))
498*94d3b452SApple OSS Distributionsendif
499*94d3b452SApple OSS Distributions$(eval $(generated_top_level_textfiles_install_mi))
500*94d3b452SApple OSS Distributions
501*94d3b452SApple OSS Distributionsinstall_textfiles_mi: textfiles_install_mi_bootstrap
502*94d3b452SApple OSS Distributions
503*94d3b452SApple OSS Distributions#
504*94d3b452SApple OSS Distributions#  Install machine dependent text files (man pages, dtrace scripts, etc.)
505*94d3b452SApple OSS Distributions#
506*94d3b452SApple OSS Distributions
507*94d3b452SApple OSS Distributionsgenerated_top_level_textfiles_install_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,textfiles_install_md,,setup,,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS))
508*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
509*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_textfiles_install_md))
510*94d3b452SApple OSS Distributionsendif
511*94d3b452SApple OSS Distributions$(eval $(generated_top_level_textfiles_install_md))
512*94d3b452SApple OSS Distributions
513*94d3b452SApple OSS Distributionsinstall_textfiles_md: textfiles_install_md_bootstrap
514*94d3b452SApple OSS Distributions
515*94d3b452SApple OSS Distributions#
516*94d3b452SApple OSS Distributions# Build all architectures for all Configuration/Architecture options
517*94d3b452SApple OSS Distributions#
518*94d3b452SApple OSS Distributions
519*94d3b452SApple OSS Distributionsgenerated_top_level_build_all = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_all,,setup exporthdrs,,$(KERNEL_BUILDS_IN_PARALLEL),$(BUILD_CONFIGS))
520*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
521*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_all))
522*94d3b452SApple OSS Distributionsendif
523*94d3b452SApple OSS Distributions$(eval $(generated_top_level_build_all))
524*94d3b452SApple OSS Distributions
525*94d3b452SApple OSS Distributions.PHONY: build
526*94d3b452SApple OSS Distributions
527*94d3b452SApple OSS Distributionsbuild: build_all_bootstrap
528*94d3b452SApple OSS Distributions
529*94d3b452SApple OSS Distributions#
530*94d3b452SApple OSS Distributions# Post-process build results
531*94d3b452SApple OSS Distributions#
532*94d3b452SApple OSS Distributions
533*94d3b452SApple OSS Distributionsgenerated_top_level_config_all = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_all,,setup,build_all,$(KERNEL_BUILDS_IN_PARALLEL),$(BUILD_CONFIGS))
534*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
535*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_config_all))
536*94d3b452SApple OSS Distributionsendif
537*94d3b452SApple OSS Distributions$(eval $(generated_top_level_config_all))
538*94d3b452SApple OSS Distributions
539*94d3b452SApple OSS Distributions.PHONY: all config
540*94d3b452SApple OSS Distributions
541*94d3b452SApple OSS Distributionsall config: config_all_bootstrap
542*94d3b452SApple OSS Distributions
543*94d3b452SApple OSS Distributions.PHONY: all_embedded all_release_embedded all_development_embedded all_desktop
544*94d3b452SApple OSS Distributions
545*94d3b452SApple OSS Distributionsall_embedded all_release_embedded all_development_embedded all_desktop: all
546*94d3b452SApple OSS Distributions
547*94d3b452SApple OSS Distributions#
548*94d3b452SApple OSS Distributions# Install kernel files
549*94d3b452SApple OSS Distributions#
550*94d3b452SApple OSS Distributions
551*94d3b452SApple OSS Distributionsgenerated_top_level_build_install_primary = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_install_primary,,setup,config_all,1,$(PRIMARY_BUILD_CONFIGS))
552*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
553*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_install_primary))
554*94d3b452SApple OSS Distributionsendif
555*94d3b452SApple OSS Distributions$(eval $(generated_top_level_build_install_primary))
556*94d3b452SApple OSS Distributions
557*94d3b452SApple OSS Distributions.PHONY: install_primary
558*94d3b452SApple OSS Distributions
559*94d3b452SApple OSS Distributionsinstall_primary: build_install_primary_bootstrap
560*94d3b452SApple OSS Distributions
561*94d3b452SApple OSS Distributionsgenerated_top_level_build_install_non_primary = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_install_non_primary,,setup,config_all,$(KERNEL_BUILDS_IN_PARALLEL),$(NON_PRIMARY_BUILD_CONFIGS))
562*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
563*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_build_install_non_primary))
564*94d3b452SApple OSS Distributionsendif
565*94d3b452SApple OSS Distributions$(eval $(generated_top_level_build_install_non_primary))
566*94d3b452SApple OSS Distributions
567*94d3b452SApple OSS Distributions.PHONY: install_non_primary
568*94d3b452SApple OSS Distributions
569*94d3b452SApple OSS Distributionsinstall_non_primary: build_install_non_primary_bootstrap
570*94d3b452SApple OSS Distributions
571*94d3b452SApple OSS Distributionsgenerated_top_level_config_install_primary = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_install_primary,,setup,config_all,1,$(PRIMARY_BUILD_CONFIGS))
572*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
573*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_config_install_primary))
574*94d3b452SApple OSS Distributionsendif
575*94d3b452SApple OSS Distributions$(eval $(generated_top_level_config_install_primary))
576*94d3b452SApple OSS Distributions
577*94d3b452SApple OSS Distributions.PHONY: install_config_primary
578*94d3b452SApple OSS Distributions
579*94d3b452SApple OSS Distributionsinstall_config_primary: config_install_primary_bootstrap
580*94d3b452SApple OSS Distributions
581*94d3b452SApple OSS Distributions# config_install_variant iterates through products from all BUILD_CONFIGS so depends on config_all having completed overall
582*94d3b452SApple OSS Distributionsgenerated_top_level_config_install_variant = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_install_variant,,config_all_bootstrap,,1,$(VARIANT_CONFIGS))
583*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
584*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_config_install_variant))
585*94d3b452SApple OSS Distributionsendif
586*94d3b452SApple OSS Distributions$(eval $(generated_top_level_config_install_variant))
587*94d3b452SApple OSS Distributions
588*94d3b452SApple OSS Distributions.PHONY: install_config_variant
589*94d3b452SApple OSS Distributions
590*94d3b452SApple OSS Distributionsinstall_config_variant: config_install_variant_bootstrap
591*94d3b452SApple OSS Distributions
592*94d3b452SApple OSS Distributions# config_install iterates through products from all BUILD_CONFIGS so depends on config_all having completed overall
593*94d3b452SApple OSS Distributionsgenerated_top_level_config_install = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_install,,config_all_bootstrap,,1,$(FIRST_BUILD_CONFIG))
594*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
595*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_config_install))
596*94d3b452SApple OSS Distributionsendif
597*94d3b452SApple OSS Distributions$(eval $(generated_top_level_config_install))
598*94d3b452SApple OSS Distributions
599*94d3b452SApple OSS Distributions.PHONY: install_config final_touch_config_timestamps
600*94d3b452SApple OSS Distributions
601*94d3b452SApple OSS Distributionsinstall_config: config_install_bootstrap install_config_primary install_config_variant final_touch_config_timestamps
602*94d3b452SApple OSS Distributions
603*94d3b452SApple OSS Distributions
604*94d3b452SApple OSS Distributions# Tell the next build the latest timestamp of any potential file in DSTROOT/SYMROOT
605*94d3b452SApple OSS Distributionsfinal_touch_config_timestamps: config_install_bootstrap install_config_primary install_config_variant
606*94d3b452SApple OSS Distributions	$(_v)$(TOUCH) $(OBJROOT)/.symbolset.timestamp
607*94d3b452SApple OSS Distributions
608*94d3b452SApple OSS Distributions#
609*94d3b452SApple OSS Distributions# Aggregate install targets, which install everything appropriate for the current build alias/make target
610*94d3b452SApple OSS Distributions#
611*94d3b452SApple OSS Distributions
612*94d3b452SApple OSS Distributions.PHONY: install
613*94d3b452SApple OSS Distributions
614*94d3b452SApple OSS Distributionsifneq ($(filter $(RC_ProjectName),xnu_debug),)
615*94d3b452SApple OSS Distributionsinstall: install_kernels
616*94d3b452SApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_kasan),)
617*94d3b452SApple OSS Distributionsinstall: install_config install_kernels
618*94d3b452SApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_headers_Sim),)
619*94d3b452SApple OSS Distributionsinstall: installhdrs
620*94d3b452SApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_headers_host),)
621*94d3b452SApple OSS Distributionsinstall: installhdrs
622*94d3b452SApple OSS Distributionsexport INSTALLHDRS_SKIP_HOST=YES
623*94d3b452SApple OSS Distributionsexport INSTALLHDRS_MODULEMAPS_SKIP_HOST=YES
624*94d3b452SApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_headers_driverkit),)
625*94d3b452SApple OSS Distributionsinstall: installhdrs_desktop
626*94d3b452SApple OSS Distributionselse ifneq ($(filter $(RC_ProjectName),xnu_headers_exclavekit xnu_headers_exclavecore),)
627*94d3b452SApple OSS Distributionsinstall: installhdrs_desktop
628*94d3b452SApple OSS Distributionsexport INSTALLHDRS_MODULEMAPS_SKIP_HOST=YES
629*94d3b452SApple OSS Distributionsexport INSTALLHDRS_SKIP_HOST=YES
630*94d3b452SApple OSS Distributionsexport EXPORTHDRS_SKIP_EXCLAVES=YES
631*94d3b452SApple OSS Distributionselse
632*94d3b452SApple OSS Distributions
633*94d3b452SApple OSS Distributionsinstall: installhdrs install_textfiles install_config install_kernels install_aliases
634*94d3b452SApple OSS Distributionsendif
635*94d3b452SApple OSS Distributions
636*94d3b452SApple OSS Distributions.PHONY: install_embedded install_release_embedded install_development_embedded install_desktop
637*94d3b452SApple OSS Distributions
638*94d3b452SApple OSS Distributions# By default, all kernel files, headers, text files, and pseudo-kexts are installed
639*94d3b452SApple OSS Distributionsinstall_embedded install_release_embedded install_desktop: install
640*94d3b452SApple OSS Distributions
641*94d3b452SApple OSS Distributions# These special configs only install the kernel files
642*94d3b452SApple OSS Distributionsinstall_development_embedded: install_kernels install_aliases
643*94d3b452SApple OSS Distributions
644*94d3b452SApple OSS Distributions.PHONY: install_kernels final_touch_kernel_timestamps install_aliases
645*94d3b452SApple OSS Distributions
646*94d3b452SApple OSS Distributionsinstall_kernels: build_install_primary_bootstrap build_install_non_primary_bootstrap final_touch_kernel_timestamps
647*94d3b452SApple OSS Distributions
648*94d3b452SApple OSS Distributions# Tell the next build the latest timestamp of any potential file in DSTROOT/SYMROOT
649*94d3b452SApple OSS Distributionsfinal_touch_kernel_timestamps: build_install_primary_bootstrap build_install_non_primary_bootstrap
650*94d3b452SApple OSS Distributions	$(_v)$(TOUCH) $(OBJROOT)/.mach_kernel.timestamp
651*94d3b452SApple OSS Distributions	@echo "done building xnu"
652*94d3b452SApple OSS Distributions
653*94d3b452SApple OSS Distributions# Copy kernels that are aliases of another configuration
654*94d3b452SApple OSS Distributionsgenerated_top_level_install_alias = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,install_alias,,install_kernels,,$(KERNEL_BUILDS_IN_PARALLEL),$(ALIAS_CONFIGS))
655*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
656*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_install_alias))
657*94d3b452SApple OSS Distributionsendif
658*94d3b452SApple OSS Distributions$(eval $(generated_top_level_install_alias))
659*94d3b452SApple OSS Distributions
660*94d3b452SApple OSS Distributionsinstall_aliases: install_alias_bootstrap
661*94d3b452SApple OSS Distributions
662*94d3b452SApple OSS Distributions#
663*94d3b452SApple OSS Distributions# Install source tree
664*94d3b452SApple OSS Distributions#
665*94d3b452SApple OSS Distributions.PHONY: installsrc
666*94d3b452SApple OSS Distributions
667*94d3b452SApple OSS Distributions
668*94d3b452SApple OSS Distributionsifeq ($(CREATE_BRANCH_PATCH),)
669*94d3b452SApple OSS Distributionsinstallsrc:
670*94d3b452SApple OSS Distributions	@echo INSTALLSRC $(SRCROOT)
671*94d3b452SApple OSS Distributions	$(_v)$(MKDIR) $(SRCROOT)
672*94d3b452SApple OSS Distributions	$(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name compile_commands.json -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT)
673*94d3b452SApple OSS Distributions	$(_v)$(CHMOD) -R go+rX $(SRCROOT)
674*94d3b452SApple OSS Distributionsendif
675*94d3b452SApple OSS Distributions
676*94d3b452SApple OSS Distributions###############
677*94d3b452SApple OSS Distributions# Open source #
678*94d3b452SApple OSS Distributions###############
679*94d3b452SApple OSS Distributions
680*94d3b452SApple OSS Distributions
681*94d3b452SApple OSS Distributions########
682*94d3b452SApple OSS Distributions# Misc #
683*94d3b452SApple OSS Distributions########
684*94d3b452SApple OSS Distributions
685*94d3b452SApple OSS Distributions#
686*94d3b452SApple OSS Distributions# Clean up source tree
687*94d3b452SApple OSS Distributions#
688*94d3b452SApple OSS Distributions.PHONY: clean
689*94d3b452SApple OSS Distributions
690*94d3b452SApple OSS DistributionsCLEAN_RM_DIRS= $(OBJROOT) $(SYMROOT) $(DSTROOT) \
691*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/test/BUILD \
692*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/darwintests/build \
693*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/testkext/build \
694*94d3b452SApple OSS Distributions		$(SRCROOT)/libkdd/build \
695*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/unit_tests/BUILD \
696*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/execperf/BUILD \
697*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/packetdrill/BUILD \
698*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/perf_index/BUILD
699*94d3b452SApple OSS Distributions
700*94d3b452SApple OSS DistributionsCLEAN_ACTION_DIRS= $(SRCROOT)/tools/tests/MPMMTest \
701*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/TLBcoherency \
702*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/kqueue_tests \
703*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/mktimer \
704*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/zero-to-n \
705*94d3b452SApple OSS Distributions		$(SRCROOT)/tools/tests/personas
706*94d3b452SApple OSS Distributions
707*94d3b452SApple OSS Distributionsclean:
708*94d3b452SApple OSS Distributions	@:
709*94d3b452SApple OSS Distributions	$(_v)rm -f cscope.* 2> /dev/null
710*94d3b452SApple OSS Distributions	$(_v)rm -f TAGS 2> /dev/null
711*94d3b452SApple OSS Distributions	$(_v)for cdir in $(CLEAN_RM_DIRS); do \
712*94d3b452SApple OSS Distributions		if [ -d $${cdir} ] ; then \
713*94d3b452SApple OSS Distributions			echo "Removing $${cdir}"; \
714*94d3b452SApple OSS Distributions			rm -fr $${cdir} 2> /dev/null  || true ; \
715*94d3b452SApple OSS Distributions		fi ; \
716*94d3b452SApple OSS Distributions	done
717*94d3b452SApple OSS Distributions
718*94d3b452SApple OSS Distributions	$(_v)for mcdir in $(CLEAN_ACTION_DIRS); do \
719*94d3b452SApple OSS Distributions		make -C $${mcdir} clean; \
720*94d3b452SApple OSS Distributions	done
721*94d3b452SApple OSS Distributions
722*94d3b452SApple OSS Distributions
723*94d3b452SApple OSS Distributions#
724*94d3b452SApple OSS Distributions# Build source file list for cscope database and tags
725*94d3b452SApple OSS Distributions#
726*94d3b452SApple OSS Distributions.PHONY: cscope.files
727*94d3b452SApple OSS Distributions
728*94d3b452SApple OSS Distributionscscope.files:
729*94d3b452SApple OSS Distributions	@echo "Building file list for cscope and tags"
730*94d3b452SApple OSS Distributions	@find . -name '*.h' -type f | grep -v ^..BUILD > _cscope.files 2> /dev/null
731*94d3b452SApple OSS Distributions	@find . -name '*.defs' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
732*94d3b452SApple OSS Distributions	@find . -name '*.c' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
733*94d3b452SApple OSS Distributions	@find . -name '*.cpp' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
734*94d3b452SApple OSS Distributions	@find . -name '*.s' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
735*94d3b452SApple OSS Distributions	@find . -name '*.h.template' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
736*94d3b452SApple OSS Distributions	@cat $(OBJROOT)/cscope.genhdrs/* >> _cscope.files 2> /dev/null || true
737*94d3b452SApple OSS Distributions	@echo -k -q -c > cscope.files 2> /dev/null
738*94d3b452SApple OSS Distributions	@sort -u < _cscope.files >> cscope.files 2> /dev/null
739*94d3b452SApple OSS Distributions	@rm -f _cscope.files _cscope.files2 2> /dev/null
740*94d3b452SApple OSS Distributions
741*94d3b452SApple OSS Distributions#
742*94d3b452SApple OSS Distributions# Build cscope database
743*94d3b452SApple OSS Distributions#
744*94d3b452SApple OSS Distributionscscope: cscope.files
745*94d3b452SApple OSS Distributions	@echo "Building cscope database"
746*94d3b452SApple OSS Distributions	@cscope -bvU 2> /dev/null
747*94d3b452SApple OSS Distributions
748*94d3b452SApple OSS Distributions#
749*94d3b452SApple OSS Distributions# Build tags
750*94d3b452SApple OSS Distributions#
751*94d3b452SApple OSS Distributionstags: cscope.files
752*94d3b452SApple OSS Distributions	@echo "Building ctags"
753*94d3b452SApple OSS Distributions	@-sed 1d cscope.files | xargs ctags -dtw 2> /dev/null || \
754*94d3b452SApple OSS Distributions		echo "Phantom files detected!" 2>&1 > /dev/null
755*94d3b452SApple OSS Distributions	@-[ -f TAGS ] || ${MAKE} -f $(firstword $(MAKEFILE_LIST)) TAGS
756*94d3b452SApple OSS Distributions
757*94d3b452SApple OSS DistributionsTAGS: cscope.files
758*94d3b452SApple OSS Distributions	@echo "Building etags"
759*94d3b452SApple OSS Distributions	@-cat cscope.files | etags -l auto -S - 2> /dev/null
760*94d3b452SApple OSS Distributions	@rm -f cscope.files 2> /dev/null
761*94d3b452SApple OSS Distributions
762*94d3b452SApple OSS Distributions
763*94d3b452SApple OSS Distributions.PHONY: help
764*94d3b452SApple OSS Distributions
765*94d3b452SApple OSS Distributionshelp:
766*94d3b452SApple OSS Distributions	@cat README.md
767*94d3b452SApple OSS Distributions
768*94d3b452SApple OSS Distributions.PHONY: print_exports
769*94d3b452SApple OSS Distributions
770*94d3b452SApple OSS Distributionsprint_exports:
771*94d3b452SApple OSS Distributions	$(_v)printenv | sort
772*94d3b452SApple OSS Distributions
773*94d3b452SApple OSS Distributionsgenerated_top_level_print_exports = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,print_exports,,,,1,$(FIRST_BUILD_CONFIG))
774*94d3b452SApple OSS Distributionsifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
775*94d3b452SApple OSS Distributions$(warning Generate makefile fragment: $(generated_top_level_print_exports))
776*94d3b452SApple OSS Distributionsendif
777*94d3b452SApple OSS Distributions$(eval $(generated_top_level_print_exports))
778*94d3b452SApple OSS Distributions
779*94d3b452SApple OSS Distributions.PHONY: print_exports_first_build_config
780*94d3b452SApple OSS Distributions
781*94d3b452SApple OSS Distributionsprint_exports_first_build_config: print_exports_bootstrap
782*94d3b452SApple OSS Distributions
783*94d3b452SApple OSS Distributions
784*94d3b452SApple OSS Distributions# vim: set ft=make:
785