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