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