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