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