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